Skip to content

Commit

Permalink
Some adjustments to protobuf field and request names.
Browse files Browse the repository at this point in the history
Fixes ceph#518

Signed-off-by: Gil Bregman <[email protected]>
  • Loading branch information
gbregman committed Mar 31, 2024
1 parent c1117be commit b9d7e2c
Show file tree
Hide file tree
Showing 10 changed files with 291 additions and 291 deletions.
68 changes: 34 additions & 34 deletions control/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ def parse_version_string(self, version):

def gw_get_info(self):
ver = os.getenv("NVMEOF_VERSION")
req = pb2.get_gateway_info_req(cli_version=ver)
gw_info = self.stub.get_gateway_info(req)
req = pb2.gateway_info_get_req(cli_version=ver)
gw_info = self.stub.gateway_info_get(req)
if gw_info.status == 0:
base_ver = self.parse_version_string(BASE_GATEWAY_VERSION)
assert base_ver != None
Expand Down Expand Up @@ -409,9 +409,9 @@ def gw_get_log_level(self, args):
"""Get gateway's log level"""

out_func, err_func = self.get_output_functions(args)
req = pb2.get_gateway_log_level_req()
req = pb2.gateway_log_level_get_req()
try:
ret = self.stub.get_gateway_log_level(req)
ret = self.stub.gateway_log_level_get(req)
except Exception as ex:
ret = pb2.req_status(status = errno.EINVAL, error_message = f"Failure getting gateway log level:\n{ex}")

Expand Down Expand Up @@ -448,12 +448,12 @@ def gw_set_log_level(self, args):
log_level = args.level.lower()

try:
req = pb2.set_gateway_log_level_req(log_level=log_level)
req = pb2.gateway_log_level_set_req(log_level=log_level)
except ValueError as err:
self.cli.parser.error(f"invalid log level {log_level}, error {err}")

try:
ret = self.stub.set_gateway_log_level(req)
ret = self.stub.gateway_log_level_set(req)
except Exception as ex:
ret = pb2.req_status(status = errno.EINVAL, error_message = f"Failure setting gateway log level:\n{ex}")

Expand Down Expand Up @@ -508,9 +508,9 @@ def spdk_log_level_disable(self, args):

out_func, err_func = self.get_output_functions(args)

req = pb2.disable_spdk_nvmf_logs_req()
req = pb2.spdk_nvmf_logs_disable_req()
try:
ret = self.stub.disable_spdk_nvmf_logs(req)
ret = self.stub.spdk_nvmf_logs_disable(req)
except Exception as ex:
ret = pb2.req_status(status = errno.EINVAL, error_message = f"Failure disabling SPDK nvmf log flags:\n{ex}")

Expand Down Expand Up @@ -542,9 +542,9 @@ def spdk_log_level_get(self, args):

out_func, err_func = self.get_output_functions(args)

req = pb2.get_spdk_nvmf_log_flags_and_level_req()
req = pb2.spdk_nvmf_log_flags_and_level_get_req()
try:
ret = self.stub.get_spdk_nvmf_log_flags_and_level(req)
ret = self.stub.spdk_nvmf_log_flags_and_level_get(req)
except Exception as ex:
ret = pb2.req_status(status = errno.EINVAL, error_message = f"Failure getting SPDK log levels and nvmf log flags:\n{ex}")

Expand Down Expand Up @@ -592,12 +592,12 @@ def spdk_log_level_set(self, args):
print_level = args.print.upper()

try:
req = pb2.set_spdk_nvmf_logs_req(log_level=log_level, print_level=print_level)
req = pb2.spdk_nvmf_logs_set_req(log_level=log_level, print_level=print_level)
except ValueError as err:
self.cli.parser.error(f"invalid log level {log_level}, error {err}")

try:
ret = self.stub.set_spdk_nvmf_logs(req)
ret = self.stub.spdk_nvmf_logs_set(req)
except Exception as ex:
ret = pb2.req_status(status = errno.EINVAL, error_message = f"Failure setting SPDK log levels and nvmf log flags:\n{ex}")

