spdkcli: minor startup fixes

There are a couple of runtime errors in spdkcli that prevent it from
properly loading. One is the fact that it doesn't properly check to make
sure that specific subsystems are enabled before trying to load them.
The other is an apparently uninitialized variable in the iscsi object.

Change-Id: I458c6da71b60697b19c924308ac0e33a12f7a8a6
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/430638
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2018-10-24 13:54:21 -07:00 committed by Ben Walker
parent c89b7bac82
commit b7c4b7bc4e
2 changed files with 11 additions and 2 deletions

View File

@ -57,6 +57,7 @@ class UIISCSIGlobalParam(UINode):
class UIISCSIDevices(UINode):
def __init__(self, parent):
UINode.__init__(self, "target_nodes", parent)
self.scsi_devices = list()
self.refresh()
def refresh(self):

View File

@ -36,8 +36,10 @@ class UIRoot(UINode):
self._children = set([])
UIBdevs(self)
UILvolStores(self)
UIVhosts(self)
UINVMf(self)
if self.has_subsystem("vhost"):
UIVhosts(self)
if self.has_subsystem("nvmf"):
UINVMf(self)
UIISCSI(self)
def set_rpc_target(self, s):
@ -421,6 +423,12 @@ class UIRoot(UINode):
def get_iscsi_global_params(self, **kwargs):
return rpc.iscsi.get_iscsi_global_params(self.client, **kwargs)
def has_subsystem(self, subsystem):
for system in rpc.subsystem.get_subsystems(self.client):
if subsystem.lower() == system["subsystem"].lower():
return True
return False
class Bdev(object):
def __init__(self, bdev_info):