Public bug reported:

Binary package hint: libvirt-bin

I can reproduce that trying to use bus='virtio' for virtual disks in the
definition of a libvirt domain makes virtual disks thus defined
disappear in the eyes of KVM/QEMU. This leads to error messages like the
following when booting, as well as disappearance of all partitions on
that virtual disk, except for the root partition (that means especially
that no swap space will be enabled):

One or more of the mounts listed in /etc/fstab cannot yet be mounted:
(ESC for recovery shell)
swap: waiting for /dev/sda2
/opt: waiting for /dev/sda3

A screenshot is available here:
https://daff.pseudoterminal.org/misc/mountfailed.png

It also appears, just after starting the guest, that QEMU doesn't even
recognize that there are hard disk drives present, it only sees the DVD
drive. See the following screenshots for comparison.

bus='ide' in virtual disk domain definition: 
https://daff.pseudoterminal.org/misc/bus_ide.png
bus='virtio' in virtual disk domain definition: 
https://daff.pseudoterminal.org/misc/bus_virtio.png

The result is that only the root partition, probably because of
initramfs/initrd and GRUB magic, will be available to the guest when
using virtio, and only when no partitions other than a swap partition
have been defined during setup or installation of the guest. When only a
swap partition is present the boot process succeeds but still complains
that it is waiting for the swap partition to become available. When
there are any other partitions the boot process just hangs with the
error message described above.

Background: I like to take advantage of the paravirtualized IO drivers
offered for KVM-based guests. Using "virtio" as bus for block devices or
model type for network interfaces in the right places in a libvirt
domain definition enables those drivers. To facilitate and automate this
when creating guests I edited the libvirt template for vmbuilder to
automatically use virtio. Notice the target line:

#for $disk in $disks
    <disk type='file' device='disk'>
      <source file='$disk.filename' />
      <target dev='vd$disk.devletters()' bus='virtio' />
    </disk>
#end for

Now for creating a guest using vmbuilder, as per the Ubuntu Server
Guide:

# vmbuilder kvm ubuntu --dest=/storage/vms/foo -m 2048 --rootsize=4000
--optsize=4000 --hostname=foo --suite=karmic --bridge=br0 --overwrite
--libvirt=qemu:///system --flavour=virtual --arch=amd64
--mirror=http://host:9999/ubuntu

Here a root and an /opt partition are defined, both 4GB in size. Swap is
defined automatically and defaults to 1GB. This works fine and results
in the attached foo.xml libvirt domain definition. In particular the
disk definition looks like this (again, notice the target line):

<disk type='file' device='disk'>
  <source file='/storage/vms/foo/disk0.qcow2'/>
  <target dev='vda' bus='virtio'/>
</disk>

This is what the libvirt and KVM documentation pages suggest. After
starting this domain the results are as described above, i.e. either a
hanging boot process or a missing swap partition.

When changing the target bus definition to bus='ide' everything works
correctly. The domain boots as expected and contains all partitions
defined during setup. This has been completely reproducible for me and I
can switch between a working guest domain and a non-working by changing
bus='virtio' to bus='ide' in the domain definition.

This is on a Ubuntu Server Edition installation. I have no idea if this
is a libvirt problem or a problem with KVM or QEMU or something else
entirely. More information follows and please also see the attached
files. If there is anything else I can provide please tell me.

lsb_release -rd:
Description:    Ubuntu 9.10
Release:        9.10

apt-cache policy libvirt-bin
libvirt-bin:
  Installed: 0.7.0-1ubuntu13.1
  Candidate: 0.7.0-1ubuntu13.1
  Version table:
 *** 0.7.0-1ubuntu13.1 0
        500 http://at.archive.ubuntu.com karmic-updates/main Packages
        100 /var/lib/dpkg/status
     0.7.0-1ubuntu13 0
        500 http://at.archive.ubuntu.com karmic/main Packages

uname -a:
Linux dhcp155 2.6.31-17-server #54-Ubuntu SMP Thu Dec 10 18:06:56 UTC 2009 
x86_64 GNU/Linux

** Affects: libvirt (Ubuntu)
     Importance: Undecided
         Status: New

-- 
Using virtio for block devices makes disks and partitions disappear in KVM/QEMU 
(using vmbuilder and libvirt)
https://bugs.launchpad.net/bugs/517067
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to libvirt in ubuntu.

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to