def setUp(self): super(LinuxFCTestCase, self).setUp() self.cmds = [] self.mock_object(os.path, 'exists', return_value=True) self.mock_object(os.path, 'isdir', return_value=True) self.lfc = linuxfc.LinuxFibreChannel(None, execute=self.fake_execute)
def setUp(self): super(LinuxFCTestCase, self).setUp() self.cmds = [] mock.patch.object(os.path, 'exists', return_value=True).start() self.addCleanup(mock.patch.stopall) self.lfc = linuxfc.LinuxFibreChannel(None, execute=self.fake_execute)
def __init__(self, root_helper, driver=None, execute=None, use_multipath=False, device_scan_attempts=initiator.DEVICE_SCAN_ATTEMPTS_DEFAULT, *args, **kwargs): self._linuxfc = linuxfc.LinuxFibreChannel(root_helper, execute) super(FibreChannelConnector, self).__init__( root_helper, driver=driver, execute=execute, device_scan_attempts=device_scan_attempts, *args, **kwargs) self.use_multipath = use_multipath
def get_connector_properties(root_helper, *args, **kwargs): """The Fibre Channel connector properties.""" props = {} fc = linuxfc.LinuxFibreChannel(root_helper, execute=kwargs.get('execute')) wwpns = fc.get_fc_wwpns() if wwpns: props['wwpns'] = wwpns wwnns = fc.get_fc_wwnns() if wwnns: props['wwnns'] = wwnns return props
import nova.netconf import nova.virt.libvirt.driver from nova import objects # import shlex # from oslo_privsep import priv_context # priv_context.init(root_helper=shlex.split(utils.get_root_helper())) CONF = nova.conf.CONF argv = [] default_config_files = ['/etc/nova/nova.conf'] config.parse_args(argv, default_config_files=default_config_files) CONF.import_opt('compute_topic', 'nova.compute.rpcapi') logging.setup(CONF, 'nova') LOG = logging.getLogger('nova.compute') utils.monkey_patch() objects.register_all() root_helper = utils.get_root_helper() root_helper = 'sudo privsep-helper --config-file /etc/nova/nova.conf --config-dir /etc/nova' connector.get_connector_properties(root_helper, CONF.my_block_storage_ip,CONF.libvirt.iscsi_use_multipath,enforce_multipath=True,host=CONF.host) connector = importutils.import_class('os_brick.initiator.connector.FibreChannelConnector') connector.get_connector_properties(root_helper,host='i620d7-app',multipath=False,enforce_multipath=True,execute=None) fc = linuxfc.LinuxFibreChannel(root_helper,execute=None)