Remove unused argument from LibvirtDriver._disconnect_volume

_disconnect_volume was being passed disk_dev, which was is name of the
disk as presented to the gust. However, _disconnect_volume is only
concerned with unmounting the volume from the host, so this isn't
relevant.

A couple of volume drivers were using it for logging. We remove these
because it wasn't done consistently, is better done by the caller, and
isn't required as the information is available from other log
messages.

In the very minor associated debug log cleanup we also remove logging
of connection_info from one volume driver, which is potential security
bug.

We also do some associated cleanup in a few volume driver tests which
were assuming that disconnect_volume was being passed disk_info rather
than disk_dev, and that connection_info['data'] is related to
disk_info, which it isn't.

Change-Id: I61a0bee9e71e9a67f6a7c04a7bfd6e77fe818a77
This commit is contained in:
Matthew Booth 2017-12-17 04:17:22 +00:00
parent cfa6d3ae30
commit b912556ae0
27 changed files with 91 additions and 106 deletions

View File

@ -6685,7 +6685,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
</disk>
""", flags=flags)
mock_disconnect_volume.assert_called_with(
connection_info, 'vdc', instance)
connection_info, instance)
@mock.patch('nova.virt.libvirt.host.Host._get_domain')
def test_detach_volume_disk_not_found(self, mock_get_domain):
@ -6741,7 +6741,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', instance)])
mock.call.disconnect_volume(connection_info, instance)])
def test_extend_volume(self):
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
@ -10551,9 +10551,8 @@ 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',
inst_ref),
mock.call({'data': {}}, 'sdb', inst_ref)])
mock.call({'data': {'multipath_id': 'dummy1'}}, inst_ref),
mock.call({'data': {}}, inst_ref)])
def test_post_live_migration_cinder_v3(self):
cntx = context.get_admin_context()
@ -10591,8 +10590,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
mock_attachment_get.assert_called_once_with(cntx,
old_attachment_id)
mock_disconnect.assert_called_once_with(connection_info, disk_dev,
instance)
mock_disconnect.assert_called_once_with(connection_info, instance)
_test()
def test_get_instance_disk_info_excludes_volumes(self):
@ -14478,7 +14476,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', instance)
instance)
def _test_attach_detach_interface_get_config(self, method_name):
"""Tests that the get_config() method is properly called in
@ -15246,7 +15244,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
connect_volume.assert_called_once_with(new_connection_info, instance)
swap_volume.assert_called_once_with(guest, 'vdb', conf, 1)
disconnect_volume.assert_called_once_with(old_connection_info, 'vdb',
disconnect_volume.assert_called_once_with(old_connection_info,
instance)
def test_swap_volume_driver_source_is_volume(self):
@ -15286,7 +15284,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
connect_volume.assert_called_once_with(
mock.sentinel.new_connection_info, instance)
disconnect_volume.assert_called_once_with(
mock.sentinel.new_connection_info, 'vdb', instance)
mock.sentinel.new_connection_info, instance)
@mock.patch('nova.virt.libvirt.guest.BlockDevice.is_job_complete')
@mock.patch('nova.virt.libvirt.guest.BlockDevice.abort_job')
@ -15318,7 +15316,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
connect_volume.assert_called_once_with(
mock.sentinel.new_connection_info, instance)
disconnect_volume.assert_called_once_with(
mock.sentinel.new_connection_info, 'vdb', instance)
mock.sentinel.new_connection_info, instance)
@mock.patch('nova.virt.libvirt.guest.BlockDevice.is_job_complete')
@mock.patch('nova.privsep.path.chown')
@ -16135,7 +16133,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase):
'flavor': {'root_gb': 10,
'ephemeral_gb': 0}})
disconnect_volume.assert_called_with(
mock.sentinel.conn_info_vda, 'vda', mock.ANY)
mock.sentinel.conn_info_vda, mock.ANY)
@mock.patch('nova.virt.libvirt.driver.LibvirtDriver._disconnect_volume')
def test_migrate_disk_and_power_off_boot_from_volume_backed_snapshot(
@ -16161,7 +16159,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase):
'flavor': {'root_gb': 10,
'ephemeral_gb': 0}})
disconnect_volume.assert_called_with(
mock.sentinel.conn_info_vda, 'vda', mock.ANY)
mock.sentinel.conn_info_vda, mock.ANY)
@mock.patch('nova.utils.execute')
@mock.patch('nova.virt.libvirt.utils.copy_image')

