On Wed, Jun 17, 2015 at 07:50:11PM +0100, Richard W.M. Jones wrote:
On Wed, Jun 17, 2015 at 05:23:53PM +0100, Richard W.M. Jones wrote:
> See:
https://bugzilla.redhat.com/show_bug.cgi?id=1232241#c3
> ---
> daemon/parted.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/daemon/parted.c b/daemon/parted.c
> index a36e4e7..59760b4 100644
> --- a/daemon/parted.c
> +++ b/daemon/parted.c
> @@ -356,7 +356,7 @@ print_partition_table (const char *device,
> int r;
>
> if (PARTED_OPT_HAS_M == parted_has_m_opt)
> - r = command (&out, &err, str_parted, "-m", "--",
device,
> + r = command (&out, &err, str_parted, "-m", "-s",
"--", device,
> "unit", "b",
> "print", NULL);
This breaks virt-alignment-scan. Not sure why yet.
It happens because adding -s changes the exit code of parted, so a
previously hidden error is exposed, and that in turn breaks the
part-list command when used on a blank disk.
$ parted -m -s -- tests/guests/blank-disk.img unit b print
Error: /home/rjones/d/libguestfs/tests/guests/blank-disk.img: unrecognised disk label
BYT;
/home/rjones/d/libguestfs/tests/guests/blank-disk.img:104857600B:file:512:512:unknown::;
$ echo $?
1
$ parted -m -- tests/guests/blank-disk.img unit b print
WARNING: You are not superuser. Watch out for permissions.
Error: /home/rjones/d/libguestfs/tests/guests/blank-disk.img: unrecognised disk
label
BYT;
/home/rjones/d/libguestfs/tests/guests/blank-disk.img:104857600B:file:512:512:unknown::;
$ echo $?
0
This is why I hate parted.
Anyway, I will post a v2 patch with this problem fixed.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v