git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
appliance: udev-174 moves udevd to /lib/udev/udevd (instead of /sbin/udevd)
[libguestfs.git]
/
daemon
/
lvm.c
diff --git
a/daemon/lvm.c
b/daemon/lvm.c
index
216c9c4
..
dbca20b
100644
(file)
--- a/
daemon/lvm.c
+++ b/
daemon/lvm.c
@@
-223,10
+223,12
@@
do_vgcreate (const char *volgroup, char *const *physvols)
if (r == -1) {
reply_with_error ("%s", err);
free (err);
if (r == -1) {
reply_with_error ("%s", err);
free (err);
+ free (argv);
return -1;
}
free (err);
return -1;
}
free (err);
+ free (argv);
udev_settle ();
udev_settle ();
@@
-322,6
+324,12
@@
do_lvm_remove_all (void)
return -1;
for (i = 0; xs[i] != NULL; ++i) {
return -1;
for (i = 0; xs[i] != NULL; ++i) {
+ /* Deactivate the LV first. On Ubuntu, lvremove '-f' option
+ * does not remove active LVs reliably.
+ */
+ (void) command (NULL, NULL, "lvm", "lvchange", "-an", xs[i], NULL);
+ udev_settle ();
+
r = command (NULL, &err, "lvm", "lvremove", "-f", xs[i], NULL);
if (r == -1) {
reply_with_error ("lvremove: %s: %s", xs[i], err);
r = command (NULL, &err, "lvm", "lvremove", "-f", xs[i], NULL);
if (r == -1) {
reply_with_error ("lvremove: %s: %s", xs[i], err);
@@
-339,6
+347,10
@@
do_lvm_remove_all (void)
return -1;
for (i = 0; xs[i] != NULL; ++i) {
return -1;
for (i = 0; xs[i] != NULL; ++i) {
+ /* Deactivate the VG first, see note above. */
+ (void) command (NULL, NULL, "lvm", "vgchange", "-an", xs[i], NULL);
+ udev_settle ();
+
r = command (NULL, &err, "lvm", "vgremove", "-f", xs[i], NULL);
if (r == -1) {
reply_with_error ("vgremove: %s: %s", xs[i], err);
r = command (NULL, &err, "lvm", "vgremove", "-f", xs[i], NULL);
if (r == -1) {
reply_with_error ("vgremove: %s: %s", xs[i], err);
@@
-502,10
+514,12
@@
do_vg_activate (int activate, char *const *volgroups)
if (r == -1) {
reply_with_error ("vgchange: %s", err);
free (err);
if (r == -1) {
reply_with_error ("vgchange: %s", err);
free (err);
+ free (argv);
return -1;
}
free (err);
return -1;
}
free (err);
+ free (argv);
udev_settle ();
udev_settle ();