From 12441061fa4a378d78eb4f172a153bf135d450cc Mon Sep 17 00:00:00 2001 From: John Griffith Date: Thu, 4 Jul 2013 09:25:03 -0600 Subject: [PATCH] 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 --- cinder/brick/local_dev/lvm.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 -- 2.45.2