From 3bcaf68357d361100cb3ac35b3a5504627db8f0e Mon Sep 17 00:00:00 2001 From: jichenjc Date: Sun, 22 Mar 2015 23:23:04 +0800 Subject: [PATCH] libvirt: remove volume_drivers config param Copied commit message from commit I1f884f36e24fe478922671ca3eaf6b7c21fd8a5a The 'volumes_drivers' parameter does the same job as the 'vif_driver' parameter, but for volumes instead of vifs. The API for the LibvirtBaseVolumeDriver class is not considered to be a public extension point. As such it is not required or expected to remain compatible across releases. The main reason for its existance is for people who are developing new cinder drivers, to be able to write out of tree nova volume drivers. The recommended practice is to instead work in-tree to nova on a branch. This is an approach that would be required in order to submit the work for review and eventual merge in any case. commit I1f884f36e24fe478922671ca3eaf6b7c21fd8a5a deprecated it and during the discussion the actually target is Kilo. But it's K-3 so more reasonable target is Liberty. DocImpact: libvirt.volume_drivers config param is removed. Closes-Bug: #1371175 Change-Id: I832820499ec3304132379ad9b9d1ee92c5a75b61 --- nova/tests/unit/virt/libvirt/test_driver.py | 8 ++-- nova/virt/libvirt/driver.py | 47 +++++++++------------ 2 files changed, 25 insertions(+), 30 deletions(-) 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: