]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Remove unused code: check_for_export.
authorRussell Bryant <rbryant@redhat.com>
Fri, 21 Sep 2012 18:51:17 +0000 (14:51 -0400)
committerRussell Bryant <rbryant@redhat.com>
Fri, 21 Sep 2012 18:51:17 +0000 (14:51 -0400)
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
cinder/tests/test_volume.py
cinder/tests/test_zadara.py
cinder/volume/driver.py
cinder/volume/manager.py
cinder/volume/netapp.py
cinder/volume/nfs.py
cinder/volume/storwize_svc.py
cinder/volume/zadara.py

index 15bda50a0d03c6ca0e18d674684436bbf9c6e443..88b16ec25662b9fd7454d359aae417a87183ebab 100644 (file)
@@ -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"])
index 23d66b0f77c26449d0547303cf1393339cf9fd6e..baac8023b402e1feed0a1b66e198481446d46d50 100644 (file)
@@ -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):
 
index 521bf8997d08ffbd1b13dea830322c0d96f8087b..b999ade393377c000335e53e9d7373bfe65a1eca 100644 (file)
@@ -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,
index a0bc3941b81cdc55a4bcb2daf5fc05b3648ccd23..5b691981df8843a9b95a70e26a16d3360870f374 100644 (file)
@@ -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
index fbefce21303895b6a7708b16a870adc33104cbe2..ddf86e6954d451163e4f07a95fec2949912bffee 100644 (file)
@@ -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
index 46a3a780916a9ddc4c58be1b435c6cdf21297861..58e7249a6eb501bd9a04b6cd4d76090c5e1660ef 100644 (file)
@@ -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']
index 02fb3a08fe936d383c61214ec1891e1d3d20d437..7f8cda7bcae0a04b415a987576b603fc0aeed265 100644 (file)
@@ -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'],
index a5ec8063a07c51f4f41202656fb5025ae983d4d2..1c3006de92a94f2615760f2a4b6c4585a5947d34 100644 (file)
@@ -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.
 
index e55d6432dabcb10dd19f4c778519e91da788d88c..03f34ca548416d7930ae4b6681ae28ed324d7d43 100755 (executable)
@@ -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.