From: John Griffith Date: Thu, 4 Jul 2013 15:25:03 +0000 (-0600) Subject: Add check for snapshot to Brick LVM. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=12441061fa4a378d78eb4f172a153bf135d450cc;p=openstack-build%2Fcinder-build.git Add check for snapshot to Brick LVM. 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 --- diff --git a/cinder/brick/local_dev/lvm.py b/cinder/brick/local_dev/lvm.py index 0066a726e..37953464d 100644 --- a/cinder/brick/local_dev/lvm.py +++ b/cinder/brick/local_dev/lvm.py @@ -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