search for: partnum

Displaying 20 results from an estimated 202 matches for "partnum".

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 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 +++++++++++++++++++++++++++-------
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
...dex cf1a54a08..5f553c2da 100644 --- a/daemon/parted.ml +++ b/daemon/parted.ml @@ -124,7 +124,19 @@ let part_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...
2014 Sep 22
0
[PATCH v3 4/7] resize: add function calculate_target_partitions
.../resize.ml b/resize/resize.ml index cfd02fc..8b43306 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -1019,11 +1019,10 @@ read the man page virt-resize(1). * the final list just contains partitions that need to be created * on the target. *) - let partitions = - let rec loop partnum start = function + let rec calculate_target_partitions partnum start ~create_surplus = function | p :: ps -> (match p.p_operation with - | OpDelete -> loop partnum start ps (* skip p *) + | OpDelete -> calculate_target_partitions partnum start ~create_surpl...
2018 Jan 16
0
[PATCH v3 2/3] New APIs: part_set_gpt_attributes and part_get_gpt_attributes
...100644 --- a/daemon/parted.ml +++ b/daemon/parted.ml @@ -17,6 +17,7 @@ *) open Scanf +open Printf open 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&quot...
2018 Jan 15
0
[PATCH v2 2/3] New APIs: part_set_gpt_attributes and part_get_gpt_attributes
...-git a/daemon/parted.ml b/daemon/parted.ml index 6fe803613..e3ab823bd 100644 --- a/daemon/parted.ml +++ b/daemon/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...
2018 Jan 15
0
[PATCH v2 1/3] daemon: make sgdisk_info_extract_uuid_field more generic
...--git a/daemon/parted.ml b/daemon/parted.ml index d6638867a..6fe803613 100644 --- a/daemon/parted.ml +++ b/daemon/parted.ml @@ -124,12 +124,11 @@ let part_get_parttype device = | _ -> failwithf "%s: cannot parse the output of parted" device -let rec part_get_gpt_type device partnum = - sgdisk_info_extract_uuid_field device partnum "Partition GUID code" -and part_get_gpt_guid device partnum = - sgdisk_info_extract_uuid_field device partnum "Partition unique GUID" +let extract_guid value = + (* The value contains only valid GUID characters. *) + String.s...
2015 Jan 28
1
[PATCH] daemon: parted: use --part-type with recent sfdisk
...- daemon/parted.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/daemon/parted.c b/daemon/parted.c index 8fbb6e4..2f10144 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -681,6 +681,30 @@ do_part_get_bootable (const char *device, int partnum) } } +/* Test if sfdisk is recent enough to have --part-type, to be used instead + * of --print-id and --change-id. + */ +static int +test_sfdisk_has_part_type (void) +{ + static int tested = -1; + + if (tested != -1) + return tested; + + int r; + CLEANUP_FREE char *out = NULL, *err =...
2015 Mar 17
4
[PATCH] New API: part_get_part_type for showing partition type
...tr_parted, parted); GUESTFSD_EXT_CMD(str_sfdisk, sfdisk); GUESTFSD_EXT_CMD(str_sgdisk, sgdisk); +#ifndef PARTED_NO_M +# define PARTED_NO_M 0 +#endif + /* Notes: * * Parted 1.9 sends error messages to stdout, hence use of the @@ -1022,3 +1026,111 @@ do_part_get_name (const char *device, int partnum) reply_with_error ("cannot get the partition name from '%s' layouts", parttype); return NULL; } + +char * +do_part_get_part_type (const char *device, int partnum) +{ + CLEANUP_FREE char *parttype; + char *part_type; + + if (partnum <= 0) { + reply_with_error (&quot...
2015 Feb 05
5
resize: Preserve GPT GUID so we don't break EFI bootloaders (RHBZ#1189284)
virt-resize didn't preserve the per-partition GPT GUID. Now that guests using UEFI are becoming common (basically it's the default on aarch64) we need to take into account that sometimes the partition GUID is used by the bootloader NVRAM variables to identify the boot partition, so it must be preserved across resize. This bug caused the 'virt-builder --size' option to fail on
2018 Jan 10
0
[PATCH 1/3] daemon: make sgdisk_info_extract_uuid_field more generic
...ex d6638867a..cf1a54a08 100644 --- a/daemon/parted.ml +++ b/daemon/parted.ml @@ -124,12 +124,16 @@ let part_get_parttype device = | _ -> failwithf "%s: cannot parse the output of parted" device +let hex_chars = "0123456789ABCDEF" + let rec part_get_gpt_type device partnum = - sgdisk_info_extract_uuid_field device partnum "Partition GUID code" + sgdisk_info_extract_field device partnum "Partition GUID code" + ("-" ^ hex_chars) and part_get_gpt_guid device partnum = - sgdisk_info_extract_uuid_field device pa...
2014 Sep 22
13
[PATCH v3 0/7] add support to resize MBR logical partitions
Hi Rich, This is v3 series to add support for resizing MBR logical partitions. changes to v2: 1. remove p_part_num 2. remove filter_parts 3. name the function calculate_target_partitions 4. remove the code to restart guest introduced in v2 changes to v1: 1. spit the patches so it's easier to review 2. fix the parted error caused by unaligned logical partitions 3. extend the
2012 Feb 06
2
[PATCH 1/2] Revert "daemon: Run udev_settle after pwrite-device finishes."
From: "Richard W.M. Jones" <rjones at redhat.com> This reverts commit a9c8123c72db47bcab8dd738e8d5256a9ae87f11. --- daemon/file.c | 18 +++--------------- daemon/parted.c | 3 +-- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/daemon/file.c b/daemon/file.c index 057e15d..91746e0 100644 --- a/daemon/file.c +++ b/daemon/file.c @@ -525,7 +525,7 @@
2018 Jan 28
0
[PATCH v3 1/3] daemon: Reimplement 'part_get_mbr_part_type' API in OCaml.
...arted.mli | 2 + generator/actions_core.ml | 1 + 4 files changed, 17 insertions(+), 106 deletions(-) diff --git a/daemon/parted.c b/daemon/parted.c index e5435b5..d67c6c5 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -602,112 +602,6 @@ do_part_get_name (const char *device, int partnum) } } -char * -do_part_get_mbr_part_type (const char *device, int partnum) -{ - CLEANUP_FREE char *parttype; - char *part_type; - - parttype = do_part_get_parttype (device); - if (parttype == NULL) - return NULL; - - /* machine parseable output by 'parted -m' did not provide -...
2014 Feb 04
0
[PATCH 1/3] daemon: parted: refactor sgdisk info parsing code
....c | 53 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/daemon/parted.c b/daemon/parted.c index bd81986..5282adb 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -784,8 +784,9 @@ do_part_set_gpt_type(const char *device, int partnum, const char *guid) return 0; } -char * -do_part_get_gpt_type(const char *device, int partnum) +static char * +sgdisk_info_extract_field (const char *device, int partnum, const char *field, + char *(*extract) (const char *path)) { if (partnum <= 0) { reply...
2012 Dec 14
1
[PATCH] Add support for getting and setting GPT partition type GUIDs
...ted.c index cc9a84b..01ae91c 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -30,6 +30,7 @@ GUESTFSD_EXT_CMD(str_parted, parted); GUESTFSD_EXT_CMD(str_sfdisk, sfdisk); +GUESTFSD_EXT_CMD(str_sgdisk, sgdisk); /* Notes: * @@ -802,3 +803,131 @@ do_part_set_mbr_id (const char *device, int partnum, int idbyte) return 0; } + +int +do_part_set_gpt_type(const char *device, int partnum, const char *guid) +{ + if (partnum <= 0) { + reply_with_error ("partition number must be >= 1"); + return -1; + } + + char *typecode = NULL; + if (asprintf (&typecode, "%i...
2014 Feb 04
6
[PATCH 0/3] virt-resize: preserve GPT partitions label
Hi, attached there are few patches to implement a way to get the label of GPT partitions (refactoring an existing function and adding a new daemon API) and using it in virt-resize to restore them when copying partitions. Thanks, Pino Toscano (3): daemon: parted: refactor sgdisk info parsing code New API: part-get-name (RHBZ#593511). resize: preserve GPT partition names (RHBZ#1060404).
2017 Jul 29
5
[PATCH 1/1] New partition API: part_resize
...nerator/proc_nr.ml | 1 + lib/MAX_PROC_NR | 2 +- 4 files changed, 55 insertions(+), 1 deletion(-) diff --git a/daemon/parted.c b/daemon/parted.c index 72e1b8420..f1205cadf 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -178,6 +178,37 @@ do_part_del (const char *device, int partnum) } int +do_part_resize (const char *device, int partnum, int64_t endsect) +{ + int r; + CLEANUP_FREE char *err = NULL; + char endstr[32]; + char partnum_str[16]; + + if (partnum <= 0) { + reply_with_error ("partition number must be >= 1"); + return -1; + } + + snpri...
2018 Jan 28
9
guestfs_list_filesystems: skip block devices which cannot hold file system
Initial discussion is here: https://www.redhat.com/archives/libguestfs/2018-January/msg00188.html. v2 was posted here: https://www.redhat.com/archives/libguestfs/2018-January/msg00246.html. v3 comparing to v2 is just a rebase with slightly changed commits comments.