From: Vojtech Trefny <vtrefny(a)redhat.com>
Running pvmove on empty pv results in non-zero exit code (causing
libblockdev to think pvmove failed).
Signed-off-by: Vojtech Trefny <vtrefny(a)redhat.com>
---
blivet/devices/lvm.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py
index 39d245c..d283b7d 100644
--- a/blivet/devices/lvm.py
+++ b/blivet/devices/lvm.py
@@ -265,7 +265,9 @@ def _remove(self, member):
if lv.exists:
lv.setup()
- blockdev.lvm.pvmove(member.path)
+ # do not run pvmove on empty pvs
+ if (member.size - member.format.peStart - member.format.pvFree) >=
self.peSize:
+ blockdev.lvm.pvmove(member.path)
blockdev.lvm.vgreduce(self.name, member.path)
for (lv, status) in zip(self.lvs, status):
--
To view this commit on github, visit
https://github.com/rhinstaller/blivet/commit/3de69ff4267dc52126a60c6905c3...