]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Ensure volume exists before deleting.
authorMichael Basnight <mbasnight@gmail.com>
Wed, 20 Feb 2013 16:12:03 +0000 (10:12 -0600)
committerMichael Basnight <mbasnight@gmail.com>
Wed, 20 Feb 2013 16:12:03 +0000 (10:12 -0600)
fixes bug 1130744

Change-Id: I39152dd1caa5ab1b2cfbae56eaec8c8fa309669c

cinder/volume/drivers/san/hp_lefthand.py

index 05a7c7de79f2ee05dc0640f7765dc71eab0153c3..1ae1b030f83a0165b87c8cfb9b7001ea5612a344 100644 (file)
@@ -220,8 +220,11 @@ class HpSanISCSIDriver(SanISCSIDriver):
         cliq_args = {}
         cliq_args['volumeName'] = volume['name']
         cliq_args['prompt'] = 'false'  # Don't confirm
-
-        self._cliq_run_xml("deleteVolume", cliq_args)
+        try:
+            volume_info = self._cliq_get_volume_info(volume['name'])
+            self._cliq_run_xml("deleteVolume", cliq_args)
+        except Exception:
+            LOG.exception("Volume did not exist. It will not be deleted")
 
     def local_path(self, volume):
         msg = _("local_path not supported")