Expand Down Expand Up @@ -660,12 +660,12 @@ def subsystem_add(self, args):
if args.subsystem == GatewayUtils.DISCOVERY_NQN:
self.cli.parser.error("Can't add a discovery subsystem")

req = pb2.create_subsystem_req(subsystem_nqn=args.subsystem,
req = pb2.subsystem_create_req(subsystem_nqn=args.subsystem,
serial_number=args.serial_number,
max_namespaces=args.max_namespaces,
enable_ha=True)
try:
ret = self.stub.create_subsystem(req)
ret = self.stub.subsystem_create(req)
except Exception as ex:
ret = pb2.req_status(status = errno.EINVAL, error_message = f"Failure adding subsystem {args.subsystem}:\n{ex}")

Expand Down Expand Up @@ -699,9 +699,9 @@ def subsystem_del(self, args):
if args.subsystem == GatewayUtils.DISCOVERY_NQN:
self.cli.parser.error("Can't delete a discovery subsystem")

req = pb2.delete_subsystem_req(subsystem_nqn=args.subsystem, force=args.force)
req = pb2.subsystem_delete_req(subsystem_nqn=args.subsystem, force=args.force)
try:
ret = self.stub.delete_subsystem(req)
ret = self.stub.subsystem_delete(req)
except Exception as ex:
ret = pb2.req_status(status = errno.EINVAL, error_message = f"Failure deleting subsystem {args.subsystem}:\n{ex}")

Expand Down Expand Up @@ -735,7 +735,7 @@ def subsystem_list(self, args):

subsystems = None
try:
subsystems = self.stub.list_subsystems(pb2.list_subsystems_req(subsystem_nqn=args.subsystem, serial_number=args.serial_number))
subsystems = self.stub.subsystem_list(pb2.subsystem_list_req(subsystem_nqn=args.subsystem, serial_number=args.serial_number))
except Exception as ex:
subsystems = pb2.subsystems_info_cli(status = errno.EINVAL, error_message = f"Failure listing subsystems:\n{ex}")

Expand Down Expand Up @@ -844,16 +844,16 @@ def listener_add(self, args):
if args.adrfam:
adrfam = args.adrfam.lower()

req = pb2.create_listener_req(
nqn=args.subsystem,
req = pb2.listener_create_req(
subsystem_nqn=args.subsystem,
host_name=args.host_name,
adrfam=adrfam,
traddr=traddr,
trsvcid=args.trsvcid,
)

try:
ret = self.stub.create_listener(req)
ret = self.stub.listener_create(req)
except Exception as ex:
ret = pb2.req_status(status = errno.EINVAL,
error_message = f"Failure adding {args.subsystem} listener at {traddr}:{args.trsvcid}:\n{ex}")
Expand Down Expand Up @@ -900,8 +900,8 @@ def listener_del(self, args):
if args.adrfam:
adrfam = args.adrfam.lower()

req = pb2.delete_listener_req(
nqn=args.subsystem,
req = pb2.listener_delete_req(
subsystem_nqn=args.subsystem,
host_name=args.host_name,
adrfam=adrfam,
traddr=traddr,
Expand All @@ -910,7 +910,7 @@ def listener_del(self, args):
)

try:
ret = self.stub.delete_listener(req)
ret = self.stub.listener_delete(req)
except Exception as ex:
ret = pb2.req_status(status = errno.EINVAL,
error_message = f"Failure deleting listener {traddr}:{args.trsvcid} from {args.subsystem}:\n{ex}")
Expand Down Expand Up @@ -945,7 +945,7 @@ def listener_list(self, args):
out_func, err_func = self.get_output_functions(args)
listeners_info = None
try:
listeners_info = self.stub.list_listeners(pb2.list_listeners_req(subsystem=args.subsystem))
listeners_info = self.stub.listener_list(pb2.listener_list_req(subsystem_nqn=args.subsystem))
except Exception as ex:
listeners_info = pb2.listeners_info(status = errno.EINVAL, error_message = f"Failure listing listeners:\n{ex}", listeners=[])

Expand Down Expand Up @@ -1028,9 +1028,9 @@ def host_add(self, args):
out_func, err_func = self.get_output_functions(args)
if not args.host:
self.cli.parser.error("--host argument is mandatory for add command")
req = pb2.add_host_req(subsystem_nqn=args.subsystem, host_nqn=args.host)
req = pb2.host_add_req(subsystem_nqn=args.subsystem, host_nqn=args.host)
try:
ret = self.stub.add_host(req)
ret = self.stub.host_add(req)
except Exception as ex:
if args.host == "*":
errmsg = f"Failure allowing open host access to {args.subsystem}"
Expand Down Expand Up @@ -1070,10 +1070,10 @@ def host_del(self, args):
out_func, err_func = self.get_output_functions(args)
if not args.host:
self.cli.parser.error("--host argument is mandatory for del command")
req = pb2.remove_host_req(subsystem_nqn=args.subsystem, host_nqn=args.host)
req = pb2.host_remove_req(subsystem_nqn=args.subsystem, host_nqn=args.host)

try:
ret = self.stub.remove_host(req)
ret = self.stub.host_remove(req)
except Exception as ex:
if args.host == "*":
errmsg = f"Failure disabling open host access to {args.subsystem}"
Expand Down Expand Up @@ -1114,7 +1114,7 @@ def host_list(self, args):

hosts_info = None
try:
hosts_info = self.stub.list_hosts(pb2.list_hosts_req(subsystem=args.subsystem))
hosts_info = self.stub.host_list(pb2.host_list_req(subsystem_nqn=args.subsystem))
except Exception as ex:
hosts_info = pb2.hosts_info(status = errno.EINVAL, error_message = f"Failure listing hosts:\n{ex}", hosts=[])

Expand Down Expand Up @@ -1190,7 +1190,7 @@ def connection_list(self, args):
out_func, err_func = self.get_output_functions(args)
connections_info = None
try:
connections_info = self.stub.list_connections(pb2.list_connections_req(subsystem=args.subsystem))
connections_info = self.stub.connection_list(pb2.connection_list_req(subsystem_nqn=args.subsystem))
except Exception as ex:
connections_info = pb2.connections_info(status = errno.EINVAL,
error_message = f"Failure listing hosts:\n{ex}", connections=[])
Expand Down Expand Up @@ -1280,7 +1280,7 @@ def ns_add(self, args):
nsid=args.nsid,
block_size=args.block_size,
uuid=args.uuid,
anagrpid=args.load_balancing_group,
load_balancing_group=args.load_balancing_group,
create_image=args.rbd_create_image,
size=img_size,
force=args.force)
Expand Down Expand Up @@ -1502,8 +1502,8 @@ def ns_list(self, args):
self.cli.parser.error("nsid value must be positive")

try:
namespaces_info = self.stub.list_namespaces(pb2.list_namespaces_req(subsystem=args.subsystem,
nsid=args.nsid, uuid=args.uuid))
namespaces_info = self.stub.namespace_list(pb2.namespace_list_req(subsystem_nqn=args.subsystem,
nsid=args.nsid, uuid=args.uuid))
except Exception as ex:
namespaces_info = pb2.namespaces_info(status = errno.EINVAL, error_message = f"Failure listing namespaces:\n{ex}")

Expand Down Expand Up @@ -1680,7 +1680,7 @@ def ns_change_load_balancing_group(self, args):
try:
change_lb_group_req = pb2.namespace_change_load_balancing_group_req(subsystem_nqn=args.subsystem,
nsid=args.nsid, uuid=args.uuid,
anagrpid=args.load_balancing_group)
load_balancing_group=args.load_balancing_group)
ret = self.stub.namespace_change_load_balancing_group(change_lb_group_req)
except Exception as ex:
ret = pb2.req_status(status = errno.EINVAL, error_message = f"Failure changing namespace load balancing group:\n{ex}")
Expand Down
Loading

0 comments on commit b9d7e2c

Please sign in to comment.