Bug 1262491

Summary: virt-builder fail to resize or recognize coreos
Product: Red Hat Enterprise Linux 7 Reporter: Darius Clark <darius.clark>
Component: libguestfsAssignee: Pino Toscano <ptoscano>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.1CC: darius.clark, esandeen, linl, ptoscano, xchen
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1262621 (view as bug list) Environment:
Last Closed: 2016-02-18 09:30:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1262621, 1288337, 1301891    
Attachments:
Description Flags
Log showing error when trying to resize within virt-builder
none
Log that shows what happens without a size argument
none
log showing error with virt-customize and coreos. none

Description Darius Clark 2015-09-11 22:52:03 UTC
Created attachment 1072653 [details]
Log showing error when trying to resize within virt-builder

Description of problem:

When running virt-builder with a coreos image, it fails to resize the image according to the size that was given, or if none was give, it fails to recognize the OS, even if virt-inspector recognize the OS.

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


How reproducible: 100%


Steps to Reproduce:
1. Run: "virt-builder -v -x --no-check-signature coreos-stable --format raw -o /tmp/temp-test.img --hostname coreos --no-logfile --size 10G" or "virt-builder -v -x --no-check-signature coreos-stable --format raw -o /tmp/temp-test.img --hostname coreos --no-logfile"


Actual results:

See following attachments.

Additional info:

I am able to resize the images manually with virt-resize but however I am unable to use virt-customize with coreos.

Comment 1 Darius Clark 2015-09-11 22:53:11 UTC
Created attachment 1072654 [details]
Log that shows what happens without a size argument

Comment 3 Richard W.M. Jones 2015-09-12 07:16:58 UTC
The error is:

/dev/sda: Error: /dev/sda: unrecognised disk label

which indicates that the disk image is not recognized -- it might be
compressed, or it might be in the wrong format (eg. qcow2 when you've
told virt-builder that the format is raw, or vice versa).

I grabbed http://stable.release.core-os.net/amd64-usr/current/coreos_production_qemu_image.img.bz2
bunzipped it, and used virt-inspector (1.31.5) on it, and that
found the basic OS, and it also has a valid partition table.

Anyway I suspect the input image (/etc/xdg/virt-builder/repos.d/coreos-stable.xz)
is still bzip2 compressed.  You would have to uncompress it before
recompressing it with xz.  (Or I guess you could patch virt-builder
to understand bzip2 compression, but for disk images it makes no sense
as xz is in all ways a better format for disk images).

Comment 4 Darius Clark 2015-09-12 12:43:09 UTC
Hmm the image have been decompressed before it was compressed with xz. The only thing I could possibly think of is that image itself is the format but i would assume that coreos image is raw and not qcow2 but i could double check.

Comment 5 Darius Clark 2015-09-12 13:08:49 UTC
Just to update, it is still giving the same error when changing the format but virt-resize itself is able to resize the image with no problem. Going to dig into virt-builder abit more and see whats going on. Also just to let you know when trying to modify the image with virt-customize, i do get an error as well so maybe its something with libguestfs itself (though it shouldnt be)?

Comment 6 Darius Clark 2015-09-12 13:48:14 UTC
Created attachment 1072716 [details]
log showing error with virt-customize and coreos.

Comment 7 Richard W.M. Jones 2015-09-12 22:15:22 UTC
The virt-customize error (and possibly also therefore the virt-builder
error) is:

[    2.838285] EXT4-fs (sda3): couldn't mount RDWR because of unsupported optional features (ff000000)

This might happen for example because your host is RHEL/CentOS 6
and coreos uses new filesystem features which that old host kernel
doesn't support.  The only solution to that would be to upgrade
the host unfortunately (this is also pretty much the same reason why
we force everyone using virt-v2v to use the latest RHEL host).

I tried to look at what features these correspond to, but these
high bits aren't even mentioned in the latest upstream kernel.  So
either I'm reading the kernel code wrong, or this guest is using
some very strange (non-upstream???) features ...

Comment 8 Richard W.M. Jones 2015-09-13 15:53:32 UTC
For all discussion about the "unsupported optional features" problem,
please use bug 1262621.

For virt-builder, what metadata (index.asc) are you using?  The CoreOS
image turns out to be in qcow2 format; but according to the first log
file, you told virt-builder that the format was raw, so it wouldn't
perform the correct sequence of operations.

Comment 9 Darius Clark 2015-09-13 17:23:24 UTC
This morning I did find out that it was qcow2 (qemu-img info) so i did change the data/format in index.asc (coreos used to be raw in the past and after updating the image i guess i assumed it was still raw but guess it changed at some point in time). I would assume that the format would be converted to raw as it stated in the documents but I guess thats only if the format is correct in index.asc.

Comment 10 Pino Toscano 2015-09-23 15:40:43 UTC
Reading the discussion, it seems like the CoreOS image could not be mounted because of bug 1262621.  Otherwise, libguestfs (since 1.29.45) should support the inspection of CoreOS images.

Regarding the virt-builder image format issue, I read they were fixed by putting format=qcow2 in the virt-builder index.

Are there any issues left?  If so, please paste a logs.

Comment 11 Xianghua Chen 2016-02-18 09:30:09 UTC
I can't reproduce it with the following steps:
1. Download from:
http://stable.release.core-os.net/amd64-usr/current/coreos_production_qemu_image.img.bz2
2. bunzip2 coreos_production_qemu_image.img.bz2
3. cp coreos_production_qemu_image.img /var/run/guestfs-autotest/images/
4. vim /var/run/guestfs-autotest/images/index.asc
[coreos]
name=coreos
osinfo=coreos
arch=x86_64
file=coreos_production_qemu_image
format=qcow2
size=9116319744
notes=coreos
5.virt-builder -v -x --no-check-signature coreos --format raw -o /tmp/temp-test.img --hostname coreos --no-logfile --size 10G
6.virt-builder -v -x --no-check-signature coreos --format raw -o /tmp/temp-test.img --hostname coreos --no-logfile

Step 5&6 can be executed correctly. 
I tried to modify format=qcow2 to format=raw in /var/run/guestfs-autotest/images/index.asc, it will print the error as the attachment. So, this error is confirmed to because of the wrong configure problem, I'll close it as not-a-bug if there is no more issue. 
Thanks.