def nvmf_create_transport(self, request, context): # set transport type for device access self.logger.info({f"Setting transport type to: {request.trtype}"}) try: return_string = self.spdk_rpc.nvmf.nvmf_create_transport( self.client, request.trtype) except Exception as ex: self.logger.error( f"Create Transport {request.trtype} returned with error: \n {ex}" ) context.set_code(grpc.StatusCode.INTERNAL) context.set_details(f"{ex}") return pb2.req_status() return pb2.req_status(status=return_string)
def nvmf_subsystem_add_host(self, request, context): # grant host access to a given subsystem self.logger.info({ f"Received request to add: {request.host_nqn} to {request.subsystem_nqn}", }) try: return_string = self.spdk_rpc.nvmf.nvmf_subsystem_add_host( self.client, request.subsystem_nqn, request.host_nqn) self.logger.info(f"Status of add host: {return_string}") except Exception as ex: self.logger.error(f"Add Host returned with error: \n {ex}") context.set_code(grpc.StatusCode.INTERNAL) context.set_details(f"{ex}") return pb2.req_status() return pb2.req_status(status=return_string)
def nvmf_delete_subsystem(self, request, context): # Delete an NVMe Subsystem self.logger.info({ f"Received request to delete: {request.subsystem_nqn}", }) try: return_string = self.spdk_rpc.nvmf.nvmf_delete_subsystem( self.client, nqn=request.subsystem_nqn, ) self.logger.info(f"returned with status: {return_string}") except Exception as ex: self.logger.error(f"delete_subsystem failed with: \n {ex}") context.set_code(grpc.StatusCode.INTERNAL) context.set_details(f"{ex}") return pb2.req_status() return pb2.req_status(status=return_string)
def bdev_rbd_delete(self, request, context): # Delete bdev self.logger.info({ f"Received request to delete bdev: {request.bdev_name}", }) try: return_string = self.spdk_rpc.bdev.bdev_rbd_delete( self.client, request.bdev_name, ) self.logger.info(f"Deleted bdev {request.bdev_name}") except Exception as ex: self.logger.error(f"bdev delete failed with: \n {ex}") context.set_code(grpc.StatusCode.INTERNAL) context.set_details(f"{ex}") return pb2.req_status() return pb2.req_status(status=return_string)
def nvmf_subsystem_allow_any_host(self, request, context): # grant host access to a given subsystem self.logger.info({ f"Set allow all hosts to {request.subsystem_nqn} to: {request.disable}", }) try: return_string = self.spdk_rpc.nvmf.nvmf_subsystem_allow_any_host( self.client, request.subsystem_nqn, request.disable) self.logger.info( f"Status of allow all host request: {return_string}") except Exception as ex: self.logger.error( f"Allow any host set to {request.disable} returned error: \n {ex}" ) context.set_code(grpc.StatusCode.INTERNAL) context.set_details(f"{ex}") return pb2.req_status() return pb2.req_status(status=return_string)
def nvmf_subsystem_add_listener(self, request, context): # Add a istener at the specified tcp-ip address for the subsystem specified self.logger.info({ f"Adding listener at {request.traddr} : {request.trsvcid} for {request.nqn}" }) try: return_string = self.spdk_rpc.nvmf.nvmf_subsystem_add_listener( self.client, request.nqn, request.trtype, request.traddr, request.trsvcid, request.adrfam, ) self.logger.info(f"Status of add listener: {return_string}") except Exception as ex: self.logger.error(f"Add Listener returned with error: \n {ex}") context.set_code(grpc.StatusCode.INTERNAL) context.set_details(f"{ex}") return pb2.req_status() return pb2.req_status(status=return_string)