def error():
print >>sys.stderr, "Error removing LV %s\n" % lvname
sys.exit(1)
+ # I know this is the wrong answer, but sometimes the first
+ # lvchange -a n fails for no particularly good reason, so this is
+ # a pretty good workaround
+ call(["/sbin/lvchange", "-a", "n", lvpath])
rv = call(["/sbin/lvchange", "-a", "n", lvpath])
if rv != 0:
error()