Skip to content

Commit

Permalink
Don't call get_subsystems from within delete_bdev().
Browse files Browse the repository at this point in the history
Fixes #260

Signed-off-by: Gil Bregman <gbregman@il.ibm.com>
  • Loading branch information
gbregman committed Oct 19, 2023
1 parent 6899a3f commit 62afcf5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions control/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ def delete_bdev_safe(self, request, context=None):
try:
self.gateway_state.remove_bdev(request.bdev_name)
except Exception as ex:
self.logger.error(f"Error persisting delete_bdev {request.bdev_name}: {ex}")
self.logger.error(
f"Error persisting delete_bdev {request.bdev_name}: {ex}")
raise

return pb2.req_status(status=ret)
Expand Down Expand Up @@ -301,7 +302,8 @@ def create_subsystem(self, request, context=None):
def delete_subsystem_safe(self, request, context=None):
"""Deletes a subsystem."""

self.logger.info(f"Received request to delete subsystem {request.subsystem_nqn}")
self.logger.info(
f"Received request to delete subsystem {request.subsystem_nqn}")
try:
ret = rpc_nvmf.nvmf_delete_subsystem(
self.spdk_rpc_client,
Expand Down Expand Up @@ -333,7 +335,8 @@ def delete_subsystem(self, request, context=None):
def add_namespace_safe(self, request, context=None):
"""Adds a namespace to a subsystem."""

self.logger.info(f"Received request to add {request.bdev_name} to {request.subsystem_nqn}")
self.logger.info(f"Received request to add {request.bdev_name} to"
f" {request.subsystem_nqn}")
try:
nsid = rpc_nvmf.nvmf_subsystem_add_ns(
self.spdk_rpc_client,
Expand All @@ -356,9 +359,11 @@ def add_namespace_safe(self, request, context=None):
request.nsid = nsid
json_req = json_format.MessageToJson(
request, preserving_proto_field_name=True)
self.gateway_state.add_namespace(request.subsystem_nqn, str(nsid), json_req)
self.gateway_state.add_namespace(request.subsystem_nqn,
str(nsid), json_req)
except Exception as ex:
self.logger.error(f"Error persisting add_namespace {nsid}: {ex}")
self.logger.error(
f"Error persisting add_namespace {nsid}: {ex}")
raise

return pb2.nsid(nsid=nsid, status=True)
Expand Down

0 comments on commit 62afcf5

Please sign in to comment.