Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be unavailable on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 815149 - virt-alignment-scan gives error "part_list: could not parse row from output of parted print command: /dev/vda:4194304B:virtblk:512:512:msdos:Virtio Block Device"
Summary: virt-alignment-scan gives error "part_list: could not parse row from output o...
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs
Version: 6.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 717319
TreeView+ depends on / blocked
 
Reported: 2012-04-22 22:18 UTC by Richard W.M. Jones
Modified: 2013-09-27 09:03 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-27 09:03:54 UTC
Target Upstream Version:


Attachments (Terms of Use)
test.img.xz (764 bytes, application/x-xz)
2012-04-22 22:18 UTC, Richard W.M. Jones
no flags Details

Description Richard W.M. Jones 2012-04-22 22:18:21 UTC
Created attachment 579367 [details]
test.img.xz

Description of problem:

On RHEL 6.3, run virt-alignment-scan on the attached disk image.
It prints:

$ unxz test.img.xz
$ virt-alignment-scan -a test.img
libguestfs: error: part_list: could not parse row from output of parted print command: /dev/vda:4194304B:virtblk:512:512:msdos:Virtio Block Device;

Version-Release number of selected component (if applicable):

libguestfs-1.16.18-2.el6.x86_64

How reproducible:

100%

Comment 1 Richard W.M. Jones 2012-04-22 22:21:03 UTC
This works fine on Fedora 17:

$ virt-alignment-scan -a test.img 
/dev/sda1        65536           64K   ok

libguestfs-1.17.32-1.fc17.x86_64
parted-3.0-7.fc17.x86_64

Comment 2 Richard W.M. Jones 2012-04-23 10:07:42 UTC
The two commands that run in RHEL 6 are:

  parted -s -m /dev/null
  parted -m -- /dev/vda unit b print

The first command is used to test whether the -m option
works in this version of parted.  The output on RHEL 6 is:

  $ parted -s -m /dev/null
  Error: The device /dev/null has zero length, and can't possibly store a file system or partition table.  Perhaps you selected the wrong device?
  Warning: Error fsyncing/closing /dev/null: Invalid argument

(ie. -m is supported).  The second command is used to fetch
the partition table.  /dev/vda there refers to the device containing
'test.img'.  Running the same command in virt-rescue gives:

  ><rescue> parted -m -- /dev/vda unit b print
  Error: Can't have the end before the start! (start sector=16065 length=-7873)
  BYT;
  /dev/vda:4194304B:virtblk:512:512:msdos:Virtio Block Device;
  1:65536B:4194303B:4128768B:::;

(Note that the error message goes to stdout, FFS).

So that reveals why we can't parse the output.

Note there is no error when the same command is run on the same
image on Fedora 17.

Comment 3 Richard W.M. Jones 2012-04-23 12:06:13 UTC
I had a long comment written here about how this was a bug in sfdisk
but I noticed I can reproduce exactly the same problem using parted
alone:

$ rm -f test2.img ; truncate -s 4M test2.img
$ parted -s -- test2.img mklabel msdos
$ parted -s -- test2.img mkpart primary 1s -1s
Warning: The resulting partition is not properly aligned for best performance.
$ virt-alignment-scan -a test2.img 
libguestfs: error: part_list: could not parse row from output of parted print command: /dev/vda:4194304B:virtblk:512:512:msdos:Virtio Block Device;

Comment 4 Richard W.M. Jones 2012-04-23 13:14:53 UTC
It's very hard to reproduce this bug in a standalone
test of parted, because it is triggered by the geometry
returned by the virtio-block device.  You can't reproduce
it using a simple file or a non-virtio partition.

I think the quickest way to fix this is going to
be to fix the gerrit test.  If you use a sufficiently
large file, say 1G, then you won't hit this bug at all:

$ rm -f test2.img ; truncate -s 1G test2.img
$ parted -s -- test2.img mklabel msdos

then either:

$ parted -s -- test2.img mkpart primary 1s -1s
Warning: The resulting partition is not properly aligned for best performance.

or:

$ parted -s -- test2.img mkpart primary 128s -1s
Warning: The resulting partition is not properly aligned for best performance.

then:

$ virt-alignment-scan -a test2.img 

As general advice: don't use sfdisk for anything, ever.

Comment 5 Richard W.M. Jones 2012-04-24 07:25:01 UTC
Moving to 6.4, on the basis that:

(a) Does affect a customer.
(b) Can be worked around easily by making a small change to gerrit test.
(c) "Hot" partitioning code path.
(d) Late in RHEL 6.3 for an invasive change.
(e) Doesn't affect upstream code.

Comment 6 Richard W.M. Jones 2012-04-24 07:28:27 UTC
(In reply to comment #5)
> (a) Does affect a customer.

Ummm .. Does NOT affect a customer!

Comment 8 RHEL Program Management 2012-07-10 08:08:03 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 9 RHEL Program Management 2012-07-10 23:48:33 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 10 Richard W.M. Jones 2012-09-28 12:57:03 UTC
Moving to 6.5, for the same reasons as outlined
in comment 5.

Note that this is really a bug in parted, not in
libguestfs.  If parted sent error messages to stderr
then we wouldn't have so much trouble parsing the
output.

I already sent a patch upstream (to parted) to fix
the generic parted problems without stdout vs stderr:

http://lists.alioth.debian.org/pipermail/parted-devel/2011-October/003944.html

Comment 11 Richard W.M. Jones 2013-09-27 09:03:54 UTC
Since we're probably not going to fix this in RHEL 6, and it
works in RHEL 7, I'm closing this bug.  See comment 5 for further
details.


Note You need to log in before you can comment on or make changes to this bug.