]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add check for snapshot to Brick LVM.
authorJohn Griffith <john.griffith@solidfire.com>
Thu, 4 Jul 2013 15:25:03 +0000 (09:25 -0600)
committerJohn Griffith <john.griffith@solidfire.com>
Thu, 4 Jul 2013 15:25:03 +0000 (09:25 -0600)
Adds a check to the LVM code in brick to see if
a snapshot exists.  This implements the incorrectly
named "is_busy" method that exists in the cinder LVM driver.

Change-Id: Ia0f6cbd3d5b4561c5368545448abaafa67caf05d

cinder/brick/local_dev/lvm.py

index 0066a726e7403ee0b87ad9a85453eaf5afcc1911..37953464d0464eee6fae13fe3aedcf0388b05f28 100644 (file)
@@ -372,3 +372,13 @@ class LVM(object):
         self._execute('lvconvert', '--merge',
                       snapshot_name, root_helper='sudo',
                       run_as_root=True)
+
+    def lv_has_snapshot(self, name):
+        out, err = self._execute('lvdisplay', '--noheading',
+                                 '-C', '-o', 'Attr',
+                                 '%s/%s' % (self.vg_name, name))
+        if out:
+            out = out.strip()
+            if (out[0] == 'o') or (out[0] == 'O'):
+                return True
+        return False