]> xenbits.xensource.com Git - osstest/openstack-nova.git/commitdiff
libvirt: Pass Host instead of Driver to volume drivers
authorMatthew Booth <mbooth@redhat.com>
Tue, 1 Nov 2016 16:25:01 +0000 (16:25 +0000)
committerMatthew Booth <mbooth@redhat.com>
Tue, 1 Nov 2016 16:41:08 +0000 (16:41 +0000)
We were initialising libvirt volume drivers by passing the
LibvirtDriver object. However, this is only ever used to fetch the
Host. We update the interface to pass the Host instead. This is
cleaner, but also better represents the intent of the interface. They
should not be able to access arbitrary attributes of the LibvirtDriver
object.

Change-Id: I87ceeee1ec46dc22754321574b16e6c47b27a848

26 files changed:
nova/tests/unit/virt/libvirt/volume/test_aoe.py
nova/tests/unit/virt/libvirt/volume/test_disco.py
nova/tests/unit/virt/libvirt/volume/test_fibrechannel.py
nova/tests/unit/virt/libvirt/volume/test_glusterfs.py
nova/tests/unit/virt/libvirt/volume/test_gpfs.py
nova/tests/unit/virt/libvirt/volume/test_hgst.py
nova/tests/unit/virt/libvirt/volume/test_iscsi.py
nova/tests/unit/virt/libvirt/volume/test_iser.py
nova/tests/unit/virt/libvirt/volume/test_net.py
nova/tests/unit/virt/libvirt/volume/test_nfs.py
nova/tests/unit/virt/libvirt/volume/test_quobyte.py
nova/tests/unit/virt/libvirt/volume/test_scaleio.py
nova/tests/unit/virt/libvirt/volume/test_scality.py
nova/tests/unit/virt/libvirt/volume/test_smbfs.py
nova/tests/unit/virt/libvirt/volume/test_volume.py
nova/tests/unit/virt/libvirt/volume/test_vzstorage.py
nova/virt/libvirt/driver.py
nova/virt/libvirt/volume/aoe.py
nova/virt/libvirt/volume/disco.py
nova/virt/libvirt/volume/fibrechannel.py
nova/virt/libvirt/volume/fs.py
nova/virt/libvirt/volume/hgst.py
nova/virt/libvirt/volume/iscsi.py
nova/virt/libvirt/volume/net.py
nova/virt/libvirt/volume/scaleio.py
nova/virt/libvirt/volume/volume.py

index ca4a25e4749aec777f0a770318abbd79e9495a21..1f7386298d1642203f67207fa1a44669f26133ba 100644 (file)
@@ -21,6 +21,6 @@ class LibvirtAOEVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
 
     @mock.patch('os.path.exists', return_value=True)
     def test_libvirt_aoe_driver(self, exists):
-        libvirt_driver = aoe.LibvirtAOEVolumeDriver(self.fake_conn)
+        libvirt_driver = aoe.LibvirtAOEVolumeDriver(self.fake_host)
         self.assertIsInstance(libvirt_driver.connector,
                               connector.AoEConnector)
index f2348150952fa4f3e0225c19cdcb57fa2a811bfc..5b014074a9f8d2c3452c9258188456dbfafb0329 100644 (file)
@@ -25,12 +25,12 @@ class LibvirtDISCOVolumeDriverTestCase(
 
     def test_libvirt_disco_driver(self):
         libvirt_driver = disco.LibvirtDISCOVolumeDriver(
-            self.fake_conn)
+            self.fake_host)
         self.assertIsInstance(libvirt_driver.connector,
                               connector.DISCOConnector)
 
     def test_libvirt_disco_driver_connect(self):
