diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index 7eeba8b6d35b..a5fbdefb4dab 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -6266,7 +6266,7 @@ class LibvirtConnTestCase(test.NoDBTestCase): test.MatchType(objects.ImageMeta), bdm) mock_connect_volume.assert_called_with( - connection_info, disk_info) + connection_info, disk_info, instance) mock_get_volume_config.assert_called_with( connection_info, disk_info) mock_set_cache_mode.assert_called_with(mock_conf) @@ -6320,7 +6320,7 @@ class LibvirtConnTestCase(test.NoDBTestCase): """, flags=flags) mock_disconnect_volume.assert_called_with( - connection_info, 'vdc') + connection_info, 'vdc', instance) @mock.patch('nova.virt.libvirt.host.Host.get_domain') def test_detach_volume_disk_not_found(self, mock_get_domain): @@ -6376,7 +6376,7 @@ class LibvirtConnTestCase(test.NoDBTestCase): mock_order.assert_has_calls([ mock.call.detach_volume(), mock.call.detach_encryptor(**encryption), - mock.call.disconnect_volume(connection_info, 'vdc')]) + mock.call.disconnect_volume(connection_info, 'vdc', instance)]) def test_multi_nic(self): network_info = _fake_network_info(self, 2) @@ -9551,8 +9551,7 @@ class LibvirtConnTestCase(test.NoDBTestCase): 'dev': v['mount_device'].rpartition("/")[2], 'type': "disk" } - drvr._connect_volume(v['connection_info'], - disk_info) + drvr._connect_volume(v['connection_info'], disk_info, instance) self.mox.StubOutWithMock(drvr, 'plug_vifs') drvr.plug_vifs(mox.IsA(instance), nw_info) @@ -9689,8 +9688,8 @@ class LibvirtConnTestCase(test.NoDBTestCase): 'dev': v['mount_device'].rpartition("/")[2], 'type': "disk" } - drvr._connect_volume(v['connection_info'], - disk_info) + drvr._connect_volume(v['connection_info'], disk_info, + inst_ref) self.mox.StubOutWithMock(drvr, 'plug_vifs') drvr.plug_vifs(mox.IsA(inst_ref), nw_info) self.mox.ReplayAll() @@ -10037,8 +10036,9 @@ class LibvirtConnTestCase(test.NoDBTestCase): get_volume_connector.assert_has_calls([ mock.call(inst_ref)]) _disconnect_volume.assert_has_calls([ - mock.call({'data': {'multipath_id': 'dummy1'}}, 'sda'), - mock.call({'data': {}}, 'sdb')]) + mock.call({'data': {'multipath_id': 'dummy1'}}, 'sda', + inst_ref), + mock.call({'data': {}}, 'sdb', inst_ref)]) def test_get_instance_disk_info_excludes_volumes(self): # Test data @@ -10396,7 +10396,7 @@ class LibvirtConnTestCase(test.NoDBTestCase): 'delete_on_termination': False } - def _connect_volume_side_effect(connection_info, disk_info): + def _connect_volume_side_effect(connection_info, disk_info, instance): bdm['connection_info']['data']['device_path'] = '/dev/path/to/dev' def _get(key, opt=None): @@ -14066,7 +14066,7 @@ class LibvirtConnTestCase(test.NoDBTestCase): drvr.detach_volume(connection_info, instance, '/dev/sda') _get_domain.assert_called_once_with(instance) _disconnect_volume.assert_called_once_with(connection_info, - 'sda') + 'sda', instance) def _test_attach_detach_interface_get_config(self, method_name): """Tests that the get_config() method is properly called in @@ -14614,7 +14614,7 @@ class LibvirtConnTestCase(test.NoDBTestCase): self.assertEqual('/dev/vdb', instance.default_ephemeral_device) self.assertIsNone(instance.default_swap_device) connect_volume.assert_called_with(bdm['connection_info'], - {'bus': 'virtio', 'type': 'disk', 'dev': 'vdc'}) + {'bus': 'virtio', 'type': 'disk', 'dev': 'vdc'}, instance) get_volume_config.assert_called_with(bdm['connection_info'], {'bus': 'virtio', 'type': 'disk', 'dev': 'vdc'}) volume_save.assert_called_once_with() @@ -14767,11 +14767,13 @@ class LibvirtConnTestCase(test.NoDBTestCase): '/dev/vdb', 1) get_guest.assert_called_once_with(instance) - connect_volume.assert_called_once_with(new_connection_info, disk_info) + connect_volume.assert_called_once_with(new_connection_info, disk_info, + instance) swap_volume.assert_called_once_with(guest, 'vdb', '/fake-new-volume', 1) - disconnect_volume.assert_called_once_with(old_connection_info, 'vdb') + disconnect_volume.assert_called_once_with(old_connection_info, 'vdb', + instance) def test_swap_volume_driver_source_is_volume(self): self._test_swap_volume_driver(source_type='volume') @@ -15560,7 +15562,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase): 'flavor': {'root_gb': 10, 'ephemeral_gb': 0}}) disconnect_volume.assert_called_with( - mock.sentinel.conn_info_vda, 'vda') + mock.sentinel.conn_info_vda, 'vda', mock.ANY) @mock.patch('nova.virt.libvirt.driver.LibvirtDriver._disconnect_volume') def test_migrate_disk_and_power_off_boot_from_volume_backed_snapshot( @@ -15586,7 +15588,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase): 'flavor': {'root_gb': 10, 'ephemeral_gb': 0}}) disconnect_volume.assert_called_with( - mock.sentinel.conn_info_vda, 'vda') + mock.sentinel.conn_info_vda, 'vda', mock.ANY) @mock.patch('nova.utils.execute') @mock.patch('nova.virt.libvirt.utils.copy_image') diff --git a/nova/tests/unit/virt/libvirt/volume/test_disco.py b/nova/tests/unit/virt/libvirt/volume/test_disco.py index 5b014074a9f8..e8c27bd71211 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_disco.py +++ b/nova/tests/unit/virt/libvirt/volume/test_disco.py @@ -39,7 +39,7 @@ class LibvirtDISCOVolumeDriverTestCase( with mock.patch.object(dcon.connector, 'connect_volume', return_value={'path': '/dev/dms1234567'}): - dcon.connect_volume(conn, None) + dcon.connect_volume(conn, None, mock.sentinel.instance) self.assertEqual('/dev/dms1234567', conn['data']['device_path']) @@ -62,6 +62,6 @@ class LibvirtDISCOVolumeDriverTestCase( 'type': 'raw', 'dev': 'vda1', 'bus': 'pci0', 'device_path': '/dev/dms123456'} conn = {'data': disk_info} - dcon.disconnect_volume(conn, disk_info) + dcon.disconnect_volume(conn, disk_info, mock.sentinel.instance) dcon.connector.disconnect_volume.assert_called_once_with( disk_info, None) diff --git a/nova/tests/unit/virt/libvirt/volume/test_hgst.py b/nova/tests/unit/virt/libvirt/volume/test_hgst.py index a7fef0c1a9ec..2a0838fbedb9 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_hgst.py +++ b/nova/tests/unit/virt/libvirt/volume/test_hgst.py @@ -38,7 +38,7 @@ class LibvirtHGSTVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase): drvr.connector.connect_volume = brick_conn_vol di = {'path': '/dev/space01', 'name': 'space01'} ci = {'data': di} - drvr.connect_volume(ci, None) + drvr.connect_volume(ci, None, mock.sentinel.instance) self.assertEqual('/dev/space01', ci['data']['device_path']) @@ -57,6 +57,6 @@ class LibvirtHGSTVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase): di = {'path': '/dev/space01', 'name': 'space01', 'type': 'raw', 'dev': 'vda1', 'bus': 'pci0', 'device_path': '/dev/space01'} ci = {'data': di} - drvr.disconnect_volume(ci, di) + drvr.disconnect_volume(ci, di, mock.sentinel.instance) drvr.connector.disconnect_volume.assert_called_once_with( di, None) diff --git a/nova/tests/unit/virt/libvirt/volume/test_iscsi.py b/nova/tests/unit/virt/libvirt/volume/test_iscsi.py index 6821ae1c1708..649eeb995f1f 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_iscsi.py +++ b/nova/tests/unit/virt/libvirt/volume/test_iscsi.py @@ -75,7 +75,8 @@ Setting up iSCSI targets: unused libvirt_driver.connector.disconnect_volume = mock.MagicMock( side_effect=os_brick_exception.VolumeDeviceNotFound( device=device_path)) - libvirt_driver.disconnect_volume(connection_info, device_path) + libvirt_driver.disconnect_volume(connection_info, device_path, + mock.sentinel.instance) msg = mock_LOG_warning.call_args_list[0] self.assertIn('Ignoring VolumeDeviceNotFound', msg[0][0]) diff --git a/nova/tests/unit/virt/libvirt/volume/test_net.py b/nova/tests/unit/virt/libvirt/volume/test_net.py index cec1a834febd..d422e8fffb80 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_net.py +++ b/nova/tests/unit/virt/libvirt/volume/test_net.py @@ -52,7 +52,8 @@ class LibvirtNetVolumeDriverTestCase( self.assertEqual('network', tree.get('type')) self.assertEqual('sheepdog', tree.find('./source').get('protocol')) self.assertEqual(self.name, tree.find('./source').get('name')) - libvirt_driver.disconnect_volume(connection_info, "vde") + libvirt_driver.disconnect_volume(connection_info, "vde", + mock.sentinel.instance) def rbd_connection(self, volume): return { @@ -79,7 +80,8 @@ class LibvirtNetVolumeDriverTestCase( self.assertIsNone(tree.find('./source/auth')) self.assertEqual('1048576', tree.find('./iotune/total_bytes_sec').text) self.assertEqual('500', tree.find('./iotune/read_iops_sec').text) - libvirt_driver.disconnect_volume(connection_info, "vde") + libvirt_driver.disconnect_volume(connection_info, "vde", + mock.sentinel.instance) def test_libvirt_rbd_driver_hosts(self): libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host) @@ -95,7 +97,8 @@ class LibvirtNetVolumeDriverTestCase( found_hosts = tree.findall('./source/host') self.assertEqual(hosts, [host.get('name') for host in found_hosts]) self.assertEqual(ports, [host.get('port') for host in found_hosts]) - libvirt_driver.disconnect_volume(connection_info, "vde") + libvirt_driver.disconnect_volume(connection_info, "vde", + mock.sentinel.instance) def test_libvirt_rbd_driver_auth_enabled(self): libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host) @@ -112,7 +115,8 @@ class LibvirtNetVolumeDriverTestCase( self.assertEqual(self.user, tree.find('./auth').get('username')) self.assertEqual(secret_type, tree.find('./auth/secret').get('type')) self.assertEqual(self.uuid, tree.find('./auth/secret').get('uuid')) - libvirt_driver.disconnect_volume(connection_info, "vde") + libvirt_driver.disconnect_volume(connection_info, "vde", + mock.sentinel.instance) def test_libvirt_rbd_driver_auth_enabled_flags(self): # The values from the cinder connection_info take precedence over @@ -137,7 +141,8 @@ class LibvirtNetVolumeDriverTestCase( self.assertEqual(self.user, tree.find('./auth').get('username')) self.assertEqual(secret_type, tree.find('./auth/secret').get('type')) self.assertEqual(self.uuid, tree.find('./auth/secret').get('uuid')) - libvirt_driver.disconnect_volume(connection_info, "vde") + libvirt_driver.disconnect_volume(connection_info, "vde", + mock.sentinel.instance) def test_libvirt_rbd_driver_auth_disabled(self): libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host) @@ -152,7 +157,8 @@ class LibvirtNetVolumeDriverTestCase( tree = conf.format_dom() self._assertNetworkAndProtocolEquals(tree) self.assertIsNone(tree.find('./auth')) - libvirt_driver.disconnect_volume(connection_info, "vde") + libvirt_driver.disconnect_volume(connection_info, "vde", + mock.sentinel.instance) def test_libvirt_rbd_driver_auth_disabled_flags_override(self): libvirt_driver = net.LibvirtNetVolumeDriver(self.fake_host) @@ -177,7 +183,8 @@ class LibvirtNetVolumeDriverTestCase( self.assertEqual(flags_user, tree.find('./auth').get('username')) self.assertEqual(secret_type, tree.find('./auth/secret').get('type')) self.assertEqual(flags_uuid, tree.find('./auth/secret').get('uuid')) - libvirt_driver.disconnect_volume(connection_info, "vde") + libvirt_driver.disconnect_volume(connection_info, "vde", + mock.sentinel.instance) @mock.patch.object(host.Host, 'find_secret') @mock.patch.object(host.Host, 'create_secret') @@ -198,4 +205,5 @@ class LibvirtNetVolumeDriverTestCase( self.assertEqual(secret_type, tree.find('./auth/secret').get('type')) self.assertEqual(test_volume.SECRET_UUID, tree.find('./auth/secret').get('uuid')) - libvirt_driver.disconnect_volume(connection_info, 'vde') + libvirt_driver.disconnect_volume(connection_info, 'vde', + mock.sentinel.instance) diff --git a/nova/tests/unit/virt/libvirt/volume/test_scaleio.py b/nova/tests/unit/virt/libvirt/volume/test_scaleio.py index b740a0a8cfea..3c7dd62672af 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_scaleio.py +++ b/nova/tests/unit/virt/libvirt/volume/test_scaleio.py @@ -38,7 +38,7 @@ class LibvirtScaleIOVolumeDriverTestCase( sio.connector.connect_volume = brick_conn_vol disk_info = {'path': '/dev/vol01', 'name': 'vol01'} conn = {'data': disk_info} - sio.connect_volume(conn, None) + sio.connect_volume(conn, None, mock.sentinel.instance) self.assertEqual('/dev/vol01', conn['data']['device_path']) @@ -57,6 +57,6 @@ class LibvirtScaleIOVolumeDriverTestCase( disk_info = {'path': '/dev/vol01', 'name': 'vol01', 'type': 'raw', 'dev': 'vda1', 'bus': 'pci0', 'device_path': '/dev/vol01'} conn = {'data': disk_info} - sio.disconnect_volume(conn, disk_info) + sio.disconnect_volume(conn, disk_info, mock.sentinel.instance) sio.connector.disconnect_volume.assert_called_once_with( disk_info, None) diff --git a/nova/tests/unit/virt/libvirt/volume/test_vzstorage.py b/nova/tests/unit/virt/libvirt/volume/test_vzstorage.py index 23adb8d52b64..6149697eaebd 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_vzstorage.py +++ b/nova/tests/unit/virt/libvirt/volume/test_vzstorage.py @@ -64,7 +64,8 @@ class LibvirtVZStorageTestCase(test_volume.LibvirtVolumeBaseTestCase): err_pattern, drv.connect_volume, connection_info, - self.disk_info) + self.disk_info, + mock.sentinel.instance) def test_libvirt_vzstorage_driver_connect(self): def brick_conn_vol(data): @@ -77,7 +78,8 @@ class LibvirtVZStorageTestCase(test_volume.LibvirtVolumeBaseTestCase): connection_info = {'data': {'export': export_string, 'name': self.name}} - drv.connect_volume(connection_info, self.disk_info) + drv.connect_volume(connection_info, self.disk_info, + mock.sentinel.instance) self.assertEqual('vstorage://testcluster', connection_info['data']['device_path']) self.assertEqual('-u stack -g qemu -m 0770 ' @@ -89,7 +91,7 @@ class LibvirtVZStorageTestCase(test_volume.LibvirtVolumeBaseTestCase): drv = vzstorage.LibvirtVZStorageVolumeDriver(self.fake_host) drv.connector.disconnect_volume = mock.MagicMock() conn = {'data': self.disk_info} - drv.disconnect_volume(conn, self.disk_info) + drv.disconnect_volume(conn, self.disk_info, mock.sentinel.instance) drv.connector.disconnect_volume.assert_called_once_with( self.disk_info, None) diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index eeea5605a0c7..84443c82580c 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -973,7 +973,7 @@ class LibvirtDriver(driver.ComputeDriver): encryptor.detach_volume(**encryption) try: - self._disconnect_volume(connection_info, disk_dev) + self._disconnect_volume(connection_info, disk_dev, instance) except Exception as exc: with excutils.save_and_reraise_exception() as ctxt: if destroy_disks: @@ -1140,13 +1140,13 @@ class LibvirtDriver(driver.ComputeDriver): raise exception.VolumeDriverNotFound(driver_type=driver_type) return self.volume_drivers[driver_type] - def _connect_volume(self, connection_info, disk_info): + def _connect_volume(self, connection_info, disk_info, instance): vol_driver = self._get_volume_driver(connection_info) - vol_driver.connect_volume(connection_info, disk_info) + vol_driver.connect_volume(connection_info, disk_info, instance) - def _disconnect_volume(self, connection_info, disk_dev): + def _disconnect_volume(self, connection_info, disk_dev, instance): vol_driver = self._get_volume_driver(connection_info) - vol_driver.disconnect_volume(connection_info, disk_dev) + vol_driver.disconnect_volume(connection_info, disk_dev, instance) def _get_volume_config(self, connection_info, disk_info): vol_driver = self._get_volume_driver(connection_info) @@ -1201,7 +1201,7 @@ class LibvirtDriver(driver.ComputeDriver): disk_info = blockinfo.get_info_from_bdm( instance, CONF.libvirt.virt_type, instance.image_meta, bdm) - self._connect_volume(connection_info, disk_info) + self._connect_volume(connection_info, disk_info, instance) conf = self._get_volume_config(connection_info, disk_info) self._set_cache_mode(conf) @@ -1223,11 +1223,12 @@ class LibvirtDriver(driver.ComputeDriver): if isinstance(ex, libvirt.libvirtError): errcode = ex.get_error_code() if errcode == libvirt.VIR_ERR_OPERATION_FAILED: - self._disconnect_volume(connection_info, disk_dev) + self._disconnect_volume(connection_info, disk_dev, + instance) raise exception.DeviceIsBusy(device=disk_dev) with excutils.save_and_reraise_exception(): - self._disconnect_volume(connection_info, disk_dev) + self._disconnect_volume(connection_info, disk_dev, instance) def _swap_volume(self, guest, disk_path, new_path, resize_to): """Swap existing disk with a new block device.""" @@ -1291,14 +1292,14 @@ class LibvirtDriver(driver.ComputeDriver): # LibvirtConfigGuestDisk object it returns. We do not explicitly save # this to the BDM here as the upper compute swap_volume method will # eventually do this for us. - self._connect_volume(new_connection_info, disk_info) + self._connect_volume(new_connection_info, disk_info, instance) conf = self._get_volume_config(new_connection_info, disk_info) if not conf.source_path: - self._disconnect_volume(new_connection_info, disk_dev) + self._disconnect_volume(new_connection_info, disk_dev, instance) raise NotImplementedError(_("Swap only supports host devices")) self._swap_volume(guest, disk_dev, conf.source_path, resize_to) - self._disconnect_volume(old_connection_info, disk_dev) + self._disconnect_volume(old_connection_info, disk_dev, instance) def _get_existing_domain_xml(self, instance, network_info, block_device_info=None): @@ -1359,7 +1360,7 @@ class LibvirtDriver(driver.ComputeDriver): else: raise - self._disconnect_volume(connection_info, disk_dev) + self._disconnect_volume(connection_info, disk_dev, instance) def attach_interface(self, context, instance, image_meta, vif): guest = self._host.get_guest(instance) @@ -3622,7 +3623,7 @@ class LibvirtDriver(driver.ComputeDriver): connection_info = vol['connection_info'] vol_dev = block_device.prepend_dev(vol['mount_device']) info = disk_mapping[vol_dev] - self._connect_volume(connection_info, info) + self._connect_volume(connection_info, info, instance) cfg = self._get_volume_config(connection_info, info) devices.append(cfg) vol['connection_info'] = connection_info @@ -4885,7 +4886,8 @@ class LibvirtDriver(driver.ComputeDriver): if root_disk: disk_info = blockinfo.get_info_from_bdm( instance, CONF.libvirt.virt_type, image_meta, root_disk) - self._connect_volume(root_disk['connection_info'], disk_info) + self._connect_volume(root_disk['connection_info'], disk_info, + instance) disk_path = root_disk['connection_info']['data']['device_path'] # NOTE(apmelton) - Even though the instance is being booted from a @@ -6675,7 +6677,7 @@ class LibvirtDriver(driver.ComputeDriver): disk_info = blockinfo.get_info_from_bdm( instance, CONF.libvirt.virt_type, instance.image_meta, bdm) - self._connect_volume(connection_info, disk_info) + self._connect_volume(connection_info, disk_info, instance) # We call plug_vifs before the compute manager calls # ensure_filtering_rules_for_instance, to ensure bridge is set up @@ -6866,7 +6868,7 @@ class LibvirtDriver(driver.ComputeDriver): connection_info['data']['multipath_id'] = multipath_id disk_dev = vol['mount_device'].rpartition("/")[2] - self._disconnect_volume(connection_info, disk_dev) + self._disconnect_volume(connection_info, disk_dev, instance) def post_live_migration_at_source(self, context, instance, network_info): """Unplug VIFs from networks at source. @@ -7229,7 +7231,7 @@ class LibvirtDriver(driver.ComputeDriver): for vol in block_device_mapping: connection_info = vol['connection_info'] disk_dev = vol['mount_device'].rpartition("/")[2] - self._disconnect_volume(connection_info, disk_dev) + self._disconnect_volume(connection_info, disk_dev, instance) disk_info_text = self.get_instance_disk_info( instance, block_device_info=block_device_info) diff --git a/nova/virt/libvirt/volume/aoe.py b/nova/virt/libvirt/volume/aoe.py index b88a63aa9d17..9d299493fc96 100644 --- a/nova/virt/libvirt/volume/aoe.py +++ b/nova/virt/libvirt/volume/aoe.py @@ -43,14 +43,14 @@ class LibvirtAOEVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver): conf.source_path = connection_info['data']['device_path'] return conf - def connect_volume(self, connection_info, mount_device): + def connect_volume(self, connection_info, disk_info, instance): LOG.debug("Calling os-brick to attach AoE Volume") device_info = self.connector.connect_volume(connection_info['data']) LOG.debug("Attached AoE volume %s", device_info) connection_info['data']['device_path'] = device_info['path'] - def disconnect_volume(self, connection_info, disk_dev): + def disconnect_volume(self, connection_info, disk_dev, instance): """Detach the volume from instance_name.""" LOG.debug("calling os-brick to detach AoE Volume %s", @@ -59,4 +59,4 @@ class LibvirtAOEVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver): LOG.debug("Disconnected AoE Volume %s", disk_dev) super(LibvirtAOEVolumeDriver, - self).disconnect_volume(connection_info, disk_dev) + self).disconnect_volume(connection_info, disk_dev, instance) diff --git a/nova/virt/libvirt/volume/disco.py b/nova/virt/libvirt/volume/disco.py index 3af2750e8225..1bfeb5be535d 100644 --- a/nova/virt/libvirt/volume/disco.py +++ b/nova/virt/libvirt/volume/disco.py @@ -49,13 +49,13 @@ class LibvirtDISCOVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver): conf.source_type = 'file' return conf - def connect_volume(self, connection_info, disk_info): + def connect_volume(self, connection_info, disk_info, instance): """Connect a DISCO volume to a compute node.""" device_info = self.connector.connect_volume(connection_info['data']) connection_info['data']['device_path'] = device_info['path'] - def disconnect_volume(self, connection_info, disk_dev): + def disconnect_volume(self, connection_info, disk_dev, instance): """Disconnect a DISCO volume of a compute node.""" self.connector.disconnect_volume(connection_info['data'], None) super(LibvirtDISCOVolumeDriver, self).disconnect_volume( - connection_info, disk_dev) + connection_info, disk_dev, instance) diff --git a/nova/virt/libvirt/volume/fibrechannel.py b/nova/virt/libvirt/volume/fibrechannel.py index a84e7d47575f..c783cfc92dde 100644 --- a/nova/virt/libvirt/volume/fibrechannel.py +++ b/nova/virt/libvirt/volume/fibrechannel.py @@ -46,7 +46,7 @@ class LibvirtFibreChannelVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver): conf.driver_io = "native" return conf - def connect_volume(self, connection_info, disk_info): + def connect_volume(self, connection_info, disk_info, instance): """Attach the volume to instance_name.""" LOG.debug("Calling os-brick to attach FC Volume") @@ -58,7 +58,7 @@ class LibvirtFibreChannelVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver): connection_info['data']['multipath_id'] = \ device_info['multipath_id'] - def disconnect_volume(self, connection_info, disk_dev): + def disconnect_volume(self, connection_info, disk_dev, instance): """Detach the volume from instance_name.""" LOG.debug("calling os-brick to detach FC Volume") @@ -72,4 +72,4 @@ class LibvirtFibreChannelVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver): LOG.debug("Disconnected FC Volume %s", disk_dev) super(LibvirtFibreChannelVolumeDriver, - self).disconnect_volume(connection_info, disk_dev) + self).disconnect_volume(connection_info, disk_dev, instance) diff --git a/nova/virt/libvirt/volume/hgst.py b/nova/virt/libvirt/volume/hgst.py index e5df5bea01d4..c79636b92c4b 100644 --- a/nova/virt/libvirt/volume/hgst.py +++ b/nova/virt/libvirt/volume/hgst.py @@ -41,11 +41,11 @@ class LibvirtHGSTVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver): conf.source_path = connection_info['data']['device_path'] return conf - def connect_volume(self, connection_info, mount_device): + def connect_volume(self, connection_info, disk_info, instance): device_info = self.connector.connect_volume(connection_info['data']) connection_info['data']['device_path'] = device_info['path'] - def disconnect_volume(self, connection_info, disk_dev): + def disconnect_volume(self, connection_info, disk_dev, instance): self.connector.disconnect_volume(connection_info['data'], None) super(LibvirtHGSTVolumeDriver, - self).disconnect_volume(connection_info, disk_dev) + self).disconnect_volume(connection_info, disk_dev, instance) diff --git a/nova/virt/libvirt/volume/iscsi.py b/nova/virt/libvirt/volume/iscsi.py index 1bd9a3c82513..d9257bf77507 100644 --- a/nova/virt/libvirt/volume/iscsi.py +++ b/nova/virt/libvirt/volume/iscsi.py @@ -57,7 +57,7 @@ class LibvirtISCSIVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver): conf.driver_io = "native" return conf - def connect_volume(self, connection_info, disk_info): + def connect_volume(self, connection_info, disk_info, instance): """Attach the volume to instance_name.""" LOG.debug("Calling os-brick to attach iSCSI Volume") @@ -66,7 +66,7 @@ class LibvirtISCSIVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver): connection_info['data']['device_path'] = device_info['path'] - def disconnect_volume(self, connection_info, disk_dev): + def disconnect_volume(self, connection_info, disk_dev, instance): """Detach the volume from instance_name.""" LOG.debug("calling os-brick to detach iSCSI Volume") @@ -78,4 +78,4 @@ class LibvirtISCSIVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver): LOG.debug("Disconnected iSCSI Volume %s", disk_dev) super(LibvirtISCSIVolumeDriver, - self).disconnect_volume(connection_info, disk_dev) + self).disconnect_volume(connection_info, disk_dev, instance) diff --git a/nova/virt/libvirt/volume/net.py b/nova/virt/libvirt/volume/net.py index a405433405bf..e01e6ceb80a6 100644 --- a/nova/virt/libvirt/volume/net.py +++ b/nova/virt/libvirt/volume/net.py @@ -115,8 +115,8 @@ class LibvirtNetVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver): self._set_auth_config_iscsi(conf, netdisk_properties) return conf - def disconnect_volume(self, connection_info, disk_dev): + def disconnect_volume(self, connection_info, disk_dev, instance): """Detach the volume from instance_name.""" super(LibvirtNetVolumeDriver, - self).disconnect_volume(connection_info, disk_dev) + self).disconnect_volume(connection_info, disk_dev, instance) self._delete_secret_by_name(connection_info) diff --git a/nova/virt/libvirt/volume/scaleio.py b/nova/virt/libvirt/volume/scaleio.py index b97152eb0507..457dffcf02de 100644 --- a/nova/virt/libvirt/volume/scaleio.py +++ b/nova/virt/libvirt/volume/scaleio.py @@ -48,14 +48,14 @@ class LibvirtScaleIOVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver): conf.source_path = connection_info['data']['device_path'] return conf - def connect_volume(self, connection_info, disk_info): + def connect_volume(self, connection_info, disk_info, instance): device_info = self.connector.connect_volume(connection_info['data']) LOG.debug("Attached ScaleIO volume %s.", device_info) connection_info['data']['device_path'] = device_info['path'] - def disconnect_volume(self, connection_info, disk_dev): + def disconnect_volume(self, connection_info, disk_dev, instance): self.connector.disconnect_volume(connection_info['data'], None) LOG.debug("Disconnected volume %s.", disk_dev) super(LibvirtScaleIOVolumeDriver, self).disconnect_volume( - connection_info, disk_dev) + connection_info, disk_dev, instance) diff --git a/nova/virt/libvirt/volume/volume.py b/nova/virt/libvirt/volume/volume.py index 8d2bd3018f76..4577e1df072f 100644 --- a/nova/virt/libvirt/volume/volume.py +++ b/nova/virt/libvirt/volume/volume.py @@ -97,11 +97,11 @@ class LibvirtBaseVolumeDriver(object): return conf - def connect_volume(self, connection_info, disk_info): + def connect_volume(self, connection_info, disk_info, instance): """Connect the volume.""" pass - def disconnect_volume(self, connection_info, disk_dev): + def disconnect_volume(self, connection_info, disk_dev, instance): """Disconnect the volume.""" pass diff --git a/nova/virt/libvirt/volume/vzstorage.py b/nova/virt/libvirt/volume/vzstorage.py index c24ef848d809..fd334c9fcec2 100644 --- a/nova/virt/libvirt/volume/vzstorage.py +++ b/nova/virt/libvirt/volume/vzstorage.py @@ -108,7 +108,7 @@ class LibvirtVZStorageVolumeDriver(fs.LibvirtBaseFileSystemVolumeDriver): return ' '.join(mount_opts) - def connect_volume(self, connection_info, disk_info): + def connect_volume(self, connection_info, disk_info, instance): """Attach the volume to instance_name.""" LOG.debug("Calling os-brick to mount vzstorage") @@ -119,7 +119,7 @@ class LibvirtVZStorageVolumeDriver(fs.LibvirtBaseFileSystemVolumeDriver): connection_info['data']['device_path'] = device_info['path'] - def disconnect_volume(self, connection_info, disk_dev): + def disconnect_volume(self, connection_info, disk_dev, instance): """Detach the volume from instance_name.""" LOG.debug("calling os-brick to detach Vzstorage Volume")