From adc83405e599bd51abb8f3617916c8f80c8a9d4f Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 21 Sep 2012 14:51:17 -0400 Subject: [PATCH] Remove unused code: check_for_export. This code has been unused since cinder was split from nova. It used to be used as a safety check during live migration. The check was removed recently in nova, since it wasn't being used with Cinder anyway (just nova-volumes). An alternative approach would be to expose this from Cinder somehow if we feel it's important, but until then, there's no reason to keep dead code around. Change-Id: I5adfb405c1bd04bcc1ad61d511afb227a198f4ed --- cinder/tests/test_storwize_svc.py | 2 -- cinder/tests/test_volume.py | 4 --- cinder/tests/test_zadara.py | 1 - cinder/volume/driver.py | 42 ------------------------------- cinder/volume/manager.py | 7 ------ cinder/volume/netapp.py | 6 ----- cinder/volume/nfs.py | 4 --- cinder/volume/storwize_svc.py | 3 --- cinder/volume/zadara.py | 4 --- 9 files changed, 73 deletions(-) diff --git a/cinder/tests/test_storwize_svc.py b/cinder/tests/test_storwize_svc.py index 15bda50a0..88b16ec25 100644 --- a/cinder/tests/test_storwize_svc.py +++ b/cinder/tests/test_storwize_svc.py @@ -1165,8 +1165,6 @@ class StorwizeSVCDriverTestCase(test.TestCase): # Do nothing self.driver.create_export(None, volume) self.driver.remove_export(None, volume) - self.assertRaises(NotImplementedError, - self.driver.check_for_export, None, volume["id"]) # Make sure volume attributes are as they should be attributes = self.driver._get_volume_attributes(volume["name"]) diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py index 23d66b0f7..baac8023b 100644 --- a/cinder/tests/test_volume.py +++ b/cinder/tests/test_volume.py @@ -827,10 +827,6 @@ class ISCSITestCase(DriverTestCase): return volume_id_list - def test_check_for_export_with_no_volume(self): - instance_uuid = '12345678-1234-5678-1234-567812345678' - self.volume.check_for_export(self.context, instance_uuid) - class VolumePolicyTestCase(test.TestCase): diff --git a/cinder/tests/test_zadara.py b/cinder/tests/test_zadara.py index 521bf8997..b999ade39 100644 --- a/cinder/tests/test_zadara.py +++ b/cinder/tests/test_zadara.py @@ -411,7 +411,6 @@ class ZadaraVPSADriverTestCase(test.TestCase): self.driver.create_export(context, volume) self.driver.ensure_export(context, volume) self.driver.remove_export(context, volume) - self.driver.check_for_export(context, 0) self.assertRaises(NotImplementedError, self.driver.create_volume_from_snapshot, diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index a0bc3941b..5b691981d 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -238,10 +238,6 @@ class VolumeDriver(object): """Removes an export for a logical volume.""" raise NotImplementedError() - def check_for_export(self, context, volume_id): - """Make sure volume is exported.""" - raise NotImplementedError() - def initialize_connection(self, volume, connector): """Allow connection to connector and return connection info.""" raise NotImplementedError() @@ -538,33 +534,6 @@ class ISCSIDriver(VolumeDriver): def terminate_connection(self, volume, connector): pass - def check_for_export(self, context, volume_id): - """Make sure volume is exported.""" - vol_uuid_file = 'volume-%s' % volume_id - volume_path = os.path.join(FLAGS.volumes_dir, vol_uuid_file) - if os.path.isfile(volume_path): - iqn = '%s%s' % (FLAGS.iscsi_target_prefix, - vol_uuid_file) - else: - raise exception.PersistentVolumeFileNotFound(volume_id=volume_id) - - # TODO(jdg): In the future move all of the dependent stuff into the - # cooresponding target admin class - if not isinstance(self.tgtadm, iscsi.TgtAdm): - tid = self.db.volume_get_iscsi_target_num(context, volume_id) - else: - tid = 0 - - try: - self.tgtadm.show_target(tid, iqn=iqn) - except exception.ProcessExecutionError, e: - # Instances remount read-only in this case. - # /etc/init.d/iscsitarget restart and rebooting cinder-volume - # is better since ensure_export() works at boot time. - LOG.error(_("Cannot confirm exported volume " - "id:%(volume_id)s.") % locals()) - raise - def copy_image_to_volume(self, context, volume, image_service, image_id): """Fetch the image from image_service and write it to the volume.""" volume_path = self.local_path(volume) @@ -714,10 +683,6 @@ class RBDDriver(VolumeDriver): """Removes an export for a logical volume""" pass - def check_for_export(self, context, volume_id): - """Make sure volume is exported.""" - pass - def initialize_connection(self, volume, connector): return { 'driver_volume_type': 'rbd', @@ -861,10 +826,6 @@ class SheepdogDriver(VolumeDriver): """Removes an export for a logical volume""" pass - def check_for_export(self, context, volume_id): - """Make sure volume is exported.""" - pass - def initialize_connection(self, volume, connector): return { 'driver_volume_type': 'sheepdog', @@ -908,9 +869,6 @@ class LoggingVolumeDriver(VolumeDriver): def terminate_connection(self, volume, connector): self.log_action('terminate_connection', volume) - def check_for_export(self, context, volume_id): - self.log_action('check_for_export', volume_id) - _LOGS = [] @staticmethod diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index fbefce213..ddf86e695 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -399,13 +399,6 @@ class VolumeManager(manager.SchedulerDependentManager): volume_ref = self.db.volume_get(context, volume_id) self.driver.terminate_connection(volume_ref, connector) - def check_for_export(self, context, instance_uuid): - """Make sure whether volume is exported.""" - volumes = self.db.volume_get_all_by_instance_uuid(context, - instance_uuid) - for volume in volumes: - self.driver.check_for_export(context, volume['id']) - def _volume_stats_changed(self, stat1, stat2): if FLAGS.volume_force_update_capabilities: return True diff --git a/cinder/volume/netapp.py b/cinder/volume/netapp.py index 46a3a7809..58e7249a6 100644 --- a/cinder/volume/netapp.py +++ b/cinder/volume/netapp.py @@ -993,9 +993,6 @@ class NetAppISCSIDriver(driver.ISCSIDriver): self._refresh_dfm_luns(lun.HostId) self._discover_dataset_luns(dataset, clone_name) - def check_for_export(self, context, volume_id): - raise NotImplementedError() - class NetAppLun(object): """Represents a LUN on NetApp storage.""" @@ -1234,9 +1231,6 @@ class NetAppCmodeISCSIDriver(driver.ISCSIDriver): extra_args['SpaceReserved'] = True self._clone_lun(lun.handle, new_name, extra_args) - def check_for_export(self, context, volume_id): - raise NotImplementedError() - def _get_qos_type(self, volume): """Get the storage service type for a volume.""" type_id = volume['volume_type_id'] diff --git a/cinder/volume/nfs.py b/cinder/volume/nfs.py index 02fb3a08f..7f8cda7bc 100644 --- a/cinder/volume/nfs.py +++ b/cinder/volume/nfs.py @@ -123,10 +123,6 @@ class NfsDriver(driver.VolumeDriver): """Removes an export for a logical volume.""" pass - def check_for_export(self, context, volume_id): - """Make sure volume is exported.""" - pass - def initialize_connection(self, volume, connector): """Allow connection to connector and return connection info.""" data = {'export': volume['provider_location'], diff --git a/cinder/volume/storwize_svc.py b/cinder/volume/storwize_svc.py index a5ec8063a..1c3006de9 100644 --- a/cinder/volume/storwize_svc.py +++ b/cinder/volume/storwize_svc.py @@ -495,9 +495,6 @@ class StorwizeSVCDriver(san.SanISCSIDriver): def remove_export(self, context, volume): pass - def check_for_export(self, context, volume_id): - raise NotImplementedError() - def initialize_connection(self, volume, connector): """Perform the necessary work so that an iSCSI connection can be made. diff --git a/cinder/volume/zadara.py b/cinder/volume/zadara.py index e55d6432d..03f34ca54 100755 --- a/cinder/volume/zadara.py +++ b/cinder/volume/zadara.py @@ -389,10 +389,6 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver): """Irrelevant for VPSA volumes. Export removed during detach.""" pass - def check_for_export(self, context, volume_id): - """Irrelevant for VPSA volumes. Export created during attachment.""" - pass - def initialize_connection(self, volume, connector): """ Attach volume to initiator/host. -- 2.45.2