-        dcon = disco.LibvirtDISCOVolumeDriver(self.fake_conn)
+        dcon = disco.LibvirtDISCOVolumeDriver(self.fake_host)
         conf = {'server_ip': '127.0.0.1', 'server_port': 9898}
         disk_info = {'disco_id': '1234567',
                      'name': 'aDiscoVolume',
@@ -44,7 +44,7 @@ class LibvirtDISCOVolumeDriverTestCase(
                              conn['data']['device_path'])
 
     def test_libvirt_disco_driver_get_config(self):
-        dcon = disco.LibvirtDISCOVolumeDriver(self.fake_conn)
+        dcon = disco.LibvirtDISCOVolumeDriver(self.fake_host)
 
         disk_info = {'path': '/dev/dms1234567', 'name': 'aDiscoVolume',
                      'type': 'raw', 'dev': 'vda1', 'bus': 'pci0',
@@ -56,7 +56,7 @@ class LibvirtDISCOVolumeDriverTestCase(
         self.assertEqual('disco', conf.source_protocol)
 
     def test_libvirt_disco_driver_disconnect(self):
-        dcon = disco.LibvirtDISCOVolumeDriver(self.fake_conn)
+        dcon = disco.LibvirtDISCOVolumeDriver(self.fake_host)
         dcon.connector.disconnect_volume = mock.MagicMock()
         disk_info = {'path': '/dev/dms1234567', 'name': 'aDiscoVolume',
                      'type': 'raw', 'dev': 'vda1', 'bus': 'pci0',
index a6dbf233a23f24be1116b8bbeeef3064b976e266..e5e86283b07e7e0af22d576b2116df59423efa87 100644 (file)
@@ -25,13 +25,13 @@ class LibvirtFibreChannelVolumeDriverTestCase(
 
     def test_libvirt_fibrechan_driver(self):
         libvirt_driver = fibrechannel.LibvirtFibreChannelVolumeDriver(
-                                                                self.fake_conn)
+                                                                self.fake_host)
         self.assertIsInstance(libvirt_driver.connector,
                               connector.FibreChannelConnector)
 
     def _test_libvirt_fibrechan_driver_s390(self):
         libvirt_driver = fibrechannel.LibvirtFibreChannelVolumeDriver(
-                                                                self.fake_conn)
+                                                                self.fake_host)
         self.assertIsInstance(libvirt_driver.connector,
                               connector.FibreChannelConnectorS390X)
 
@@ -45,7 +45,7 @@ class LibvirtFibreChannelVolumeDriverTestCase(
 
     def test_libvirt_fibrechan_driver_get_config(self):
         libvirt_driver = fibrechannel.LibvirtFibreChannelVolumeDriver(
-                                                                self.fake_conn)
+                                                                self.fake_host)
 
         device_path = '/dev/fake-dev'
         connection_info = {'data': {'device_path': device_path}}
index 4639b3ac844249d00779b05aa7053f59d55b95fc..cb08fa198cf503defe11338f60cbb46c82647c91 100644 (file)
@@ -29,7 +29,7 @@ class LibvirtGlusterfsVolumeDriverTestCase(
         mnt_base = '/mnt'
         self.flags(glusterfs_mount_point_base=mnt_base, group='libvirt')
 
-        libvirt_driver = glusterfs.LibvirtGlusterfsVolumeDriver(self.fake_conn)
+        libvirt_driver = glusterfs.LibvirtGlusterfsVolumeDriver(self.fake_host)
         export_string = '192.168.1.1:/volume-00001'
         export_mnt_base = os.path.join(mnt_base,
                 utils.get_hash_str(export_string))
@@ -53,7 +53,7 @@ class LibvirtGlusterfsVolumeDriverTestCase(
         mnt_base = '/mnt'
         self.flags(glusterfs_mount_point_base=mnt_base, group='libvirt')
 
-        libvirt_driver = glusterfs.LibvirtGlusterfsVolumeDriver(self.fake_conn)
+        libvirt_driver = glusterfs.LibvirtGlusterfsVolumeDriver(self.fake_host)
         export_string = '192.168.1.1:/volume-00001'
         export_mnt_base = os.path.join(mnt_base,
                                        utils.get_hash_str(export_string))
@@ -82,7 +82,7 @@ class LibvirtGlusterfsVolumeDriverTestCase(
         mnt_base = '/mnt'
         self.flags(glusterfs_mount_point_base=mnt_base, group='libvirt')
 
-        libvirt_driver = glusterfs.LibvirtGlusterfsVolumeDriver(self.fake_conn)
+        libvirt_driver = glusterfs.LibvirtGlusterfsVolumeDriver(self.fake_host)
         export_string = '192.168.1.1:/volume-00001'
         export_mnt_base = os.path.join(mnt_base,
                 utils.get_hash_str(export_string))
@@ -106,7 +106,7 @@ class LibvirtGlusterfsVolumeDriverTestCase(
         export_string = '192.168.1.1:/volume-00001'
         connection_info = {'data': {'export': export_string,
                                     'name': self.name}}
-        libvirt_driver = glusterfs.LibvirtGlusterfsVolumeDriver(self.fake_conn)
+        libvirt_driver = glusterfs.LibvirtGlusterfsVolumeDriver(self.fake_host)
         mock_utils_exe.side_effect = processutils.ProcessExecutionError(
             None, None, None, 'umount', 'umount: target is busy.')
         libvirt_driver.disconnect_volume(connection_info, "vde")
@@ -117,7 +117,7 @@ class LibvirtGlusterfsVolumeDriverTestCase(
         mnt_base = '/mnt'
         self.flags(glusterfs_mount_point_base=mnt_base, group='libvirt')
 
-        libvirt_driver = glusterfs.LibvirtGlusterfsVolumeDriver(self.fake_conn)
+        libvirt_driver = glusterfs.LibvirtGlusterfsVolumeDriver(self.fake_host)
         export_string = '192.168.1.1:/volume-00001'
         options = '-o backupvolfile-server=192.168.1.2'
         export_mnt_base = os.path.join(mnt_base,
@@ -142,7 +142,7 @@ class LibvirtGlusterfsVolumeDriverTestCase(
     @mock.patch.object(libvirt_utils, 'is_mounted', return_value=False)
     def test_libvirt_glusterfs_libgfapi(self, mock_is_mounted):
         self.flags(qemu_allowed_storage_drivers=['gluster'], group='libvirt')
-        libvirt_driver = glusterfs.LibvirtGlusterfsVolumeDriver(self.fake_conn)
+        libvirt_driver = glusterfs.LibvirtGlusterfsVolumeDriver(self.fake_host)
         export_string = '192.168.1.1:/volume-00001'
         name = 'volume-00001'
 
index 04d9c8cadc5a3c24c038cb44b75e64607da5357d..ffd41b7787798317ccf3c428374bee9df34c8903 100644 (file)
@@ -18,7 +18,7 @@ from nova.virt.libvirt.volume import gpfs
 class LibvirtGPFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
 
     def test_libvirt_gpfs_driver_get_config(self):
-        libvirt_driver = gpfs.LibvirtGPFSVolumeDriver(self.fake_conn)
+        libvirt_driver = gpfs.LibvirtGPFSVolumeDriver(self.fake_host)
         connection_info = {
             'driver_volume_type': 'gpfs',
             'data': {
index 06345a486d96d9f23134a787b90dc748874c5669..a7fef0c1a9ecc4ddcaf2481795df3d6d06319001 100644 (file)
@@ -27,14 +27,14 @@ from nova.virt.libvirt.volume import hgst
 
 class LibvirtHGSTVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
     def test_libvirt_hgst_driver_type(self):
-        drvr = hgst.LibvirtHGSTVolumeDriver(self.fake_conn)
+        drvr = hgst.LibvirtHGSTVolumeDriver(self.fake_host)
         self.assertIsInstance(drvr.connector, connector.HGSTConnector)
 
     def test_libvirt_hgst_driver_connect(self):
         def brick_conn_vol(data):
             return {'path': '/dev/space01'}
 
-        drvr = hgst.LibvirtHGSTVolumeDriver(self.fake_conn)
+        drvr = hgst.LibvirtHGSTVolumeDriver(self.fake_host)
         drvr.connector.connect_volume = brick_conn_vol
         di = {'path': '/dev/space01', 'name': 'space01'}
         ci = {'data': di}
@@ -43,7 +43,7 @@ class LibvirtHGSTVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
                          ci['data']['device_path'])
 
     def test_libvirt_hgst_driver_get_config(self):
-        drvr = hgst.LibvirtHGSTVolumeDriver(self.fake_conn)
+        drvr = hgst.LibvirtHGSTVolumeDriver(self.fake_host)
         di = {'path': '/dev/space01', 'name': 'space01', 'type': 'raw',
               'dev': 'vda1', 'bus': 'pci0', 'device_path': '/dev/space01'}
         ci = {'data': di}
@@ -52,7 +52,7 @@ class LibvirtHGSTVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
         self.assertEqual('/dev/space01', conf.source_path)
 
     def test_libvirt_hgst_driver_disconnect(self):
-        drvr = hgst.LibvirtHGSTVolumeDriver(self.fake_conn)
+        drvr = hgst.LibvirtHGSTVolumeDriver(self.fake_host)
         drvr.connector.disconnect_volume = mock.MagicMock()
         di = {'path': '/dev/space01', 'name': 'space01', 'type': 'raw',
               'dev': 'vda1', 'bus': 'pci0', 'device_path': '/dev/space01'}
index 78adbffcc919feb1962a6540c62f72ac71badf2f..6821ae1c17088b4634a29f54a6be1cbcccd3cb10 100644 (file)
@@ -47,12 +47,12 @@ Setting up iSCSI targets: unused
         self.assertEqual(targets, out)
 
     def test_libvirt_iscsi_driver(self, transport=None):
-        libvirt_driver = iscsi.LibvirtISCSIVolumeDriver(self.fake_conn)
+        libvirt_driver = iscsi.LibvirtISCSIVolumeDriver(self.fake_host)
         self.assertIsInstance(libvirt_driver.connector,
                               connector.ISCSIConnector)
 
     def test_libvirt_iscsi_driver_get_config(self):
-        libvirt_driver = iscsi.LibvirtISCSIVolumeDriver(self.fake_conn)
+        libvirt_driver = iscsi.LibvirtISCSIVolumeDriver(self.fake_host)
 
         device_path = '/dev/fake-dev'
         connection_info = {'data': {'device_path': device_path}}
@@ -71,7 +71,7 @@ Setting up iSCSI targets: unused
         device_path = '/dev/fake-dev'
         connection_info = {'data': {'device_path': device_path}}
 
-        libvirt_driver = iscsi.LibvirtISCSIVolumeDriver(self.fake_conn)
+        libvirt_driver = iscsi.LibvirtISCSIVolumeDriver(self.fake_host)
         libvirt_driver.connector.disconnect_volume = mock.MagicMock(
             side_effect=os_brick_exception.VolumeDeviceNotFound(
                 device=device_path))
index 6b240895e6f0bd85dc4b8af38729ea865442f899..8949b0ef082944c77e1ed7695e698e2d196023eb 100644 (file)
@@ -18,5 +18,5 @@ class LibvirtISERVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
     """Tests the libvirt iSER volume driver."""
 
     def test_get_transport(self):
-        driver = iser.LibvirtISERVolumeDriver(self.fake_conn)
+        driver = iser.LibvirtISERVolumeDriver(self.fake_host)
         self.assertEqual('iser', driver._get_transport())
index 456f3bba81e1dd7780c31a3bb72427f8420c609c..205b318e46f315b731e525645dfc34b43d407f4d 100644 (file)
@@ -45,7 +45,7 @@ class LibvirtNetVolumeDriverTestCase(
         }
 
     def test_libvirt_sheepdog_driver(self):
-        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_conn)
+        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host)
         connection_info = self.sheepdog_connection(self.vol)
         conf = libvirt_driver.get_config(connection_info, self.disk_info)
         tree = conf.format_dom()
@@ -71,7 +71,7 @@ class LibvirtNetVolumeDriverTestCase(
         }
 
     def test_libvirt_rbd_driver(self):
-        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_conn)
+        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host)
         connection_info = self.rbd_connection(self.vol)
         conf = libvirt_driver.get_config(connection_info, self.disk_info)
         tree = conf.format_dom()
@@ -82,7 +82,7 @@ class LibvirtNetVolumeDriverTestCase(
         libvirt_driver.disconnect_volume(connection_info, "vde")
 
     def test_libvirt_rbd_driver_hosts(self):
-        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_conn)
+        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host)
         connection_info = self.rbd_connection(self.vol)
         hosts = ['example.com', '1.2.3.4', '::1']
         ports = [None, '6790', '6791']
@@ -98,7 +98,7 @@ class LibvirtNetVolumeDriverTestCase(
         libvirt_driver.disconnect_volume(connection_info, "vde")
 
     def test_libvirt_rbd_driver_auth_enabled(self):
-        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_conn)
+        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host)
         connection_info = self.rbd_connection(self.vol)
         secret_type = 'ceph'
         connection_info['data']['auth_enabled'] = True
@@ -115,7 +115,7 @@ class LibvirtNetVolumeDriverTestCase(
         libvirt_driver.disconnect_volume(connection_info, "vde")
 
     def test_libvirt_rbd_driver_auth_enabled_flags_override(self):
-        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_conn)
+        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host)
         connection_info = self.rbd_connection(self.vol)
         secret_type = 'ceph'
         connection_info['data']['auth_enabled'] = True
@@ -138,7 +138,7 @@ class LibvirtNetVolumeDriverTestCase(
         libvirt_driver.disconnect_volume(connection_info, "vde")
 
     def test_libvirt_rbd_driver_auth_disabled(self):
-        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_conn)
+        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host)
         connection_info = self.rbd_connection(self.vol)
         secret_type = 'ceph'
         connection_info['data']['auth_enabled'] = False
@@ -153,7 +153,7 @@ class LibvirtNetVolumeDriverTestCase(
         libvirt_driver.disconnect_volume(connection_info, "vde")
 
     def test_libvirt_rbd_driver_auth_disabled_flags_override(self):
-        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_conn)
+        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host)
         connection_info = self.rbd_connection(self.vol)
         secret_type = 'ceph'
         connection_info['data']['auth_enabled'] = False
@@ -184,7 +184,7 @@ class LibvirtNetVolumeDriverTestCase(
                                       mock_find):
         mock_find.return_value = test_volume.FakeSecret()
         mock_create.return_value = test_volume.FakeSecret()
-        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_conn)
+        libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host)
         connection_info = self.iscsi_connection(self.vol, self.location,
                                                 self.iqn, auth=True)
         secret_type = 'iscsi'
