From: zhaoqin <chaochin@gmail.com>
Date: Fri, 8 Nov 2013 18:27:49 +0000 (+0800)
Subject: Do not remove volume silently if GPFS is unmounted
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=5fc5ba9ccbb5786bc2e4d11e47c0b92f1cf56a42;p=openstack-build%2Fcinder-build.git

Do not remove volume silently if GPFS is unmounted

When GPFS is not mounted, delete_volume() will complete successfully, so that
volume record is removed by cinder but volume file still resides on GPFS. This
change will prevent cinder to remove volume when GPFS is not mounted.

Change-Id: Ic3bf265e553f22c8b6a6e3568da04af88fab3322
Closes-Bug: #1249411
---

diff --git a/cinder/volume/drivers/gpfs.py b/cinder/volume/drivers/gpfs.py
index 2e5b8119c..55d573e8e 100644
--- a/cinder/volume/drivers/gpfs.py
+++ b/cinder/volume/drivers/gpfs.py
@@ -330,6 +330,9 @@ class GPFSDriver(driver.VolumeDriver):
 
     def delete_volume(self, volume):
         """Deletes a logical volume."""
+        # Check if GPFS is mounted
+        self._verify_gpfs_path_state(self.configuration.gpfs_mount_point_base)
+
         volume_path = self.local_path(volume)
         self._delete_gpfs_file(volume_path)