vmbuilder XML is incomplete with libvirt 0.8.3 (No bootable devices)

Bug #659532 reported by Jamie Strandboge
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
vm-builder (Ubuntu)
Fix Released
High
Jamie Strandboge
Lucid
Fix Released
High
Jamie Strandboge
Maverick
Fix Released
High
Jamie Strandboge
Natty
Fix Released
High
Jamie Strandboge

Bug Description

Binary package hint: vmbuilder

SRU

1. libvirt 0.8.3 and later (and the upcoming libvirt update for lucid-security) does not probe qemu disks for the image format and defaults to 'raw' when the format is not specified in the XML. This breaks vmbuilder because the version in maverick does not specify a format in the XML.

WORKAROUND:
After creating, use '/usr/sbin/libvirt-migrate-qemu-disks'.

2. this is not yet fixed upstream (or Natty), but is ACKd by upstream

3. Patch adjusts VMbuilder/disk.py to have a new 'self.format_type' attribute. This attribute will normally be 'None', but will be set when a disk is convert()ed. VMbuilder/plugins/libvirt/templates/libvirtxml*.tmpl is then adjusted to supply the proper qemu image format to libvirt if the format_type is set for the disk. Since libvirt defaults to 'raw' for unspecified format types, this covers the default 'qcow2' case and avoids setting the format type when using --raw.

4a. TEST CASE 1 (in maverick release):
$ sudo vmbuilder kvm ubuntu --suite lucid --flavour virtual --arch i386 -o --libvirt qemu:///system
$ virsh start ubuntu
$ virt-viewer ubuntu

At this point the VM will have started, but shows 'No bootable devices' if unpatched. If patched, it should boot up fine.

4b. TEST CASE 2 (don't regress --raw (first delete the previous 'ubuntu' domain)):
$ qemu-img create /tmp/foo.img 5G
$ sudo /sbin/losetup /dev/loop1 /tmp/foo.img
$ sudo vmbuilder kvm ubuntu --suite lucid --flavour virtual --arch i386 -o --libvirt qemu:///system --raw=/dev/loop1
$ virsh --connect=qemu:///system start ubuntu
$ virt-viewer --connect=qemu:///system ubuntu

At this point the VM should be started and running.

5. Risk of regression is considered low. Patch is not intrusive and only will add the extra XML only if a disk is converted, so it should affect no other parts of libvirt. Since vm-builder with libvirt and qcow2 disks (the default) are currently broken, there is no risk of regression in the libvirt code. Tests show that --raw still works properly too.

Changed in vm-builder (Ubuntu):
importance: Undecided → High
status: New → Triaged
description: updated
Changed in vm-builder (Ubuntu Maverick):
status: New → Triaged
Changed in vm-builder (Ubuntu Lucid):
status: New → Triaged
importance: Undecided → High
Changed in vm-builder (Ubuntu Maverick):
importance: Undecided → High
description: updated
Changed in vm-builder (Ubuntu Maverick):
status: Triaged → In Progress
description: updated
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Attached is a preliminary patch for vm-builder on maverick which adjusts VMbuilder/disk.py to have a new 'self.format_type' attribute. This attribute will normally be 'None', but will be set when a disk is convert()ed. VMbuilder/plugins/libvirt/templates/libvirtxml*.tmpl is then adjusted to supply the proper qemu image format to libvirt if the format_type is set for the disk. Since libvirt defaults to 'raw' for unspecified format types, this covers the default 'qcow2' case and avoids setting the format type when using --raw.

Tested using:
$ sudo vmbuilder kvm ubuntu --suite lucid --flavour virtual --arch i386 -o --libvirt qemu:///system
$ sudo vmbuilder kvm ubuntu --suite lucid --flavour virtual --arch i386 -o --libvirt qemu:///system --raw /dev/loop1

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

I also tested with:
sudo vmbuilder kvm ubuntu --suite lucid --flavour virtual --arch i386 -o --libvirt qemu:///system --raw /dev/loop1p1

after using fdisk on /dev/loop0 and using kpartx -av /tmp/foo.img.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Err, obviously I meant:
sudo vmbuilder kvm ubuntu --suite lucid --flavour virtual --arch i386 -o --libvirt qemu:///system --raw /dev/loop0p1

description: updated
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Got soren to review the patch in IRC (#ubuntu-server) and he ACK'd the patch:
07:34 < jdstrand> soren: hi! would you mind looking at and commenting on my patch for bug #659532 ?
07:41 < soren> jdstrand: Looks lovely.

description: updated
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Uploaded 0.12.4-0ubuntu1.1 to maverick-proposed.

Changed in vm-builder (Ubuntu Lucid):
assignee: nobody → Jamie Strandboge (jdstrand)
Changed in vm-builder (Ubuntu Maverick):
assignee: nobody → Jamie Strandboge (jdstrand)
Changed in vm-builder (Ubuntu Natty):
assignee: nobody → Jamie Strandboge (jdstrand)
Changed in vm-builder (Ubuntu Maverick):
milestone: none → maverick-updates
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted vm-builder into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in vm-builder (Ubuntu Maverick):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Installed 0.12.4-0ubuntu1.1 from maverick-proposed and both test cases work properly.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package vm-builder - 0.12.4-0ubuntu1.1

---------------
vm-builder (0.12.4-0ubuntu1.1) maverick-proposed; urgency=low

  * debian/patches/0001-lp659532.patch: supply disk format in libvirt XML
    for converted disks otherwise non-raw disks (eg, 'qcow2', the default in
    vm-builder) won't show up in the guest with libvirt 0.8.3 and newer
    - LP: #659532
 -- Jamie Strandboge <email address hidden> Tue, 12 Oct 2010 17:21:56 -0500

Changed in vm-builder (Ubuntu Maverick):
status: Fix Committed → Fix Released
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Pocket copied to natty to make sure that new updates to the package don't drop this patch.

Changed in vm-builder (Ubuntu Maverick):
status: Fix Released → Fix Committed
Changed in vm-builder (Ubuntu Natty):
status: Triaged → Fix Released
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Uploaded 0.12.4-0ubuntu0.2 to security PPA for lucid to prepare for pending libvirt update.

Changed in vm-builder (Ubuntu Lucid):
status: Triaged → Fix Committed
tags: added: verification-done
removed: verification-needed
tags: added: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package vm-builder - 0.12.4-0ubuntu1.1

---------------
vm-builder (0.12.4-0ubuntu1.1) maverick-proposed; urgency=low

  * debian/patches/0001-lp659532.patch: supply disk format in libvirt XML
    for converted disks otherwise non-raw disks (eg, 'qcow2', the default in
    vm-builder) won't show up in the guest with libvirt 0.8.3 and newer
    - LP: #659532
 -- Jamie Strandboge <email address hidden> Tue, 12 Oct 2010 17:21:56 -0500

Changed in vm-builder (Ubuntu Maverick):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package vm-builder - 0.12.4-0ubuntu0.2

---------------
vm-builder (0.12.4-0ubuntu0.2) lucid-security; urgency=low

  * debian/patches/0001-lp659532.patch: supply disk format in libvirt XML
    for converted disks otherwise non-raw disks (eg, 'qcow2', the default in
    vm-builder) won't show up in the guest with patched libvirt in
    lucid-security or libvirt 0.8.3 and higher.
    - LP: #659532
 -- Jamie Strandboge <email address hidden> Wed, 13 Oct 2010 08:08:07 -0500

Changed in vm-builder (Ubuntu Lucid):
status: Fix Committed → Fix Released
tags: added: testcase
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.