index 51a4775ef4df6ef9d837f9f3d094e98083370d76..cdd0b2499fd1fcd5ba0030f3f8312b2e5e8a7c73 100644 (file)
@@ -31,7 +31,7 @@ class LibvirtNFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
 
     @mock.patch.object(libvirt_utils, 'is_mounted', return_value=False)
     def test_libvirt_nfs_driver(self, mock_is_mounted):
-        libvirt_driver = nfs.LibvirtNFSVolumeDriver(self.fake_conn)
+        libvirt_driver = nfs.LibvirtNFSVolumeDriver(self.fake_host)
 
         export_string = '192.168.1.1:/nfs/share1'
         export_mnt_base = os.path.join(self.mnt_base,
@@ -60,7 +60,7 @@ class LibvirtNFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
         export_string = '192.168.1.1:/nfs/share1'
         connection_info = {'data': {'export': export_string,
                                     'name': self.name}}
-        libvirt_driver = nfs.LibvirtNFSVolumeDriver(self.fake_conn)
+        libvirt_driver = nfs.LibvirtNFSVolumeDriver(self.fake_host)
         mock_utils_exe.side_effect = processutils.ProcessExecutionError(
             None, None, None, 'umount', 'umount: device is busy.')
         libvirt_driver.disconnect_volume(connection_info, "vde")
@@ -79,7 +79,7 @@ class LibvirtNFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
         self.assertTrue(mock_LOG_exception.called)
 
     def test_libvirt_nfs_driver_get_config(self):
-        libvirt_driver = nfs.LibvirtNFSVolumeDriver(self.fake_conn)
+        libvirt_driver = nfs.LibvirtNFSVolumeDriver(self.fake_host)
         export_string = '192.168.1.1:/nfs/share1'
         export_mnt_base = os.path.join(self.mnt_base,
                                        utils.get_hash_str(export_string))
@@ -95,7 +95,7 @@ class LibvirtNFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
         self.assertEqual('native', tree.find('./driver').get('io'))
 
     def test_libvirt_nfs_driver_already_mounted(self):
-        libvirt_driver = nfs.LibvirtNFSVolumeDriver(self.fake_conn)
+        libvirt_driver = nfs.LibvirtNFSVolumeDriver(self.fake_host)
 
         export_string = '192.168.1.1:/nfs/share1'
         export_mnt_base = os.path.join(self.mnt_base,
@@ -114,7 +114,7 @@ class LibvirtNFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
 
     @mock.patch.object(libvirt_utils, 'is_mounted', return_value=False)
     def test_libvirt_nfs_driver_with_opts(self, mock_is_mounted):
-        libvirt_driver = nfs.LibvirtNFSVolumeDriver(self.fake_conn)
+        libvirt_driver = nfs.LibvirtNFSVolumeDriver(self.fake_host)
         export_string = '192.168.1.1:/nfs/share1'
         options = '-o intr,nfsvers=3'
         export_mnt_base = os.path.join(self.mnt_base,
index 5656005955781ca458bdf5535c1dd06f684a6369..64afee55644fcc062bfb6f6d8d3411a9581d5711 100644 (file)
@@ -201,7 +201,7 @@ class LibvirtQuobyteVolumeDriverTestCase(
         mnt_base = '/mnt'
         self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')
 
-        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)
+        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_host)
         export_string = 'quobyte://192.168.1.1/volume-00001'
         quobyte_volume = '192.168.1.1/volume-00001'
         export_mnt_base = os.path.join(mnt_base,
@@ -231,7 +231,7 @@ class LibvirtQuobyteVolumeDriverTestCase(
         mnt_base = '/mnt'
         self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')
 
-        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)
+        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_host)
         export_string = 'quobyte://192.168.1.1/volume-00001'
         quobyte_volume = '192.168.1.1/volume-00001'
         export_mnt_base = os.path.join(mnt_base,
@@ -260,7 +260,7 @@ class LibvirtQuobyteVolumeDriverTestCase(
         mnt_base = '/mnt'
         self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')
 
-        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)
+        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_host)
         export_string = 'quobyte://192.168.1.1/volume-00001'
         quobyte_volume = '192.168.1.1/volume-00001'
         export_mnt_base = os.path.join(mnt_base,
@@ -297,7 +297,7 @@ class LibvirtQuobyteVolumeDriverTestCase(
                                           ):
         mnt_base = '/mnt'
         self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')
-        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)
+        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_host)
         export_string = 'quobyte://192.168.1.1/volume-00001'
         name = 'volume-00001'
         image_format = 'qcow2'
@@ -328,7 +328,7 @@ class LibvirtQuobyteVolumeDriverTestCase(
         mnt_base = '/mnt'
         self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')
 
-        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)
+        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_host)
         export_string = 'quobyte://192.168.1.1/volume-00001'
 
         connection_info = {'data': {'export': export_string,
@@ -350,7 +350,7 @@ class LibvirtQuobyteVolumeDriverTestCase(
         mnt_base = '/mnt'
         self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')
 
-        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)
+        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_host)
         export_string = 'quobyte://192.168.1.1/volume-00001'
         self.assertEqual("192.168.1.1/volume-00001",
                          libvirt_driver._normalize_export(export_string))
@@ -359,7 +359,7 @@ class LibvirtQuobyteVolumeDriverTestCase(
         mnt_base = '/mnt'
         self.flags(quobyte_mount_point_base=mnt_base, group='libvirt')
 
-        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_conn)
+        libvirt_driver = quobyte.LibvirtQuobyteVolumeDriver(self.fake_host)
         export_string = '192.168.1.1/volume-00001'
         self.assertEqual("192.168.1.1/volume-00001",
                          libvirt_driver._normalize_export(export_string))
index b2ef496a75090599b84b07048c01a864d61a5871..b740a0a8cfeaf81949166468b098e94eea059a36 100644 (file)
@@ -26,7 +26,7 @@ class LibvirtScaleIOVolumeDriverTestCase(
 
     def test_libvirt_scaleio_driver(self):
         libvirt_driver = scaleio.LibvirtScaleIOVolumeDriver(
-            self.fake_conn)
+            self.fake_host)
         self.assertIsInstance(libvirt_driver.connector,
                               connector.ScaleIOConnector)
 
@@ -34,7 +34,7 @@ class LibvirtScaleIOVolumeDriverTestCase(
         def brick_conn_vol(data):
             return {'path': '/dev/vol01'}
 
-        sio = scaleio.LibvirtScaleIOVolumeDriver(self.fake_conn)
+        sio = scaleio.LibvirtScaleIOVolumeDriver(self.fake_host)
         sio.connector.connect_volume = brick_conn_vol
         disk_info = {'path': '/dev/vol01', 'name': 'vol01'}
         conn = {'data': disk_info}
@@ -43,7 +43,7 @@ class LibvirtScaleIOVolumeDriverTestCase(
                          conn['data']['device_path'])
 
     def test_libvirt_scaleio_driver_get_config(self):
-        sio = scaleio.LibvirtScaleIOVolumeDriver(self.fake_conn)
+        sio = scaleio.LibvirtScaleIOVolumeDriver(self.fake_host)
         disk_info = {'path': '/dev/vol01', 'name': 'vol01', 'type': 'raw',
                      'dev': 'vda1', 'bus': 'pci0', 'device_path': '/dev/vol01'}
         conn = {'data': disk_info}
@@ -52,7 +52,7 @@ class LibvirtScaleIOVolumeDriverTestCase(
         self.assertEqual('/dev/vol01', conf.source_path)
 
     def test_libvirt_scaleio_driver_disconnect(self):
-        sio = scaleio.LibvirtScaleIOVolumeDriver(self.fake_conn)
+        sio = scaleio.LibvirtScaleIOVolumeDriver(self.fake_host)
         sio.connector.disconnect_volume = mock.MagicMock()
         disk_info = {'path': '/dev/vol01', 'name': 'vol01', 'type': 'raw',
                     'dev': 'vda1', 'bus': 'pci0', 'device_path': '/dev/vol01'}
index 2957ac2d30ab2a54ac553dfa58f77e8eae7191ad..09838afc05db50f68b2bb2764a6344d91abdf18a 100644 (file)
@@ -31,7 +31,7 @@ class LibvirtScalityVolumeDriverTestCase(
                    scality_sofs_mount_point=self.scality_sofs_mount_point,
                    group='libvirt')
 
-        self.drv = scality.LibvirtScalityVolumeDriver(self.fake_conn)
+        self.drv = scality.LibvirtScalityVolumeDriver(self.fake_host)
 
     @mock.patch('six.moves.urllib.request.urlopen')
     def test_connect_volume(self, mock_urlopen):
index d66be692dfa6a54bbc5c5438278879ba7d8500b1..9e9250cc6a03d85db185cafff3392c067de0cbea 100644 (file)
@@ -32,7 +32,7 @@ class LibvirtSMBFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
     def test_libvirt_smbfs_driver(self, mock_is_mounted):
         mock_is_mounted.return_value = False
 
-        libvirt_driver = smbfs.LibvirtSMBFSVolumeDriver(self.fake_conn)
+        libvirt_driver = smbfs.LibvirtSMBFSVolumeDriver(self.fake_host)
         export_string = '//192.168.1.1/volumes'
         export_mnt_base = os.path.join(self.mnt_base,
                                        utils.get_hash_str(export_string))
@@ -50,7 +50,7 @@ class LibvirtSMBFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
         self.assertEqual(expected_commands, self.executes)
 
     def test_libvirt_smbfs_driver_already_mounted(self):
-        libvirt_driver = smbfs.LibvirtSMBFSVolumeDriver(self.fake_conn)
+        libvirt_driver = smbfs.LibvirtSMBFSVolumeDriver(self.fake_host)
         export_string = '//192.168.1.1/volumes'
         export_mnt_base = os.path.join(self.mnt_base,
                                        utils.get_hash_str(export_string))
@@ -67,7 +67,7 @@ class LibvirtSMBFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
         self.assertEqual(expected_commands, self.executes)
 
     def test_libvirt_smbfs_driver_get_config(self):
-        libvirt_driver = smbfs.LibvirtSMBFSVolumeDriver(self.fake_conn)
+        libvirt_driver = smbfs.LibvirtSMBFSVolumeDriver(self.fake_host)
         export_string = '//192.168.1.1/volumes'
         export_mnt_base = os.path.join(self.mnt_base,
                                        utils.get_hash_str(export_string))
@@ -84,7 +84,7 @@ class LibvirtSMBFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
     def test_libvirt_smbfs_driver_with_opts(self, mock_is_mounted):
         mock_is_mounted.return_value = False
 
-        libvirt_driver = smbfs.LibvirtSMBFSVolumeDriver(self.fake_conn)
+        libvirt_driver = smbfs.LibvirtSMBFSVolumeDriver(self.fake_host)
         export_string = '//192.168.1.1/volumes'
         options = '-o user=guest,uid=107,gid=105'
         export_mnt_base = os.path.join(self.mnt_base,
index 767702b54055d414b81677f8ddd8d633e098cc10..ef455c8dbcef81c0b60ef02caee7ee0b7742a69c 100644 (file)
@@ -62,14 +62,8 @@ class LibvirtVolumeBaseTestCase(test.NoDBTestCase):
 
         self.useFixture(fakelibvirt.FakeLibvirtFixture())
 
-        class FakeLibvirtDriver(object):
-            def __init__(self):
-                self._host = host.Host("qemu:///system")
+        self.fake_host = host.Host("qemu:///system")
 
-            def _get_all_block_devices(self):
-                return []
-
-        self.fake_conn = FakeLibvirtDriver()
         self.connr = {
             'ip': '127.0.0.1',
             'initiator': 'fake_initiator',
@@ -130,7 +124,7 @@ class LibvirtVolumeTestCase(LibvirtISCSIVolumeBaseTestCase):
         self.assertEqual(disk_info['dev'], tree.find('./target').get('dev'))
 
     def _test_libvirt_volume_driver_disk_info(self):
-        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_conn)
+        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_host)
         connection_info = {
             'driver_volume_type': 'fake',
             'data': {
@@ -155,7 +149,7 @@ class LibvirtVolumeTestCase(LibvirtISCSIVolumeBaseTestCase):
         self._test_libvirt_volume_driver_disk_info()
 
     def test_libvirt_volume_driver_serial(self):
-        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_conn)
+        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_host)
         connection_info = {
             'driver_volume_type': 'fake',
             'data': {
@@ -171,7 +165,7 @@ class LibvirtVolumeTestCase(LibvirtISCSIVolumeBaseTestCase):
         self.assertIsNone(tree.find("driver[@discard]"))
 
     def test_libvirt_volume_driver_blockio(self):
-        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_conn)
+        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_host)
         connection_info = {
             'driver_volume_type': 'fake',
             'data': {
@@ -193,7 +187,7 @@ class LibvirtVolumeTestCase(LibvirtISCSIVolumeBaseTestCase):
         self.assertEqual('4096', blockio.get('physical_block_size'))
 
     def test_libvirt_volume_driver_iotune(self):
-        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_conn)
+        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_host)
         connection_info = {
             'driver_volume_type': 'fake',
             'data': {
@@ -232,7 +226,7 @@ class LibvirtVolumeTestCase(LibvirtISCSIVolumeBaseTestCase):
         self.assertEqual('200', tree.find('./iotune/write_iops_sec').text)
 
     def test_libvirt_volume_driver_readonly(self):
-        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_conn)
+        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_host)
         connection_info = {
             'driver_volume_type': 'fake',
             'data': {
@@ -265,7 +259,7 @@ class LibvirtVolumeTestCase(LibvirtISCSIVolumeBaseTestCase):
     def test_libvirt_volume_driver_discard_true(self, mock_has_min_version):
         # Check the discard attrib is present in driver section
         mock_has_min_version.return_value = True
-        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_conn)
+        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_host)
         connection_info = {
             'driver_volume_type': 'fake',
             'data': {
@@ -283,7 +277,7 @@ class LibvirtVolumeTestCase(LibvirtISCSIVolumeBaseTestCase):
 
     def test_libvirt_volume_driver_discard_false(self):
         # Check the discard attrib is not present in driver section
-        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_conn)
+        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_host)
         connection_info = {
             'driver_volume_type': 'fake',
             'data': {
@@ -302,7 +296,7 @@ class LibvirtVolumeTestCase(LibvirtISCSIVolumeBaseTestCase):
             self, mock_has_min_version):
         # Check the discard attrib is not present in driver section
         mock_has_min_version.return_value = False
-        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_conn)
+        libvirt_driver = volume.LibvirtVolumeDriver(self.fake_host)
         connection_info = {
             'driver_volume_type': 'fake',
             'data': {
index f6faacd6ffd15f52e80c005a00a116b494573d70..ab3752bcdf032284702971087c3a17d377485853 100644 (file)
@@ -31,7 +31,7 @@ class LibvirtVZStorageTestCase(test_volume.LibvirtVolumeBaseTestCase):
                    group='libvirt')
 
     def test_libvirt_vzstorage_driver(self):
-        libvirt_driver = vzstorage.LibvirtVZStorageVolumeDriver(self.fake_conn)
+        libvirt_driver = vzstorage.LibvirtVZStorageVolumeDriver(self.fake_host)
         self.assertIsInstance(libvirt_driver.connector,
                               connector.RemoteFsConnector)
 
@@ -47,11 +47,11 @@ class LibvirtVZStorageTestCase(test_volume.LibvirtVolumeBaseTestCase):
             self.flags(vzstorage_mount_opts=opts, group='libvirt')
             self.assertRaises(exception.NovaException,
                               vzstorage.LibvirtVZStorageVolumeDriver,
-                              self.fake_conn)
+                              self.fake_host)
 
     def test_libvirt_vzstorage_driver_share_fmt_neg(self):
 
-        drv = vzstorage.LibvirtVZStorageVolumeDriver(self.fake_conn)
+        drv = vzstorage.LibvirtVZStorageVolumeDriver(self.fake_host)
 
         wrong_export_string = 'mds1, mds2:/testcluster:passwd12111'
         connection_info = {'data': {'export': wrong_export_string,
@@ -69,7 +69,7 @@ class LibvirtVZStorageTestCase(test_volume.LibvirtVolumeBaseTestCase):
         def brick_conn_vol(data):
             return {'path': 'vstorage://testcluster'}
 
-        drv = vzstorage.LibvirtVZStorageVolumeDriver(self.fake_conn)
+        drv = vzstorage.LibvirtVZStorageVolumeDriver(self.fake_host)
         drv.connector.connect_volume = brick_conn_vol
 
         export_string = 'testcluster'
@@ -85,7 +85,7 @@ class LibvirtVZStorageTestCase(test_volume.LibvirtVolumeBaseTestCase):
                           connection_info['data']['options'])
 
     def test_libvirt_vzstorage_driver_disconnect(self):
-        drv = vzstorage.LibvirtVZStorageVolumeDriver(self.fake_conn)
+        drv = vzstorage.LibvirtVZStorageVolumeDriver(self.fake_host)
         drv.connector.disconnect_volume = mock.MagicMock()
         conn = {'data': self.disk_info}
         drv.disconnect_volume(conn, self.disk_info)
@@ -93,7 +93,7 @@ class LibvirtVZStorageTestCase(test_volume.LibvirtVolumeBaseTestCase):
             self.disk_info, None)
 
     def test_libvirt_vzstorage_driver_get_config(self):
-        libvirt_driver = vzstorage.LibvirtVZStorageVolumeDriver(self.fake_conn)
+        libvirt_driver = vzstorage.LibvirtVZStorageVolumeDriver(self.fake_host)
         export_string = 'vzstorage'
         export_mnt_base = os.path.join(self.mnt_base,
                                        utils.get_hash_str(export_string))
index 10bc929a52d6c8d67af6fe431105a7125790b0e0..8ef19100d06e693ef3a89cfe38a9dbf453178d56 100644 (file)
@@ -353,7 +353,7 @@ class LibvirtDriver(driver.ComputeDriver):
         self.vif_driver = libvirt_vif.LibvirtGenericVIFDriver()
 
         self.volume_drivers = driver.driver_dict_from_config(
-            self._get_volume_drivers(), self)
+            self._get_volume_drivers(), self._host)
 
         self._disk_cachemode = None
         self.image_cache_manager = imagecache.ImageCacheManager()
index e910f9a02ebaac3831e12f7af6303ffd71c7c9a3..b88a63aa9d17f5a8a0705d4e9aff7a73ac8f7a48 100644 (file)
@@ -24,9 +24,9 @@ CONF = nova.conf.CONF
 
 class LibvirtAOEVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
     """Driver to attach AoE volumes to libvirt."""
-    def __init__(self, connection):
+    def __init__(self, host):
         super(LibvirtAOEVolumeDriver,
-              self).__init__(connection, is_block_dev=True)
+              self).__init__(host, is_block_dev=True)
 
         # Call the factory here so we can support
         # more than x86 architectures.
index e165e4eb1ff7cb831bb124b6afb4951f21daa155..3af2750e82256e2edca4e9fcf00c7530889dab97 100644 (file)
@@ -31,9 +31,9 @@ class LibvirtDISCOVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
     Uses the DISCO connector from the os-brick projects.
     """
 
-    def __init__(self, connection):
+    def __init__(self, host):
         """Init DISCO connector for LibVirt."""
-        super(LibvirtDISCOVolumeDriver, self).__init__(connection,
+        super(LibvirtDISCOVolumeDriver, self).__init__(host,
                                                        is_block_dev=False)
         self.connector = connector.InitiatorConnector.factory(
             'DISCO', utils.get_root_helper(),
index 376ffb2adff48603dedc30326bd00d6aaf6515a8..a84e7d47575f4c6485782a56f06dcab8c87244bb 100644 (file)
@@ -25,9 +25,9 @@ LOG = logging.getLogger(__name__)
 class LibvirtFibreChannelVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
     """Driver to attach Fibre Channel Network volumes to libvirt."""
 
-    def __init__(self, connection):
+    def __init__(self, host):
         super(LibvirtFibreChannelVolumeDriver,
-              self).__init__(connection, is_block_dev=False)
+              self).__init__(host, is_block_dev=False)
 
         # Call the factory here so we can support
         # more than x86 architectures.
index 55cfc8c0f0678a4b53f82b2607ae2bdc9e180bdf..df84f068a16cd79a18665912b5e66022a71869c8 100644 (file)
@@ -26,9 +26,9 @@ class LibvirtBaseFileSystemVolumeDriver(
     libvirt_volume.LibvirtBaseVolumeDriver):
     """The base class for file system type volume drivers"""
 
-    def __init__(self, connection):
+    def __init__(self, host):
         super(LibvirtBaseFileSystemVolumeDriver,
-              self).__init__(connection, is_block_dev=False)
+              self).__init__(host, is_block_dev=False)
 
     @abc.abstractmethod
     def _get_mount_point_base(self):
index b446fae6817236c55dc31236b64cc2a40d22701b..e5df5bea01d434d76900c272684d2a44beb14bbf 100644 (file)
@@ -25,9 +25,9 @@ CONF = nova.conf.CONF
 
 class LibvirtHGSTVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
     """Driver to attach HGST volumes to libvirt."""
-    def __init__(self, connection):
+    def __init__(self, host):
         super(LibvirtHGSTVolumeDriver,
-              self).__init__(connection, is_block_dev=True)
+              self).__init__(host, is_block_dev=True)
         self.connector = connector.InitiatorConnector.factory(
             'HGST', utils.get_root_helper(),
             device_scan_attempts=CONF.libvirt.num_iscsi_scan_tries)
index 18d66ee394710dcf03ec080f8feef0dde8348320..1bd9a3c825130eba76f282d9898ad5b76f12f997 100644 (file)
@@ -28,8 +28,8 @@ CONF = nova.conf.CONF
 class LibvirtISCSIVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
     """Driver to attach Network volumes to libvirt."""
 
-    def __init__(self, connection):
-        super(LibvirtISCSIVolumeDriver, self).__init__(connection,
+    def __init__(self, host):
+        super(LibvirtISCSIVolumeDriver, self).__init__(host,
                                                        is_block_dev=True)
 
         # Call the factory here so we can support
index a8e698137dfc9fc5b77162d9777998a662c8ba73..d6ded9782276ca4571d8d3a05ceea2b01ac48a05 100644 (file)
@@ -22,19 +22,19 @@ CONF = nova.conf.CONF
 
 class LibvirtNetVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
     """Driver to attach Network volumes to libvirt."""
-    def __init__(self, connection):
+    def __init__(self, host):
         super(LibvirtNetVolumeDriver,
-              self).__init__(connection, is_block_dev=False)
+              self).__init__(host, is_block_dev=False)
 
     def _get_secret_uuid(self, conf, password=None):
         # TODO(mriedem): Add delegation methods to connection (LibvirtDriver)
         # to call through for these secret CRUD operations so the volume driver
         # doesn't need to know the internal attributes of the connection
         # object.
-        secret = self.connection._host.find_secret(conf.source_protocol,
+        secret = self.host.find_secret(conf.source_protocol,
                                                    conf.source_name)
         if secret is None:
-            secret = self.connection._host.create_secret(conf.source_protocol,
+            secret = self.host.create_secret(conf.source_protocol,
                                                          conf.source_name,
                                                          password)
         return secret.UUIDString()
@@ -48,7 +48,7 @@ class LibvirtNetVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
             usage_type = 'iscsi'
             usage_name = ("%(target_iqn)s/%(target_lun)s" %
                           netdisk_properties)
-            self.connection._host.delete_secret(usage_type, usage_name)
+            self.host.delete_secret(usage_type, usage_name)
 
     def get_config(self, connection_info, disk_info):
         """Returns xml for libvirt."""
index 5f2ea218a7adb711f4265da3c689c3bffc637d9d..b97152eb050728f98e196b94592ed5b417a20d7c 100644 (file)
@@ -33,8 +33,8 @@ class LibvirtScaleIOVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
     Implements Libvirt part of volume driver for ScaleIO cinder driver.
     Uses the ScaleIO connector from the os-brick projects
     """
-    def __init__(self, connection):
-        super(LibvirtScaleIOVolumeDriver, self).__init__(connection,
+    def __init__(self, host):
+        super(LibvirtScaleIOVolumeDriver, self).__init__(host,
                                                          is_block_dev=False)
         self.connector = connector.InitiatorConnector.factory(
             'SCALEIO', utils.get_root_helper(),
index 2efc0f5e06f34ad3116b6fa8d03d93de2a588e98..fff56c7931acc6b9bcf920902dcd3076268a903d 100644 (file)
@@ -37,15 +37,15 @@ SHOULD_LOG_DISCARD_WARNING = True
 
 class LibvirtBaseVolumeDriver(object):
     """Base class for volume drivers."""
-    def __init__(self, connection, is_block_dev):
-        self.connection = connection
+    def __init__(self, host, is_block_dev):
+        self.host = host
         self.is_block_dev = is_block_dev
 
     def get_config(self, connection_info, disk_info):
         """Returns xml for libvirt."""
         conf = vconfig.LibvirtConfigGuestDisk()
         conf.driver_name = libvirt_utils.pick_disk_driver_name(
-            self.connection._host.get_version(),
+            self.host.get_version(),
             self.is_block_dev
         )
 
@@ -95,7 +95,7 @@ class LibvirtBaseVolumeDriver(object):
         # Configure usage of discard
         if data.get('discard', False) is True:
             min_qemu = nova.virt.libvirt.driver.MIN_QEMU_DISCARD_VERSION
-            if self.connection._host.has_min_version(
+            if self.host.has_min_version(
                     hv_ver=min_qemu,
                     hv_type=host.HV_DRIVER_QEMU):
                 conf.driver_discard = 'unmap'
@@ -125,9 +125,9 @@ class LibvirtBaseVolumeDriver(object):
 
 class LibvirtVolumeDriver(LibvirtBaseVolumeDriver):
     """Class for volumes backed by local file."""
-    def __init__(self, connection):
+    def __init__(self, host):
         super(LibvirtVolumeDriver,
-              self).__init__(connection, is_block_dev=True)
+              self).__init__(host, is_block_dev=True)
 
     def get_config(self, connection_info, disk_info):
         """Returns xml for libvirt."""
@@ -140,9 +140,9 @@ class LibvirtVolumeDriver(LibvirtBaseVolumeDriver):
 
 class LibvirtFakeVolumeDriver(LibvirtBaseVolumeDriver):
     """Driver to attach fake volumes to libvirt."""
-    def __init__(self, connection):
+    def __init__(self, host):
         super(LibvirtFakeVolumeDriver,
-              self).__init__(connection, is_block_dev=True)
+              self).__init__(host, is_block_dev=True)
 
     def get_config(self, connection_info, disk_info):
         """Returns xml for libvirt."""