add udev_settle calls to print_partition_table and
sgdisk_info_extract_field because the inspect-os calls
guestfs_part_get_parttype and guestfs_part_get_gpt_guid for all
parition devices found and this causes intermittent with opening block
devices that are certainly present yet RESOLVE_DEVICE macro would fail
wiht ENOENT.
---
daemon/parted.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/daemon/parted.c b/daemon/parted.c
index 124d1e9..03e83cb 100644
--- a/daemon/parted.c
+++ b/daemon/parted.c
@@ -320,6 +320,8 @@ print_partition_table (const char *device, bool add_m_option)
CLEANUP_FREE char *err = NULL;
int r;
+ udev_settle ();
+
if (add_m_option)
r = command (&out, &err, str_parted, "-m", "-s",
"--", device,
"unit", "b",
@@ -328,6 +330,9 @@ print_partition_table (const char *device, bool add_m_option)
r = command (&out, &err, str_parted, "-s", "--", device,
"unit", "b",
"print", NULL);
+
+ udev_settle ();
+
if (r == -1) {
int errcode = 0;
@@ -665,6 +670,8 @@ sgdisk_info_extract_field (const char *device, int partnum, const char
*field,
return NULL;
}
+ udev_settle ();
+
CLEANUP_FREE char *err = NULL;
int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
str_sgdisk, device, "-i", partnum_str, NULL);
@@ -674,6 +681,8 @@ sgdisk_info_extract_field (const char *device, int partnum, const char
*field,
return NULL;
}
+ udev_settle ();
+
CLEANUP_FREE_STRING_LIST char **lines = split_lines (err);
if (lines == NULL) {
reply_with_error ("'%s %s -i %i' returned no output",
--
2.9.3