diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index 5fbe5e18472e..81fbe91e409d 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -574,16 +574,16 @@ class LibvirtConnTestCase(test.NoDBTestCase): return FakeVirtDomain() # Creating mocks - volume_driver = ('iscsi=nova.tests.unit.virt.libvirt.test_driver' - '.FakeVolumeDriver') - self.flags(volume_drivers=[volume_driver], - group='libvirt') + volume_driver = ['iscsi=nova.tests.unit.virt.libvirt.test_driver' + '.FakeVolumeDriver'] fake = FakeLibvirtDriver() # Customizing above fake if necessary for key, val in kwargs.items(): fake.__setattr__(key, val) self.stubs.Set(libvirt_driver.LibvirtDriver, '_conn', fake) + self.stubs.Set(libvirt_driver.LibvirtDriver, '_get_volume_drivers', + lambda x: volume_driver) self.stubs.Set(host.Host, 'get_connection', lambda x: fake) def fake_lookup(self, instance_name): diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 3695620c97a9..1210cb2c9ce4 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -162,31 +162,6 @@ libvirt_opts = [ help='Snapshot image format (valid options are : ' 'raw, qcow2, vmdk, vdi). ' 'Defaults to same as source image'), - cfg.ListOpt('volume_drivers', - default=[ - 'iscsi=nova.virt.libvirt.volume.LibvirtISCSIVolumeDriver', - 'iser=nova.virt.libvirt.volume.LibvirtISERVolumeDriver', - 'local=nova.virt.libvirt.volume.LibvirtVolumeDriver', - 'fake=nova.virt.libvirt.volume.LibvirtFakeVolumeDriver', - 'rbd=nova.virt.libvirt.volume.LibvirtNetVolumeDriver', - 'sheepdog=nova.virt.libvirt.volume.LibvirtNetVolumeDriver', - 'nfs=nova.virt.libvirt.volume.LibvirtNFSVolumeDriver', - 'smbfs=nova.virt.libvirt.volume.LibvirtSMBFSVolumeDriver', - 'aoe=nova.virt.libvirt.volume.LibvirtAOEVolumeDriver', - 'glusterfs=' - 'nova.virt.libvirt.volume.LibvirtGlusterfsVolumeDriver', - 'fibre_channel=nova.virt.libvirt.volume.' - 'LibvirtFibreChannelVolumeDriver', - 'scality=' - 'nova.virt.libvirt.volume.LibvirtScalityVolumeDriver', - 'gpfs=' - 'nova.virt.libvirt.volume.LibvirtGPFSVolumeDriver', - 'quobyte=' - 'nova.virt.libvirt.volume.LibvirtQuobyteVolumeDriver', - ], - help='DEPRECATED. Libvirt handlers for remote volumes. ' - 'This option is deprecated and will be removed in the ' - 'Kilo release.'), cfg.StrOpt('disk_prefix', help='Override the default disk prefix for the devices attached' ' to a server, which is dependent on virt_type. ' @@ -295,6 +270,23 @@ CONSOLE = "console=tty0 console=ttyS0" GuestNumaConfig = collections.namedtuple( 'GuestNumaConfig', ['cpuset', 'cputune', 'numaconfig', 'numatune']) +libvirt_volume_drivers = [ + 'iscsi=nova.virt.libvirt.volume.LibvirtISCSIVolumeDriver', + 'iser=nova.virt.libvirt.volume.LibvirtISERVolumeDriver', + 'local=nova.virt.libvirt.volume.LibvirtVolumeDriver', + 'fake=nova.virt.libvirt.volume.LibvirtFakeVolumeDriver', + 'rbd=nova.virt.libvirt.volume.LibvirtNetVolumeDriver', + 'sheepdog=nova.virt.libvirt.volume.LibvirtNetVolumeDriver', + 'nfs=nova.virt.libvirt.volume.LibvirtNFSVolumeDriver', + 'smbfs=nova.virt.libvirt.volume.LibvirtSMBFSVolumeDriver', + 'aoe=nova.virt.libvirt.volume.LibvirtAOEVolumeDriver', + 'glusterfs=nova.virt.libvirt.volume.LibvirtGlusterfsVolumeDriver', + 'fibre_channel=nova.virt.libvirt.volume.LibvirtFibreChannelVolumeDriver', + 'scality=nova.virt.libvirt.volume.LibvirtScalityVolumeDriver', + 'gpfs=nova.virt.libvirt.volume.LibvirtGPFSVolumeDriver', + 'quobyte=nova.virt.libvirt.volume.LibvirtQuobyteVolumeDriver', +] + def patch_tpool_proxy(): """eventlet.tpool.Proxy doesn't work with old-style class in __str__() @@ -411,7 +403,7 @@ class LibvirtDriver(driver.ComputeDriver): self.vif_driver = libvirt_vif.LibvirtGenericVIFDriver() self.volume_drivers = driver.driver_dict_from_config( - CONF.libvirt.volume_drivers, self) + self._get_volume_drivers(), self) self._disk_cachemode = None self.image_cache_manager = imagecache.ImageCacheManager() @@ -467,6 +459,9 @@ class LibvirtDriver(driver.ComputeDriver): 'expect': ', '.join("'%s'" % k for k in sysinfo_serial_funcs.keys())}) + def _get_volume_drivers(self): + return libvirt_volume_drivers + @property def disk_cachemode(self): if self._disk_cachemode is None: