Bug 1044762

Summary: havana compute fails to create qcow2 image if xfs sectsz != 512.
Product: [Community] RDO Reporter: Joe Julian <joe>
Component: openstack-novaAssignee: RHOS Maint <rhos-maint>
Status: CLOSED CURRENTRELEASE QA Contact: Ami Jeain <ajeain>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: ndipanov, rbryant, rjones, xqueralt, yeylon
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1044763 (view as bug list) Environment:
Last Closed: 2014-01-16 13:34:28 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:
Bug Depends On: 1044763    
Bug Blocks:    

Description Joe Julian 2013-12-18 23:16:49 UTC
Description of problem:
In Fedora 19's libguestfs, qemu is started with cache=none when attempting to mount the new image in order to inject the configuration. This fails to pread the qcow2 image: pread(9, 0x7f1d44000a00, 512, 0) = -1 EINVAL (Invalid argument)

if the image is on xfs with sectsz=4096:
meta-data=/dev/mapper/fedora_ewcs9-var isize=256    agcount=49, agsize=319872 blks
         =                       sectsz=4096  attr=2
data     =                       bsize=4096   blocks=15360000, imaxpct=25
         =                       sunit=128    swidth=256 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

Version-Release number of selected component (if applicable):
libguestfs-1.22.7-1.fc19

How reproducible:
Always

Steps to Reproduce:
Install with packstack.
1. mkfs -s 4096 /dev/vgfoo/lvbar
2. mount /dev/vgfoo/lvbar /var/lib/nova/instances
3. Install with packstack
4. start openstack
5. Install an image and launch a VM from that image

Actual results:
The VM is not started. A log entry about ignoring the failure to inject data into the image is logged.

An strace revealed that qemu is being called by libguestfs attempting to use -drive file={image filename},if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=none

Attempting that same command results in the error, "Invalid argument"
A further strace reveals the EINVAL comes from pread due to the block size mismatch.

Expected results:
The data is injected and the VM starts.

Additional info:
This bug is fixed in libguestfs 1.24 because it uses writeback or unsafe depending on mode, and never uses cache=none

Comment 1 Richard W.M. Jones 2013-12-18 23:20:23 UTC
Note this is (effectively) a bug in libguestfs in F19, or if
not a bug then the fix will involve that component.

Comment 2 Richard W.M. Jones 2013-12-18 23:21:30 UTC
RHEL bug (private) is bug 999239.

Comment 3 Richard W.M. Jones 2013-12-20 22:37:02 UTC
I've backported the cachemode stuff to F19, so by default
it will now use cache=writeback, and cache=unsafe for
temporary/throwaway disks.

http://koji.fedoraproject.org/koji/taskinfo?taskID=6321380

Comment 4 Richard W.M. Jones 2013-12-20 22:41:05 UTC
Comment 3 really applies to bug 1044763, I just added the
comment to the wrong bug.

In any case, nothing needs to be changed in nova.  It'll
just be fixed automatically when libguestfs is upgraded.
In particular there is no need for nova to explicitly use
the new cachemode parameter because the new default for
disks (writeback) doesn't use O_DIRECT.

Comment 5 Xavier Queralt 2014-01-16 13:34:28 UTC
libguestfs-1.22.7-4.fc19 is in already in f19 stable (see bug 1044763).