1
0
mirror of synced 2026-05-03 06:48:46 +00:00

Work around LVM related race condition when using --force with LVM

If an "lvremove" is immediately followed by an "lvcreate" for an LV
with the same name, "mkswap" (and maybe other commands) occasionally
fail with "Device or resource busy".

Work around it by using sync and sleep.
This commit is contained in:
Axel Beckert
2017-01-17 18:46:39 +01:00
parent 9c0086120f
commit d315f17eff
3 changed files with 10 additions and 0 deletions

View File

@@ -3066,6 +3066,10 @@ sub createLVMBits
logprint(
"Removing $lvm_disk - since we're forcing the install\n");
runCommand("lvremove --force $lvm_disk", \%CONFIG);
runCommand("sync", \%CONFIG);
logprint(
"Sleeping a few seconds to avoid LVM race conditions...\n");
sleep(3);
} else {
fail("ERROR: Xen guest $CONFIG{'hostname'} appears to be running.\nAborting.\n");
}