View File

@ -58,10 +58,7 @@ class LibvirtDISCOVolumeDriverTestCase(
def test_libvirt_disco_driver_disconnect(self):
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',
'device_path': '/dev/dms123456'}
conn = {'data': disk_info}
dcon.disconnect_volume(conn, disk_info, mock.sentinel.instance)
conn = {'data': mock.sentinel.conn_data}
dcon.disconnect_volume(conn, mock.sentinel.instance)
dcon.connector.disconnect_volume.assert_called_once_with(
disk_info, None)
mock.sentinel.conn_data, None)

View File

@ -57,6 +57,6 @@ class LibvirtDRBDVolumeDriverTestCase(
# now disconnect the volume
with mock.patch.object(connector.DRBDConnector,
'disconnect_volume') as mock_disconnect:
drbd_driver.disconnect_volume(connection_info, 'vda', instance)
drbd_driver.disconnect_volume(connection_info, instance)
# disconnect is all passthrough so just assert the call
mock_disconnect.assert_called_once_with(connection_info['data'], None)

View File

@ -54,9 +54,7 @@ class LibvirtHGSTVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
def test_libvirt_hgst_driver_disconnect(self):
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'}
ci = {'data': di}
drvr.disconnect_volume(ci, di, mock.sentinel.instance)
ci = {'data': mock.sentinel.conn_data}
drvr.disconnect_volume(ci, mock.sentinel.instance)
drvr.connector.disconnect_volume.assert_called_once_with(
di, None)
mock.sentinel.conn_data, None)

View File

@ -50,7 +50,7 @@ class LibvirtISCSIVolumeDriverTestCase(
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,
mock.sentinel.instance)
msg = mock_LOG_warning.call_args_list[0]

View File

@ -52,7 +52,7 @@ 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,
mock.sentinel.instance)
def rbd_connection(self, volume):
@ -80,7 +80,7 @@ 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,
mock.sentinel.instance)
def test_libvirt_rbd_driver_hosts(self):
@ -97,7 +97,7 @@ 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,
mock.sentinel.instance)
def test_libvirt_rbd_driver_auth_enabled(self):
@ -115,7 +115,7 @@ 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,
mock.sentinel.instance)
def test_libvirt_rbd_driver_auth_enabled_flags(self):
@ -141,7 +141,7 @@ 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,
mock.sentinel.instance)
def test_libvirt_rbd_driver_auth_enabled_flags_secret_uuid_fallback(self):
@ -174,7 +174,7 @@ class LibvirtNetVolumeDriverTestCase(
self.assertEqual(secret_type, tree.find('./auth/secret').get('type'))
# Assert that the secret_uuid comes from CONF.libvirt.rbd_secret_uuid.
self.assertEqual(flags_uuid, tree.find('./auth/secret').get('uuid'))
libvirt_driver.disconnect_volume(connection_info, "vde",
libvirt_driver.disconnect_volume(connection_info,
mock.sentinel.instance)
def test_libvirt_rbd_driver_auth_disabled(self):
@ -190,7 +190,7 @@ 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,
mock.sentinel.instance)
def test_libvirt_rbd_driver_auth_disabled_flags_override(self):
@ -216,7 +216,7 @@ 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,
mock.sentinel.instance)
@mock.patch.object(host.Host, 'find_secret')
@ -238,5 +238,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,
mock.sentinel.instance)

View File

