Example #1
0
    def test_driver_dict_from_config(self):
        drvs = driver.driver_dict_from_config([
            'key1=nova.tests.virt.test_driver.FakeDriver',
            'key2=nova.tests.virt.test_driver.FakeDriver2',
        ],
                                              'arg1',
                                              'arg2',
                                              param1='value1',
                                              param2='value2')

        self.assertEquals(sorted(['key1', 'key2']), sorted(drvs.keys()))

        self.assertDriverInstance(drvs['key1'],
                                  FakeDriver,
                                  'arg1',
                                  'arg2',
                                  param1='value1',
                                  param2='value2')

        self.assertDriverInstance(drvs['key2'],
                                  FakeDriver2,
                                  'arg1',
                                  'arg2',
                                  param1='value1',
                                  param2='value2')
Example #2
0
    def __init__(self, virtapi):
        super(HyperVDriver, self).__init__(virtapi)

        self._hostops = hostops.HostOps()
        self._volumeops = volumeops.VolumeOps()
        self._vmops = vmops.VMOps()
        self._snapshotops = snapshotops.SnapshotOps()
        self._livemigrationops = livemigrationops.LiveMigrationOps()
        self._migrationops = migrationops.MigrationOps()
        self.volume_drivers = driver.driver_dict_from_config(
            CONF.hyperv_volume_drivers)
Example #3
0
 def __init__(self, virtapi):
     super(DockerDriver, self).__init__(virtapi)
     self._docker = None
     vif_class = importutils.import_class(CONF.docker.vif_driver)
     self.vif_driver = vif_class()
     self._initiator = None
     self._fc_wwnns = None
     self._fc_wwpns = None
     self._volume_api = volume.API()
     self.volume_drivers = driver.driver_dict_from_config(
         self._get_volume_drivers(), self)
     self.firewall_driver = firewall.load_driver(
         default='nova.virt.firewall.NoopFirewallDriver')
     # NOTE(zhangguoqing): For passing the nova unit tests
     self.active_migrations = {}
Example #4
0
    def __init__(self, virtapi, read_only=False):
        super(PCSDriver, self).__init__(virtapi)
        LOG.info("__init__")

        self.host = None
        self._host_state = None
        self._initiator = None

        if CONF.firewall_driver != "nova.virt.firewall.NoopFirewallDriver":
            raise NotImplementedError(firewall_msg)
        self.vif_driver = PCSVIFDriver()
        self.image_cache_manager = imagecache.ImageCacheManager(self)
        self.image_cache = template.LZRWImageCache()
        self.volume_drivers = driver.driver_dict_from_config(
                                CONF.pcs_volume_drivers, self)
Example #5
0
    def test_driver_dict_from_config(self):
        drvs = driver.driver_dict_from_config(
            [
                'key1=nova.tests.unit.virt.test_driver.FakeDriver',
                'key2=nova.tests.unit.virt.test_driver.FakeDriver2',
            ], 'arg1', 'arg2', param1='value1', param2='value2'
        )

        self.assertEqual(
            sorted(['key1', 'key2']),
            sorted(drvs.keys())
        )

        self.assertDriverInstance(
            drvs['key1'],
            FakeDriver, 'arg1', 'arg2', param1='value1',
            param2='value2')

        self.assertDriverInstance(
            drvs['key2'],
            FakeDriver2, 'arg1', 'arg2', param1='value1',
            param2='value2')