Пример #1
0
    def __init__(self, connection):
        super(LibvirtNVMEVolumeDriver, self).__init__(connection)

        self.connector = connector.InitiatorConnector.factory(
            initiator.NVME,
            utils.get_root_helper(),
            device_scan_attempts=CONF.libvirt.num_nvme_discover_tries)
Пример #2
0
 def __init__(self, host):
     super(LibvirtScaleIOVolumeDriver, self).__init__(host,
                                                      is_block_dev=False)
     self.connector = connector.InitiatorConnector.factory(
         initiator.SCALEIO,
         utils.get_root_helper(),
         device_scan_attempts=CONF.libvirt.num_volume_scan_tries)
Пример #3
0
 def __init__(self, connection):
     super(LibvirtScaleIOVolumeDriver, self).__init__(connection,
                                                      is_block_dev=False)
     self.connector = connector.InitiatorConnector.factory(
         'SCALEIO',
         utils.get_root_helper(),
         device_scan_attempts=CONF.libvirt.num_iscsi_scan_tries)
Пример #4
0
    def __init__(self, connection):
        super(LibvirtVZStorageVolumeDriver, self).__init__(connection)

        # Check for duplicate options:
        # -c - cluster name
        # -l - log file, includes %(cluster_name)s, so it's handled as a
        #      separate config parameter
        # -C - SSD cache file, the same thing with %(cluster_name)s
        # -u, -g, -m - there are default values for these options, so
        #              they're separate config parameters
        cfg_opts_set = set(CONF.libvirt.vzstorage_mount_opts)
        invalid_opts_set = set(('-c', '-l', '-C', '-u', '-g', '-m',))
        invalid_cfg_opts = cfg_opts_set.intersection(invalid_opts_set)

        if invalid_cfg_opts:
            msg = (_("You can't use %s options in vzstorage_mount_opts "
                     "configuration parameter.") %
                     ', '.join(invalid_cfg_opts))
            raise exception.NovaException(msg)

        # Call the factory here so we can support
        # more than x86 architectures.
        self.connector = connector.InitiatorConnector.factory(
            'vzstorage', utils.get_root_helper(),
            vzstorage_mount_point_base=CONF.libvirt.vzstorage_mount_point_base)
Пример #5
0
 def __init__(self, host):
     """Init DISCO connector for LibVirt."""
     super(LibvirtDISCOVolumeDriver, self).__init__(host,
                                                    is_block_dev=False)
     self.connector = connector.InitiatorConnector.factory(
         initiator.DISCO, utils.get_root_helper(),
         device_scan_attempts=CONF.libvirt.num_volume_scan_tries)
Пример #6
0
 def __init__(self, connection):
     """Init DISCO connector for LibVirt."""
     super(LibvirtDISCOVolumeDriver, self).__init__(connection,
                                                    is_block_dev=False)
     self.connector = connector.InitiatorConnector.factory(
         'DISCO', utils.get_root_helper(),
         device_scan_attempts=CONF.libvirt.num_iscsi_scan_tries)
Пример #7
0
    def __init__(self, connection):
        super(LibvirtNVMEVolumeDriver,
              self).__init__(connection)

        self.connector = connector.InitiatorConnector.factory(
            initiator.NVME, utils.get_root_helper(),
            device_scan_attempts=CONF.libvirt.num_nvme_discover_tries)
Пример #8
0
    def __init__(self, connection):
        super(LibvirtVZStorageVolumeDriver, self).__init__(connection)

        # Check for duplicate options:
        # -c - cluster name
        # -l - log file, includes %(cluster_name)s, so it's handled as a
        #      separate config parameter
        # -C - SSD cache file, the same thing with %(cluster_name)s
        # -u, -g, -m - there are default values for these options, so
        #              they're separate config parameters
        cfg_opts_set = set(CONF.libvirt.vzstorage_mount_opts)
        invalid_opts_set = set(('-c', '-l', '-C', '-u', '-g', '-m',))
        invalid_cfg_opts = cfg_opts_set.intersection(invalid_opts_set)

        if invalid_cfg_opts:
            msg = (_("You can't use %s options in vzstorage_mount_opts "
                     "configuration parameter.") %
                     ', '.join(invalid_cfg_opts))
            raise exception.InternalError(msg)

        # Call the factory here so we can support
        # more than x86 architectures.
        self.connector = connector.InitiatorConnector.factory(
            initiator.VZSTORAGE, utils.get_root_helper(),
            vzstorage_mount_point_base=CONF.libvirt.vzstorage_mount_point_base)