@ -52,7 +52,7 @@ class LibvirtNFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
instance = mock.sentinel.instance
instance.uuid = uuids.instance
libvirt_driver.connect_volume(connection_info, instance)
libvirt_driver.disconnect_volume(connection_info, "vde",
libvirt_driver.disconnect_volume(connection_info,
mock.sentinel.instance)
device_path = os.path.join(export_mnt_base,
@ -100,7 +100,7 @@ class LibvirtNFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
instance = mock.sentinel.instance
instance.uuid = uuids.instance
libvirt_driver.connect_volume(connection_info, instance)
libvirt_driver.disconnect_volume(connection_info, "vde",
libvirt_driver.disconnect_volume(connection_info,
mock.sentinel.instance)
mock_ensure_tree.assert_has_calls([mock.call(export_mnt_base)])

View File

@ -350,7 +350,7 @@ class LibvirtQuobyteVolumeDriverTestCase(
tree = conf.format_dom()
self._assertFileTypeEquals(tree, file_path)
libvirt_driver.disconnect_volume(connection_info, "vde",
libvirt_driver.disconnect_volume(connection_info,
mock.sentinel.instance)
mock_validate_volume.assert_called_once_with(export_mnt_base)
@ -382,7 +382,7 @@ class LibvirtQuobyteVolumeDriverTestCase(
conf = libvirt_driver.get_config(connection_info, self.disk_info)
tree = conf.format_dom()
self._assertFileTypeEquals(tree, file_path)
libvirt_driver.disconnect_volume(connection_info, "vde",
libvirt_driver.disconnect_volume(connection_info,
mock.sentinel.instance)
mock_umount_volume.assert_called_once_with(export_mnt_base)
@ -422,7 +422,7 @@ class LibvirtQuobyteVolumeDriverTestCase(
mock.ANY))
mock_validate_volume.assert_called_with(export_mnt_base)
libvirt_driver.disconnect_volume(connection_info, "vde",
libvirt_driver.disconnect_volume(connection_info,
mock.sentinel.instance)
@mock.patch.object(libvirt_utils, 'is_mounted', return_value=True)

View File

@ -54,9 +54,7 @@ class LibvirtScaleIOVolumeDriverTestCase(
def test_libvirt_scaleio_driver_disconnect(self):
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'}
conn = {'data': disk_info}
sio.disconnect_volume(conn, disk_info, mock.sentinel.instance)
conn = {'data': mock.sentinel.conn_data}
sio.disconnect_volume(conn, mock.sentinel.instance)
sio.connector.disconnect_volume.assert_called_once_with(
disk_info, None)
mock.sentinel.conn_data, None)

View File

@ -44,7 +44,7 @@ class LibvirtSMBFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
'name': self.name,
'options': None}}
libvirt_driver.connect_volume(connection_info, mock.sentinel.instance)
libvirt_driver.disconnect_volume(connection_info, "vde",
libvirt_driver.disconnect_volume(connection_info,
mock.sentinel.instance)
mock_ensure_tree.assert_has_calls([mock.call(export_mnt_base)])
@ -65,7 +65,7 @@ class LibvirtSMBFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
'name': self.name}}
libvirt_driver.connect_volume(connection_info, mock.sentinel.instance)
libvirt_driver.disconnect_volume(connection_info, "vde",
libvirt_driver.disconnect_volume(connection_info,
mock.sentinel.instance)
mock_umount.assert_has_calls([mock.call(export_mnt_base)])
@ -102,7 +102,7 @@ class LibvirtSMBFSVolumeDriverTestCase(test_volume.LibvirtVolumeBaseTestCase):
'options': options}}
libvirt_driver.connect_volume(connection_info, mock.sentinel.instance)
libvirt_driver.disconnect_volume(connection_info, "vde",
libvirt_driver.disconnect_volume(connection_info,
mock.sentinel.instance)
mock_ensure_tree.assert_has_calls([mock.call(export_mnt_base)])

View File

@ -72,11 +72,9 @@ class LibvirtHyperScaleVolumeDriverTestCase(
hs = vrtshyperscale.LibvirtHyperScaleVolumeDriver(self.fake_host)
# dummy arguments are just passed through to mock connector
disk_info = {'name': DEVICE_NAME}
connection_info = {'data': disk_info}
conn_data = {'name': DEVICE_NAME}
connection_info = {'data': conn_data}
hs.disconnect_volume(
connection_info, disk_info, mock.sentinel.instance)
hs.disconnect_volume(connection_info, mock.sentinel.instance)
hs.connector.disconnect_volume.assert_called_once_with(
connection_info['data'], None)
hs.connector.disconnect_volume.assert_called_once_with(conn_data, None)

View File

@ -91,10 +91,10 @@ class LibvirtVZStorageTestCase(test_volume.LibvirtVolumeBaseTestCase):
def test_libvirt_vzstorage_driver_disconnect(self):
drv = vzstorage.LibvirtVZStorageVolumeDriver(self.fake_host)
drv.connector.disconnect_volume = mock.MagicMock()
conn = {'data': self.disk_info}
drv.disconnect_volume(conn, self.disk_info, mock.sentinel.instance)
conn = {'data': mock.sentinel.conn_data}
drv.disconnect_volume(conn, mock.sentinel.instance)
drv.connector.disconnect_volume.assert_called_once_with(
self.disk_info, None)
mock.sentinel.conn_data, None)
def test_libvirt_vzstorage_driver_get_config(self):
libvirt_driver = vzstorage.LibvirtVZStorageVolumeDriver(self.fake_host)

View File

@ -992,7 +992,7 @@ class LibvirtDriver(driver.ComputeDriver):
encryptor.detach_volume(**encryption)
try:
self._disconnect_volume(connection_info, disk_dev, instance)
self._disconnect_volume(connection_info, instance)
except Exception as exc:
with excutils.save_and_reraise_exception() as ctxt:
if destroy_disks:
@ -1179,9 +1179,9 @@ class LibvirtDriver(driver.ComputeDriver):
vol_driver = self._get_volume_driver(connection_info)
vol_driver.connect_volume(connection_info, instance)
def _disconnect_volume(self, connection_info, disk_dev, instance):
def _disconnect_volume(self, connection_info, instance):
vol_driver = self._get_volume_driver(connection_info)
vol_driver.disconnect_volume(connection_info, disk_dev, instance)
vol_driver.disconnect_volume(connection_info, instance)
def _extend_volume(self, connection_info, instance):
vol_driver = self._get_volume_driver(connection_info)
@ -1277,7 +1277,7 @@ class LibvirtDriver(driver.ComputeDriver):
LOG.exception(_('Failed to attach volume at mountpoint: %s'),
mountpoint, instance=instance)
with excutils.save_and_reraise_exception():
self._disconnect_volume(connection_info, disk_dev, instance)
self._disconnect_volume(connection_info, instance)
def _swap_volume(self, guest, disk_path, conf, resize_to):
"""Swap existing disk with a new block device."""
@ -1359,17 +1359,16 @@ class LibvirtDriver(driver.ComputeDriver):
self._connect_volume(new_connection_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, instance)
self._disconnect_volume(new_connection_info, instance)
raise NotImplementedError(_("Swap only supports host devices"))
try:
self._swap_volume(guest, disk_dev, conf, resize_to)
except exception.VolumeRebaseFailed:
with excutils.save_and_reraise_exception():
self._disconnect_volume(new_connection_info, disk_dev,
instance)
self._disconnect_volume(new_connection_info, instance)
self._disconnect_volume(old_connection_info, disk_dev, instance)
self._disconnect_volume(old_connection_info, instance)
def _get_existing_domain_xml(self, instance, network_info,
block_device_info=None):
@ -1429,7 +1428,7 @@ class LibvirtDriver(driver.ComputeDriver):
else:
raise
self._disconnect_volume(connection_info, disk_dev, instance)
self._disconnect_volume(connection_info, instance)
def extend_volume(self, connection_info, instance):
try:
@ -7082,8 +7081,7 @@ class LibvirtDriver(driver.ComputeDriver):
multipath_id = vol['connection_info']['data']['multipath_id']
connection_info['data']['multipath_id'] = multipath_id
disk_dev = vol['mount_device'].rpartition("/")[2]
self._disconnect_volume(connection_info, disk_dev, instance)
self._disconnect_volume(connection_info, instance)
def post_live_migration_at_source(self, context, instance, network_info):
"""Unplug VIFs from networks at source.
@ -7439,8 +7437,7 @@ class LibvirtDriver(driver.ComputeDriver):
block_device_info)
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, instance)
self._disconnect_volume(connection_info, instance)
disk_info = self._get_instance_disk_info(instance, block_device_info)

View File

@ -51,13 +51,12 @@ class LibvirtAOEVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
connection_info['data']['device_path'] = device_info['path']
def disconnect_volume(self, connection_info, disk_dev, instance):
def disconnect_volume(self, connection_info, instance):
"""Detach the volume from instance_name."""
LOG.debug("calling os-brick to detach AoE Volume %s",
connection_info)
LOG.debug("calling os-brick to detach AoE Volume", instance=instance)
self.connector.disconnect_volume(connection_info['data'], None)
LOG.debug("Disconnected AoE Volume %s", disk_dev)
LOG.debug("Disconnected AoE Volume", instance=instance)
super(LibvirtAOEVolumeDriver,
self).disconnect_volume(connection_info, disk_dev, instance)
self).disconnect_volume(connection_info, instance)

View File

@ -55,8 +55,8 @@ class LibvirtDISCOVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
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, instance):
def disconnect_volume(self, connection_info, 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, instance)
connection_info, instance)

View File

@ -46,16 +46,14 @@ class LibvirtDRBDVolumeDriver(libvirt_volume.LibvirtVolumeDriver):
LOG.debug("Attached DRBD volume %s", device_info, instance=instance)
connection_info['data']['device_path'] = device_info['path']
def disconnect_volume(self, connection_info, disk_dev, instance):
def disconnect_volume(self, connection_info, instance):
"""Disconnect the volume.
:param connection_info: dict of connection information for the backend
storage when a connection was initiated with Cinder.
:param disk_dev: The block device mountpoint device name (not path).
This is currently not used by this method.
:param instance: The nova.objects.Instance that is having a volume
disconnected from it.
"""
LOG.debug("Calling os-brick to detach DRBD Volume.", instance=instance)
self.connector.disconnect_volume(connection_info['data'], None)
LOG.debug("Disconnected DRBD Volume %s", disk_dev, instance=instance)
LOG.debug("Disconnected DRBD Volume", instance=instance)

View File

@ -59,10 +59,10 @@ class LibvirtFibreChannelVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
connection_info['data']['multipath_id'] = \
device_info['multipath_id']
def disconnect_volume(self, connection_info, disk_dev, instance):
def disconnect_volume(self, connection_info, instance):
"""Detach the volume from instance_name."""
LOG.debug("calling os-brick to detach FC Volume")
LOG.debug("calling os-brick to detach FC Volume", instance=instance)
# TODO(walter-boring) eliminated the need for preserving
# multipath_id. Use scsi_id instead of multipath -ll
# This will then eliminate the need to pass anything in
@ -70,10 +70,10 @@ class LibvirtFibreChannelVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
# with the rest of the connectors.
self.connector.disconnect_volume(connection_info['data'],
connection_info['data'])
LOG.debug("Disconnected FC Volume %s", disk_dev)
LOG.debug("Disconnected FC Volume", instance=instance)
super(LibvirtFibreChannelVolumeDriver,
self).disconnect_volume(connection_info, disk_dev, instance)
self).disconnect_volume(connection_info, instance)
def extend_volume(self, connection_info, instance):
"""Extend the volume."""

View File

@ -119,7 +119,7 @@ class LibvirtMountedFileSystemVolumeDriver(LibvirtBaseFileSystemVolumeDriver):
connection_info['data']['device_path'] = \
self._get_device_path(connection_info)
def disconnect_volume(self, connection_info, disk_dev, instance):
def disconnect_volume(self, connection_info, instance):
"""Disconnect the volume."""
vol_name = connection_info['data']['name']
mountpoint = self._get_mount_path(connection_info)

View File

@ -46,7 +46,7 @@ class LibvirtHGSTVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
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, instance):
def disconnect_volume(self, connection_info, instance):
self.connector.disconnect_volume(connection_info['data'], None)
super(LibvirtHGSTVolumeDriver,
self).disconnect_volume(connection_info, disk_dev, instance)
self).disconnect_volume(connection_info, instance)

View File

@ -66,19 +66,19 @@ class LibvirtISCSIVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
connection_info['data']['device_path'] = device_info['path']
def disconnect_volume(self, connection_info, disk_dev, instance):
def disconnect_volume(self, connection_info, instance):
"""Detach the volume from instance_name."""
LOG.debug("calling os-brick to detach iSCSI Volume")
LOG.debug("calling os-brick to detach iSCSI Volume", instance=instance)
try:
self.connector.disconnect_volume(connection_info['data'], None)
except os_brick_exception.VolumeDeviceNotFound as exc:
LOG.warning('Ignoring VolumeDeviceNotFound: %s', exc)
return
LOG.debug("Disconnected iSCSI Volume %s", disk_dev)
LOG.debug("Disconnected iSCSI Volume", instance=instance)
super(LibvirtISCSIVolumeDriver,
self).disconnect_volume(connection_info, disk_dev, instance)
self).disconnect_volume(connection_info, instance)
def extend_volume(self, connection_info, instance):
"""Extend the volume."""

View File

@ -127,8 +127,8 @@ class LibvirtNetVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
self._set_auth_config_iscsi(conf, netdisk_properties)
return conf
def disconnect_volume(self, connection_info, disk_dev, instance):
def disconnect_volume(self, connection_info, instance):
"""Detach the volume from instance_name."""
super(LibvirtNetVolumeDriver,
self).disconnect_volume(connection_info, disk_dev, instance)
self).disconnect_volume(connection_info, instance)
self._delete_secret_by_name(connection_info)

View File

@ -149,7 +149,7 @@ class LibvirtQuobyteVolumeDriver(fs.LibvirtBaseFileSystemVolumeDriver):
validate_volume(mount_path)
@utils.synchronized('connect_qb_volume')
def disconnect_volume(self, connection_info, disk_dev, instance):
def disconnect_volume(self, connection_info, instance):
"""Disconnect the volume."""
quobyte_volume = self._normalize_export(

View File

@ -54,9 +54,9 @@ class LibvirtScaleIOVolumeDriver(libvirt_volume.LibvirtBaseVolumeDriver):
LOG.debug("Attached ScaleIO volume %s.", device_info)
connection_info['data']['device_path'] = device_info['path']
def disconnect_volume(self, connection_info, disk_dev, instance):
def disconnect_volume(self, connection_info, instance):
self.connector.disconnect_volume(connection_info['data'], None)
LOG.debug("Disconnected volume %s.", disk_dev)
LOG.debug("Disconnected volume", instance=instance)
super(LibvirtScaleIOVolumeDriver, self).disconnect_volume(
connection_info, disk_dev, instance)
connection_info, instance)

View File

@ -52,7 +52,7 @@ class LibvirtSMBFSVolumeDriver(fs.LibvirtBaseFileSystemVolumeDriver):
device_path = self._get_device_path(connection_info)
connection_info['data']['device_path'] = device_path
def disconnect_volume(self, connection_info, disk_dev, instance):
def disconnect_volume(self, connection_info, instance):
"""Disconnect the volume."""
smbfs_share = connection_info['data']['export']
mount_path = self._get_mount_path(connection_info)

View File

@ -110,7 +110,7 @@ class LibvirtBaseVolumeDriver(object):
"""Connect the volume."""
pass
def disconnect_volume(self, connection_info, disk_dev, instance):
def disconnect_volume(self, connection_info, instance):
"""Disconnect the volume."""
pass

View File

@ -51,7 +51,8 @@ class LibvirtHyperScaleVolumeDriver(libvirt_volume.LibvirtVolumeDriver):
LOG.info("connect_volume: device path %(device_path)s",
{'device_path': connection_info['data']['device_path']})
def disconnect_volume(self, connection_info, disk_dev, instance):
def disconnect_volume(self, connection_info, instance):
self.connector.disconnect_volume(connection_info['data'], None)
LOG.info("Disconnected volume %(vol_id)s",
{'vol_id': connection_info['data']['name']})
LOG.debug("Disconnected volume %(vol_id)s",
{'vol_id': connection_info['data']['name']},
instance=instance)

View File

@ -126,8 +126,9 @@ class LibvirtVZStorageVolumeDriver(fs.LibvirtBaseFileSystemVolumeDriver):
return _connect_volume(connection_info, instance)
def disconnect_volume(self, connection_info, disk_dev, instance):
def disconnect_volume(self, connection_info, instance):
"""Detach the volume from instance_name."""
LOG.debug("calling os-brick to detach Vzstorage Volume")
LOG.debug("calling os-brick to detach Vzstorage Volume",
instance=instance)
self.connector.disconnect_volume(connection_info['data'], None)
LOG.debug("Disconnected Vzstorage Volume %s", disk_dev)
LOG.debug("Disconnected Vzstorage Volume", instance=instance)