summaryrefslogtreecommitdiffstats
path: root/daemon/lvm.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-07-01 17:15:24 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-07-01 17:15:24 +0100
commit99e28249d52ca5495b636e14ae3e4387ee62c8fe (patch)
tree6038b57e180556e9429cd422d075fccd9c4a9ff7 /daemon/lvm.c
parent3e2d925717d1dac6b3862e98192c12d1080c2152 (diff)
downloadlibguestfs-99e28249d52ca5495b636e14ae3e4387ee62c8fe.tar.gz
libguestfs-99e28249d52ca5495b636e14ae3e4387ee62c8fe.tar.xz
libguestfs-99e28249d52ca5495b636e14ae3e4387ee62c8fe.zip
Call 'udevadm settle' after operations which add/remove device nodes.
Because udev operates asynchronously, we found errors which were caused by a previous command (eg. sfdisk or pvremove) creating or removing a device, and that change not having happened by the time the next command was run. This patch adds calls to '/sbin/udevadm settle' after any commands which can add or remove device nodes. If udev is not being used or not available, this should have no effect. The command fails and this is silently ignored.
Diffstat (limited to 'daemon/lvm.c')
-rw-r--r--daemon/lvm.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/daemon/lvm.c b/daemon/lvm.c
index 143c5a81..0fba4477 100644
--- a/daemon/lvm.c
+++ b/daemon/lvm.c
@@ -187,6 +187,9 @@ do_pvcreate (char *device)
}
free (err);
+
+ udev_settle ();
+
return 0;
}
@@ -221,6 +224,9 @@ do_vgcreate (char *volgroup, char **physvols)
}
free (err);
+
+ udev_settle ();
+
return 0;
}
@@ -243,6 +249,9 @@ do_lvcreate (char *logvol, char *volgroup, int mbytes)
}
free (err);
+
+ udev_settle ();
+
return 0;
}
@@ -331,6 +340,8 @@ do_lvm_remove_all (void)
}
free_strings (xs);
+ udev_settle ();
+
/* There, that was easy, sorry about your data. */
return 0;
}
@@ -352,6 +363,9 @@ do_lvremove (char *device)
}
free (err);
+
+ udev_settle ();
+
return 0;
}
@@ -370,6 +384,9 @@ do_vgremove (char *device)
}
free (err);
+
+ udev_settle ();
+
return 0;
}
@@ -390,6 +407,9 @@ do_pvremove (char *device)
}
free (err);
+
+ udev_settle ();
+
return 0;
}
@@ -442,6 +462,9 @@ do_vg_activate (int activate, char **volgroups)
}
free (err);
+
+ udev_settle ();
+
return 0;
}