Пример #9
0
 def __init__(self, host):
     super(LibvirtPortworxVolumeDriver, self).__init__(host,
                                                       is_block_dev=False)
     self.connector = connector.InitiatorConnector.factory(
         'PORTWORX',
         utils.get_root_helper(),
         device_scan_attempts=CONF.libvirt.num_iscsi_scan_tries)
Пример #10
0
    def __init__(self, connection):
        super(LibvirtAOEVolumeDriver,
              self).__init__(connection, is_block_dev=True)

        # Call the factory here so we can support
        # more than x86 architectures.
        self.connector = connector.InitiatorConnector.factory(
            'AOE', utils.get_root_helper(),
            device_scan_attempts=CONF.libvirt.num_aoe_discover_tries)
Пример #11
0
    def __init__(self, host):
        super(LibvirtAOEVolumeDriver, self).__init__(host, is_block_dev=True)

        # Call the factory here so we can support
        # more than x86 architectures.
        self.connector = connector.InitiatorConnector.factory(
            'AOE',
            utils.get_root_helper(),
            device_scan_attempts=CONF.libvirt.num_aoe_discover_tries)
Пример #12
0
def get_iscsi_initiator(execute=None):
    """Get iscsi initiator name for this machine."""

    root_helper = utils.get_root_helper()
    # so we can mock out the execute itself
    # in unit tests.
    if not execute:
        execute = putils.execute
    iscsi = connector.ISCSIConnector(root_helper=root_helper, execute=execute)
    return iscsi.get_initiator()
Пример #13
0
    def __init__(self, connection):
        super(LibvirtISERVolumeDriver, self).__init__(connection)

        # Call the factory here so we can support
        # more than x86 architectures.
        self.connector = connector.InitiatorConnector.factory(
            initiator.ISER, utils.get_root_helper(),
            use_multipath=CONF.libvirt.iser_use_multipath,
            device_scan_attempts=CONF.libvirt.num_iser_scan_tries,
            transport=self._get_transport())
Пример #14
0
    def __init__(self, host):
        super(LibvirtFibreChannelVolumeDriver,
              self).__init__(host, is_block_dev=False)

        # Call the factory here so we can support
        # more than x86 architectures.
        self.connector = connector.InitiatorConnector.factory(
            'FIBRE_CHANNEL', utils.get_root_helper(),
            use_multipath=CONF.libvirt.volume_use_multipath,
            device_scan_attempts=CONF.libvirt.num_volume_scan_tries)
Пример #15
0
    def __init__(self, connection):
        super(LibvirtFibreChannelVolumeDriver,
              self).__init__(connection, is_block_dev=False)

        # Call the factory here so we can support
        # more than x86 architectures.
        self.connector = connector.InitiatorConnector.factory(
            'FIBRE_CHANNEL', utils.get_root_helper(),
            use_multipath=CONF.libvirt.iscsi_use_multipath,
            device_scan_attempts=CONF.libvirt.num_iscsi_scan_tries)
Пример #16
0
    def __init__(self, connection):
        super(LibvirtISERVolumeDriver, self).__init__(connection)

        # Call the factory here so we can support
        # more than x86 architectures.
        self.connector = connector.InitiatorConnector.factory(
            initiator.ISER,
            utils.get_root_helper(),
            use_multipath=CONF.libvirt.iser_use_multipath,
            device_scan_attempts=CONF.libvirt.num_iser_scan_tries,
            transport=self._get_transport())
Пример #17
0
    def __init__(self, host):
        super(LibvirtISCSIVolumeDriver, self).__init__(host, is_block_dev=True)

        # Call the factory here so we can support
        # more than x86 architectures.
        self.connector = connector.InitiatorConnector.factory(
            initiator.ISCSI,
            utils.get_root_helper(),
            use_multipath=CONF.libvirt.volume_use_multipath,
            device_scan_attempts=CONF.libvirt.num_volume_scan_tries,
            transport=self._get_transport())
Пример #18
0
    def __init__(self, host):
        super(LibvirtISCSIVolumeDriver, self).__init__(host,
                                                       is_block_dev=True)

        # Call the factory here so we can support
        # more than x86 architectures.
        self.connector = connector.InitiatorConnector.factory(
            initiator.ISCSI, utils.get_root_helper(),
            use_multipath=CONF.libvirt.volume_use_multipath,
            device_scan_attempts=CONF.libvirt.num_volume_scan_tries,
            transport=self._get_transport())
