Displaying 20 results from an estimated 75 matches for "udev_settle".
2017 Mar 02
2
[PATCH] parted: add more udev_settle calls.
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
wih...
2012 Feb 06
2
[PATCH 1/2] Revert "daemon: Run udev_settle after pwrite-device finishes."
...en and
- * can cause other operations to fail, notably BLKRRPART. 'settle'
- * flag is only set on block devices.
- *
- * XXX We should be smarter about when we do this or should get rid
- * of the udev rules since we don't use blkid in cached mode.
- */
- if (settle)
- udev_settle ();
-
return r;
}
@@ -575,7 +563,7 @@ do_pwrite (const char *path, const char *content, size_t size, int64_t offset)
return -1;
}
- return pwrite_fd (fd, content, size, offset, path, 0);
+ return pwrite_fd (fd, content, size, offset, path);
}
int
@@ -593,7 +581,7 @@ do_pwrite_...
2015 Oct 05
1
[PATCH] daemon: use str_udevadm in udev_settle
...ly used when
starting udevadm.
There should be no behaviour change.
---
daemon/guestfsd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 7b33a3a..4502190 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -1501,7 +1501,8 @@ udev_settle (void)
char cmd[80];
int r;
- snprintf (cmd, sizeof cmd, "udevadm%s settle", verbose ? " --debug" : "");
+ snprintf (cmd, sizeof cmd, "%s%s settle",
+ str_udevadm, verbose ? " --debug" : "");
if (verbose)
print...
2017 Jul 14
0
[PATCH 10/27] daemon: Reimplement ‘part_get_mbr_id’ API in OCaml.
...1");
- return -1;
- }
-
- const char *param = test_sfdisk_has_part_type () ? "--part-type" : "--print-id";
-
- char partnum_str[16];
- snprintf (partnum_str, sizeof partnum_str, "%d", partnum);
-
- CLEANUP_FREE char *out = NULL, *err = NULL;
- int r;
-
- udev_settle ();
-
- r = command (&out, &err, str_sfdisk, param, device, partnum_str, NULL);
- if (r == -1) {
- reply_with_error ("sfdisk %s: %s", param, err);
- return -1;
- }
-
- udev_settle ();
-
- /* It's printed in hex ... */
- unsigned id;
- if (sscanf (out, "%x&quo...
2015 Jan 28
1
[PATCH] daemon: parted: use --part-type with recent sfdisk
...eturn -1;
}
+ const char *param = test_sfdisk_has_part_type () ? "--part-type" : "--print-id";
+
char partnum_str[16];
snprintf (partnum_str, sizeof partnum_str, "%d", partnum);
@@ -703,9 +729,9 @@ do_part_get_mbr_id (const char *device, int partnum)
udev_settle ();
- r = command (&out, &err, str_sfdisk, "--print-id", device, partnum_str, NULL);
+ r = command (&out, &err, str_sfdisk, param, device, partnum_str, NULL);
if (r == -1) {
- reply_with_error ("sfdisk --print-id: %s", err);
+ reply_with_error ("...
2017 Apr 12
0
Re: [PATCH 1/2] daemon: run 'udevadm settle' with --exit-if-exists option
On Wed, Apr 12, 2017 at 05:01:10PM +0300, Pavel Butsykin wrote:
> Add udev_settle_file() to run 'udevadm settle' with --exit-if-exists option. It
> will slightly reduce the waiting-time for pending events if we need to wait
> for events related to a particular device/file.
>
> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
> ---
> daemo...
2017 Jul 29
5
[PATCH 1/1] New partition API: part_resize
...ar partnum_str[16];
+
+ if (partnum <= 0) {
+ reply_with_error ("partition number must be >= 1");
+ return -1;
+ }
+
+ snprintf (partnum_str, sizeof partnum_str, "%d", partnum);
+ snprintf (endstr, sizeof endstr, "%" PRIi64 "s", endsect);
+
+ udev_settle ();
+
+ r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
+ "parted", "-s", "--", device, "resizepart", partnum_str,
+ endstr, NULL);
+ if (r == -1) {
+ reply_with_error ("parted: %s: %s:", device,...
2012 Feb 06
2
[PATCH 0/2] Work-around blkid running from udev after device close.
...two places (although I'm fairly
certain it affects many more):
- in virt-resize, after copy_device_to_device and before
part_set_bootable (which runs parted)
- in virt-format, after wiping the device (which writes zeroes then
closes it) and before blockdev_rereadpt
The fix is to run udev_settle *before* all blockdev, parted and sfdisk
commands. Note we do it before because at this point a blkid command
may be running which we have to wait for. None of these commands
should be performance sensitive (unlike pwrite_device, where I have
removed the udev_settle call).
In the parted and sfdi...
2014 Jun 04
3
virt-resize: support to MBR logical partitions and some question
Hi,
I'm adding support to resizing logical partitions(patch is in progess).
But encounter an error when adding a logical partition in dest image:
virt-resize: libguestfs error: part_add: parted: /dev/sdb: Warning: The resulting partition is not properly aligned for best performance.
Error: Error informing the kernel about modifications to partition /dev/sdb5 -- Device or resource busy.
2017 Jul 19
2
Re: [PATCH 02/27] daemon: Allow parts of the daemon and APIs to be written in OCaml.
...;caml/callback.h>
> +#include <caml/mlvalues.h>
> +#include <caml/unixsupport.h>
> +
> #include "sockets.h"
> #include "c-ctype.h"
> #include "ignore-value.h"
> @@ -348,6 +352,9 @@ main (int argc, char *argv[])
> */
> udev_settle ();
>
> + /* Initialize the OCaml stubs. */
> + caml_startup (argv);
> +
> /* Send the magic length message which indicates that
> * userspace is up inside the guest.
> */
> @@ -1205,3 +1212,46 @@ cleanup_free_mountable (mountable_t *mountable)
> free...
2015 Jun 30
0
[PATCH v4 5/7] daemon: add get_random_uuid
...gelist.in
@@ -97,6 +97,7 @@ dnl iproute has been renamed to iproute2
vim-tiny
xz-utils
zfs-fuse
+ uuid-runtime
)
ifelse(ARCHLINUX,1,
diff --git a/daemon/daemon.h b/daemon/daemon.h
index d8a5e0b..f8441d1 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -152,6 +152,8 @@ extern void udev_settle (void);
extern int random_name (char *template);
+extern char *get_random_uuid (void);
+
/* This just stops gcc from giving a warning about our custom printf
* formatters %Q and %R. See guestfs(3)/EXTENDING LIBGUESTFS for more
* info about these. In GCC 4.8.0 the warning is even harder...
2017 Apr 13
0
Re: [PATCH v2 1/2] daemon: run 'udevadm settle' with --exit-if-exists option
On Thursday, 13 April 2017 16:55:26 CEST Pavel Butsykin wrote:
> Add udev_settle_file() to run 'udevadm settle' with --exit-if-exists option. It
> will slightly reduce the waiting-time for pending events if we need to wait
> for events related to a particular device/file.
>
> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
> ---
> daemo...
2017 Jul 30
0
Re: [PATCH 1/1] New partition API: part_resize
...;= 0) {
> + reply_with_error ("partition number must be >= 1");
> + return -1;
> + }
> +
> + snprintf (partnum_str, sizeof partnum_str, "%d", partnum);
> + snprintf (endstr, sizeof endstr, "%" PRIi64 "s", endsect);
> +
> + udev_settle ();
> +
> + r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
> + "parted", "-s", "--", device, "resizepart", partnum_str,
> + endstr, NULL);
> + if (r == -1) {
> + reply_with_error ("p...
2018 Jan 15
6
[PATCH v2 0/3] copying gpt attributes
Hi all,
Here is the latest version of the series addressing Pino's comments.
Cédric Bosdonnat (3):
daemon: make sgdisk_info_extract_uuid_field more generic
New APIs: part_set_gpt_attributes and part_get_gpt_attributes
resize: copy GPT partition flags
daemon/parted.ml | 45 +++++++++++++++++++++++++++++++++++----------
daemon/parted.mli | 3 +++
2018 Jan 16
0
[PATCH v3 2/3] New APIs: part_set_gpt_attributes and part_get_gpt_attributes
...en Std_utils
@@ -124,10 +125,29 @@ let part_get_parttype device =
| _ ->
failwithf "%s: cannot parse the output of parted" device
+let part_set_gpt_attributes device partnum attributes =
+ if partnum <= 0 then failwith "partition number must be >= 1";
+
+ udev_settle ();
+
+ let arg = sprintf "%d:=:%LX" partnum attributes in
+ let r, _, err =
+ commandr ~fold_stdout_on_stderr:true
+ "sgdisk" [ device; "-A"; arg ] in
+ if r <> 0 then
+ failwithf "sgdisk: %s" err;
+
+ udev_settle ()
+
let extrac...
2018 Jan 15
0
[PATCH v2 2/3] New APIs: part_set_gpt_attributes and part_get_gpt_attributes
...emon/parted.ml
@@ -124,10 +124,30 @@ let part_get_parttype device =
| _ ->
failwithf "%s: cannot parse the output of parted" device
+let part_set_gpt_attributes device partnum attributes =
+ if partnum <= 0 then failwith "partition number must be >= 1";
+
+ udev_settle ();
+
+ let hex = Printf.sprintf "%LX" attributes in
+ let arg = string_of_int partnum ^ ":=:" ^ hex in
+ let r, _, err =
+ commandr ~fold_stdout_on_stderr:true
+ "sgdisk" [ device; "-A"; arg ] in
+ if r <> 0 then
+ failwithf "...
2018 Jan 16
4
[PATCH v3 0/3] copy GPT attributes
Hi all,
Here is v3 of the series, taking Richard's comments in account.
Cédric Bosdonnat (3):
daemon: make sgdisk_info_extract_uuid_field more generic
New APIs: part_set_gpt_attributes and part_get_gpt_attributes
resize: copy GPT partition flags
daemon/parted.ml | 45 +++++++++++++++++++++++++++++++++++----------
daemon/parted.mli | 2 ++
generator/actions_core.ml
2018 Jan 10
0
[PATCH 2/3] New APIs: part_set_gpt_attributes and part_get_gpt_attributes
...get_parttype device =
| _ ->
failwithf "%s: cannot parse the output of parted" device
-let hex_chars = "0123456789ABCDEF"
+let part_set_gpt_attributes device partnum attributes =
+ if partnum <= 0 then failwith "partition number must be >= 1";
+
+ udev_settle ();
+
+ let arg = string_of_int partnum ^ ":=:" ^ attributes in
+ let r, _, err =
+ commandr ~fold_stdout_on_stderr:true
+ "sgdisk" [ device; "-A"; arg ] in
+ if r <> 0 then
+ failwithf "sgdisk: %s" err;
+
+ udev_settle ()
let r...
2017 Jul 14
0
[PATCH 20/27] daemon: Reimplement ‘part_list’ API in OCaml.
...have [--part-type], to be used
* instead of [--print-id] and [--change-id].
*)
@@ -53,3 +55,52 @@ let part_get_mbr_id device partnum =
(* It's printed in hex, possibly with a leading space. *)
sscanf out " %x" identity
+
+let print_partition_table ~add_m_option device =
+ udev_settle ();
+
+ let args = ref [] in
+ if add_m_option then push_back args "-m";
+ push_back args "-s";
+ push_back args "--";
+ push_back args device;
+ push_back args "unit";
+ push_back args "b";
+ push_back args "print";
+
+ let out =...
2018 Jan 10
6
[PATCH 0/3] Handle GPT attribute flags
Hi all,
Here is the series fixing the bug I mentioned on IRC regarding the GPT
attribute flags to copy to the new disk in a virt-resize.
Cédric Bosdonnat (3):
daemon: make sgdisk_info_extract_uuid_field more generic
New APIs: part_set_gpt_attributes and part_get_gpt_attributes
resize: copy GPT partition flags
daemon/parted.ml | 34 +++++++++++++++++++++++++++-------