nova writes libvirt xml 'driver_type' based only on FLAGS.use_cow_images

Bug #837102 reported by Scott Moser
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Unassigned

Bug Description

This is just from reading code, so I could be wrong.
However, in _prepare_xml_info() of nova/virt/libvirt/connection.py you have:
        if FLAGS.use_cow_images:
            driver_type = 'qcow2'
        else:
            driver_type = 'raw'

It seems that that will be wrong in the case that the image uploaded is qcow2.

_cache_image will have done a 'cp' of the original image, and thus the image will still be in qcow format.

I've not verified whether or not libvirt/kvm care, or if this is only grammatical.

Related branches

Revision history for this message
Vish Ishaya (vishvananda) wrote : Re: [Bug 837102] [NEW] nova writes libvirt xml 'driver_type' based only on FLAGS.use_cow_images

This is true, however uploading a qcow2 works fine so I assume that libvirt is smart enough to load it correctly anyway.

Revision history for this message
Scott Moser (smoser) wrote :

On Tue, 30 Aug 2011, Vish Ishaya wrote:

> This is true, however uploading a qcow2 works fine so I assume that
> libvirt is smart enough to load it correctly anyway.

Have you tried uploading a qcow2 without LFAGS.use_cow_images ?

Also, i'm not certain but looking at bug 470636 (comment 18 and 19) it
seems that this will be an issue with libvirt's apparmor support.

Scott

Revision history for this message
Vish Ishaya (vishvananda) wrote :

On Aug 30, 2011, at 6:50 AM, Scott Moser wrote:

> Have you tried uploading a qcow2 without LFAGS.use_cow_images ?

No, I haven't tried that, good point.
>
> Also, i'm not certain but looking at bug 470636 (comment 18 and 19) it
> seems that this will be an issue with libvirt's apparmor support.

Yes, we should probably attempt to determine the type of the image and change the xml to match.

>
> Scott
>

Changed in nova:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Scott Moser (smoser) wrote :

OK.
  I verified that the following fails
 - $ grep cow bin/nova.conf
   --use_cow_images=false
 - $ wget http://images.ansolabs.com/tty.tgz
 - $ tar -xvzf tty.tgz
 - $ qemu-img convert ami-tty/image -O qcow2 ami-tty/image-qcow.img
 - $ cloud-publish-image x86_64 ami-tty/image-qcow.img demo
 - $ euca-run-instances ami-0000002f --key mykey
 - there is nothing in the console looking at the console , looking at the vnc console, shows 'no bootable device'

What this means is that if you upload a qcow image, but have turned off use_qcow_images (default is on) then your instances will not boot. I would suspect that most "real world" installations will have use_qcow_images=false in flags as the run time path will be faster for raw disk imags than qcow.

I've also verified that I was wrong in suspecting that apparmour would be the issue. Apparmour doesn't affect this because the image booted would never be a qcow backed image (as it would be a copy of the uploaded image since use_qcow_images=false). However, it seems that kvm intelligently respects the argument that is passed to it via libvirt. for reference, that looks Note the 'format=raw' (like):

  -drive file=<path>,if=none,id=drive-virtio-disk0,boot=on,format=raw
  -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0

So, this is a real issue.

Revision history for this message
Scott Moser (smoser) wrote :

My test that I did in comment 2 above was wrong, as I did not register a kernel/ramdisk with this image.
I've re-tested with something like:
  cloud-publish-image x86_64 md-raw/image-root.img smdemo-raw \
     --kernel-file md-raw/image-kernel.img --ramdisk-file md-raw/image-ramdisk.img -v
and
  cloud-publish-image x86_64 md/image-root-qcow.img smdemo \
    --kernel-file md/image-kernel.img --ramdisk-file md/image-ramdisk.img -v

using the qcow image, I actually fail with a 'badness occurred in ramdisk' which makes no sense to me, but it failed none the less.

Changed in nova:
status: Triaged → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → 2011.3
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.