Пример #19
0
def brick_get_connector_properties(multipath=False, enforce_multipath=False):
    """Wrapper to automatically set root_helper in brick calls.
    :param multipath: A boolean indicating whether the connector can
                      support multipath.
    :param enforce_multipath: If True, it raises exception when multipath=True
                              is specified but multipathd is not running.
                              If False, it falls back to multipath=False
                              when multipathd is not running.
    """

    root_helper = utils.get_root_helper()
    return connector.get_connector_properties(root_helper, CONF.my_ip,
                                              multipath, enforce_multipath)
Пример #20
0
    def __init__(self, virtapi):
        super(LXDDriver, self).__init__(virtapi)

        self.client = None  # Initialized by init_host
        self.host = NOVA_CONF.host
        self.network_api = network.API()
        self.vif_driver = lxd_vif.LXDGenericVifDriver()
        self.firewall_driver = firewall.load_driver(
            default='nova.virt.firewall.NoopFirewallDriver')

        self.storage_driver = connector.InitiatorConnector.factory(
            'ISCSI', utils.get_root_helper(),
            use_multipath=CONF.libvirt.volume_use_multipath,
            device_scan_attempts=CONF.libvirt.num_iscsi_scan_tries,
            transport='default')
Пример #21
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, 'nova')
    priv_context.init(root_helper=shlex.split(utils.get_root_helper()))
    utils.monkey_patch()
    objects.register_all()
    # Ensure os-vif objects are registered and plugins loaded
    os_vif.initialize()

    gmr.TextGuruMeditation.setup_autorun(version)

    cmd_common.block_db_access('nova-compute')
    objects_base.NovaObject.indirection_api = conductor_rpcapi.ConductorAPI()

    server = service.Service.create(binary='nova-compute',
                                    topic=compute_rpcapi.RPC_TOPIC)
    service.serve(server)
    service.wait()
Пример #22
0
def brick_get_connector(protocol, driver=None,
                        use_multipath=False,
                        device_scan_attempts=3,
                        *args, **kwargs):
    """Wrapper to get a brick connector object.
    This automatically populates the required protocol as well
    as the root_helper needed to execute commands.
    """

    root_helper = utils.get_root_helper()
    if protocol.upper() == "RBD":
        kwargs['do_local_attach'] = True
    return connector.InitiatorConnector.factory(
        protocol, root_helper,
        driver=driver,
        use_multipath=use_multipath,
        device_scan_attempts=device_scan_attempts,
        *args, **kwargs)
Пример #23
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, 'nova')
    priv_context.init(root_helper=shlex.split(utils.get_root_helper()))
    objects.register_all()
    gmr_opts.set_defaults(CONF)
    # Ensure os-vif objects are registered and plugins loaded
    os_vif.initialize()

    gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)

    cmd_common.block_db_access('nova-compute')
    objects_base.NovaObject.indirection_api = conductor_rpcapi.ConductorAPI()
    objects.Service.enable_min_version_cache()
    server = service.Service.create(binary='nova-compute',
                                    topic=compute_rpcapi.RPC_TOPIC)
    service.serve(server)
    service.wait()
Пример #24
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, "nova")
    priv_context.init(root_helper=shlex.split(utils.get_root_helper()))
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    if not CONF.conductor.use_local:
        cmd_common.block_db_access("nova-compute")
        objects_base.NovaObject.indirection_api = conductor_rpcapi.ConductorAPI()
    else:
        LOG.warning(_LW("Conductor local mode is deprecated and will " "be removed in a subsequent release"))

    server = service.Service.create(
        binary="nova-compute", topic=CONF.compute_topic, db_allowed=CONF.conductor.use_local
    )
    service.serve(server)
    service.wait()
Пример #25
0
def main():
    config.parse_args(sys.argv)
    logging.setup(CONF, 'nova')
    priv_context.init(root_helper=shlex.split(utils.get_root_helper()))
    utils.monkey_patch()
    objects.register_all()

    gmr.TextGuruMeditation.setup_autorun(version)

    if not CONF.conductor.use_local:
        block_db_access()
        objects_base.NovaObject.indirection_api = \
            conductor_rpcapi.ConductorAPI()
    else:
        LOG.warning(_LW('Conductor local mode is deprecated and will '
                        'be removed in a subsequent release'))

    server = service.Service.create(binary='nova-compute',
                                    topic=CONF.compute_topic,
                                    db_allowed=CONF.conductor.use_local)
    service.serve(server)
    service.wait()
    def __init__(self, connection):
        super(LibvirtStorPoolVolumeDriver, self).__init__(connection,
                                                       is_block_dev=True)

        self.connector = connector.InitiatorConnector.factory(
            'STORPOOL', utils.get_root_helper())
