Workaround changed LVM behaviour
authorIustin Pop <iustin@google.com>
Wed, 15 Feb 2012 12:14:04 +0000 (13:14 +0100)
committerIustin Pop <iustin@google.com>
Wed, 15 Feb 2012 15:43:10 +0000 (16:43 +0100)
commit048eeb2b8faa15bfb94205f908538ae729d6ca27
tree90ff4cebd0aeca1c280b90898290e3caa00838b0
parent5d0566deaf5cd50f487c97ae6884bef0939db1c5
Workaround changed LVM behaviour

The vgreduce command has changed behaviour from when we initially
wrote the code (2.02.02 versus 2.02.66, 4 years delta):

- if there are LVs which will be impacted, it requires --force
- otherwise refuses to proceed, but it still returns exit code 0

We handle this by looking to see if it returns "Wrote out consistent
volume group" (behaviour unchanged), or if it complains about
"--force"; in the case it didn't complete, we retry the operation.

We improve a bit the checking of "vgs", as it uses to fail silently
and we didn't detect it.

New tests for this function should test, I believe, all the expected
variations; at the least we now have data files with the expected
output.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Makefile.am
lib/storage.py
test/data/vgreduce-removemissing-2.02.02.txt [new file with mode: 0644]
test/data/vgreduce-removemissing-2.02.66-fail.txt [new file with mode: 0644]
test/data/vgreduce-removemissing-2.02.66-ok.txt [new file with mode: 0644]
test/data/vgs-missing-pvs-2.02.02.txt [new file with mode: 0644]
test/data/vgs-missing-pvs-2.02.66.txt [new file with mode: 0644]
test/ganeti.storage_unittest.py [new file with mode: 0755]