Пример #27
0
 def __init__(self, host):
     super(LibvirtScaleIOVolumeDriver, self).__init__(host,
                                                      is_block_dev=False)
     self.connector = connector.InitiatorConnector.factory(
         initiator.SCALEIO, utils.get_root_helper(),
         device_scan_attempts=CONF.libvirt.num_volume_scan_tries)
Пример #28
0
 def test_use_rootwrap(self):
     self.flags(disable_rootwrap=False, group='workarounds')
     self.flags(rootwrap_config='foo')
     cmd = utils.get_root_helper()
     self.assertEqual('sudo nova-rootwrap foo', cmd)
Пример #29
0
 def test_use_sudo(self):
     self.flags(disable_rootwrap=True, group='workarounds')
     cmd = utils.get_root_helper()
     self.assertEqual('sudo', cmd)
Пример #30
0
 def __init__(self, host):
     super(LibvirtHGSTVolumeDriver,
           self).__init__(host, is_block_dev=True)
     self.connector = connector.InitiatorConnector.factory(
         'HGST', utils.get_root_helper(),
         device_scan_attempts=CONF.libvirt.num_volume_scan_tries)
Пример #31
0
 def test_use_rootwrap(self):
     self.flags(disable_rootwrap=False, group="workarounds")
     self.flags(rootwrap_config="foo")
     cmd = utils.get_root_helper()
     self.assertEqual("sudo nova-rootwrap foo", cmd)
Пример #32
0
    def __init__(self, host):
        super(LibvirtStorPoolVolumeDriver, self).__init__(host,
                                                          is_block_dev=True)

        self.connector = connector.InitiatorConnector.factory(
            'STORPOOL', utils.get_root_helper())
 def __init__(self, connection):
     super(LibvirtHyperScaleVolumeDriver, self).__init__(connection)
     self.connector = connector.InitiatorConnector.factory(
         'VERITAS_HYPERSCALE', utils.get_root_helper())
Пример #34
0
 def __init__(self, host):
     super(LibvirtDRBDVolumeDriver, self).__init__(host)
     self.connector = connector.InitiatorConnector.factory(
         connector.DRBD, utils.get_root_helper())
Пример #35
0
    def __init__(self, host):
        super(LibvirtStorPoolVolumeDriver, self).__init__(host)

        self.connector = connector.InitiatorConnector.factory(
            initiator.STORPOOL, utils.get_root_helper())
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)

Пример #37
0
    def __init__(self, host):
        super(LibvirtStorPoolVolumeDriver, self).__init__(host)

        self.connector = connector.InitiatorConnector.factory(
            initiator.STORPOOL, utils.get_root_helper())
Пример #38
0
 def __init__(self, host):
     super(LibvirtHGSTVolumeDriver, self).__init__(host, is_block_dev=True)
     self.connector = connector.InitiatorConnector.factory(
         'HGST',
         utils.get_root_helper(),
         device_scan_attempts=CONF.libvirt.num_volume_scan_tries)
Пример #39
0
 def __init__(self, connection):
     super(LibvirtOpenvStorageEdgeVolumeDriver, self).__init__(connection)
     self.connector = connector.InitiatorConnector.factory('OPENVSTORAGE_EDGE', utils.get_root_helper())
Пример #40
0
 def __init__(self, host):
     super(LibvirtDRBDVolumeDriver, self).__init__(host)
     self.connector = connector.InitiatorConnector.factory(
         initiator.DRBD, utils.get_root_helper())
Пример #41
0
 def test_use_rootwrap(self):
     self.flags(disable_rootwrap=False, group='workarounds')
     self.flags(rootwrap_config='foo')
     cmd = utils.get_root_helper()
     self.assertEqual('sudo nova-rootwrap foo', cmd)
Пример #42
0
 def test_use_sudo(self):
     self.flags(disable_rootwrap=True, group='workarounds')
     cmd = utils.get_root_helper()
     self.assertEqual('sudo', cmd)
Пример #43
0
 def __init__(self, connection):
     super(LibvirtScaleIOVolumeDriver, self).__init__(connection,
                                                      is_block_dev=False)
     self.connector = connector.InitiatorConnector.factory(
         'SCALEIO', utils.get_root_helper(),
         device_scan_attempts=CONF.libvirt.num_iscsi_scan_tries)
Пример #44
0
 def __init__(self, host):
     super(LibvirtNetVolumeDriver, self).__init__(host, is_block_dev=False)
     self.connector = None
     if CONF.workarounds.rbd_volume_local_attach:
         self.connector = connector.InitiatorConnector.factory(
             initiator.RBD, utils.get_root_helper(), do_local_attach=True)