Bug 1268851 - libvirt on libxl passes "(null)" as a file when using a disk type=volume
libvirt on libxl passes "(null)" as a file when using a disk type=volume
Status: NEW
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
unspecified
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Libvirt Maintainers
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-05 09:02 EDT by Nick L.
Modified: 2016-04-10 18:35 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Nick L. 2015-10-05 09:02:45 EDT
Description of problem:
libvirt 1.2.15 on CentOS 6 (kernel 3.10.68-11.el6.centos.alt.x86_64) on Xen 4.4.2-4.el6 using the libxl driver fails to spawn a virtual machine guest when the guest is configured to use a volume in a "dir" type pool.

Pool configuration:
================================================================================
root@xen1 [~]# virsh pool-dumpxml xenhost-vm-data
<pool type='dir'>
  <name>xenhost-vm-data</name>
  <uuid>56f1d57f-c1b3-4bb6-aa7b-68799cef61b4</uuid>
  <capacity unit='bytes'>915733540864</capacity>
  <allocation unit='bytes'>7516299264</allocation>
  <available unit='bytes'>908217241600</available>
  <source>
  </source>
  <target>
    <path>/opt/xenhost/vms</path>
    <permissions>
      <mode>0755</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>
================================================================================

Volume list:
================================================================================
root@xen1 [~]# virsh vol-list --pool xenhost-vm-data
 Name                 Path                                    
------------------------------------------------------------------------------
 xenhost-main-1.qcow2 /opt/xenhost/vms/xenhost-main-1.qcow2   
 xenhost-manage.qcow2 /opt/xenhost/vms/xenhost-manage.qcow2
================================================================================

From "/var/log/libvirt/libxl/libxl-driver.log" when trying to start the guest "xenhost-main-1":
================================================================================
libxl: debug: libxl_create.c:1345:do_domain_create: ao 0x7fb2f40017a0: create: how=(nil) callback=(nil) poller=0x7fb2ec001090
libxl: debug: libxl_device.c:251:libxl__device_disk_set_backend: Disk vdev=hda spec.backend=qdisk
libxl: debug: libxl_device.c:251:libxl__device_disk_set_backend: Disk vdev=hdc spec.backend=unknown
libxl: debug: libxl_device.c:197:disk_try_backend: Disk vdev=hdc, backend phy unsuitable as phys path not a block device
libxl: debug: libxl_device.c:205:disk_try_backend: Disk vdev=hdc, backend tap unsuitable for cdroms
libxl: debug: libxl_device.c:286:libxl__device_disk_set_backend: Disk vdev=hdc, using backend qdisk
libxl: debug: libxl_create.c:797:initiate_domain_create: running bootloader
libxl: debug: libxl_bootloader.c:321:libxl__bootloader_run: not a PV domain, skipping bootloader
libxl: debug: libxl_event.c:622:libxl__ev_xswatch_deregister: watch w=0x7fb2f40032f8: deregister unregistered
libxl: debug: libxl_numa.c:478:libxl__get_numa_candidate: New best NUMA placement candidate found: nr_nodes=1, nr_cpus=8, nr_vcpus=12, free_memkb=28055
libxl: detail: libxl_dom.c:195:numa_place_domain: NUMA placement candidate with 1 nodes, 8 cpus and 28055 KB free selected
xc: detail: elf_parse_binary: phdr: paddr=0x100000 memsz=0xbcce4
xc: detail: elf_parse_binary: memory: 0x100000 -> 0x1bcce4
xc: detail: VIRTUAL MEMORY ARRANGEMENT:
  Loader:        0000000000100000->00000000001bcce4
  Modules:       0000000000000000->0000000000000000
  TOTAL:         0000000000000000->00000000ff800000
  ENTRY ADDRESS: 0000000000100000
xc: detail: PHYSICAL MEMORY ALLOCATION:
  4KB PAGES: 0x0000000000000200
  2MB PAGES: 0x00000000000003fb
  1GB PAGES: 0x0000000000000002
xc: detail: elf_load_binary: phdr 0 at 0x7fb31f094000 -> 0x7fb31f147b54
libxl: debug: libxl_device.c:251:libxl__device_disk_set_backend: Disk vdev=hda spec.backend=qdisk
libxl: debug: libxl_event.c:622:libxl__ev_xswatch_deregister: watch w=0x7fb2f4000da0: deregister unregistered
libxl: debug: libxl_device.c:251:libxl__device_disk_set_backend: Disk vdev=hdc spec.backend=qdisk
libxl: debug: libxl_event.c:622:libxl__ev_xswatch_deregister: watch w=0x7fb2f4001c20: deregister unregistered
libxl: debug: libxl_dm.c:1333:libxl__spawn_local_dm: Spawning device-model /usr/lib/xen/bin/qemu-system-i386 with arguments:
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   /usr/lib/xen/bin/qemu-system-i386
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -xen-domid
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   63
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -chardev
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   socket,id=libxl-cmd,path=/var/run/xen/qmp-libxl-63,server,nowait
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -mon
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   chardev=libxl-cmd,mode=control
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -nodefaults
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -name
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   xenhost-main-1
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -vnc
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   127.0.0.1:16
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -display
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   none
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -k
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   en-us
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -serial
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   pty
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -device
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   cirrus-vga
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -global
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   vga.vram_size_mb=8
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -boot
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   order=dc
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -usb
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -usbdevice
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   tablet
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -smp
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   2,maxcpus=2
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -device
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   rtl8139,id=nic0,netdev=net0,mac=00:16:3e:00:0d:30
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -netdev
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   type=tap,id=net0,ifname=vif63.0-emu,script=no,downscript=no
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -machine
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   xenfv
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -m
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   4088
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -drive
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   file=(null),if=ide,index=0,media=disk,format=qcow2,cache=writeback
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   -drive
libxl: debug: libxl_dm.c:1335:libxl__spawn_local_dm:   file=/media/images/isos/CentOS-7-x86_64-Everything-1503-01.iso,if=ide,index=2,media=cdrom,format=raw,cache=writeback,id=ide-5632
libxl: debug: libxl_event.c:574:libxl__ev_xswatch_register: watch w=0x7fb2f4003530 wpath=/local/domain/0/device-model/63/state token=1/99: register slotnum=1
libxl: debug: libxl_create.c:1359:do_domain_create: ao 0x7fb2f40017a0: inprogress: poller=0x7fb2ec001090, flags=i
libxl: debug: libxl_event.c:518:watchfd_callback: watch w=0x7fb2f4003530 wpath=/local/domain/0/device-model/63/state token=1/99: event epath=/local/domain/0/device-model/63/state
libxl: debug: libxl_event.c:610:libxl__ev_xswatch_deregister: watch w=0x7fb2f4003530 wpath=/local/domain/0/device-model/63/state token=1/99: deregister slotnum=1
libxl: error: libxl_dm.c:1401:device_model_spawn_outcome: domain 63 device model: spawn failed (rc=-3)
libxl: error: libxl_create.c:1189:domcreate_devmodel_started: device model did not start: -3
libxl: error: libxl_dm.c:1505:kill_device_model: Device Model already exited
libxl: debug: libxl_event.c:622:libxl__ev_xswatch_deregister: watch w=0x7fb2f4005af0: deregister unregistered
libxl: debug: libxl_event.c:622:libxl__ev_xswatch_deregister: watch w=0x7fb2f4005d40: deregister unregistered
libxl: debug: libxl_event.c:622:libxl__ev_xswatch_deregister: watch w=0x7fb2f40062c0: deregister unregistered
libxl: debug: libxl_event.c:1600:libxl__ao_complete: ao 0x7fb2f40017a0: complete, rc=-3
libxl: debug: libxl_event.c:1572:libxl__ao__destroy: ao 0x7fb2f40017a0: destroy
libxl: debug: libxl_event.c:518:watchfd_callback: watch w=0x7fb3000da990 wpath=@releaseDomain token=3/65: event epath=@releaseDomain
libxl: debug: libxl.c:1012:domain_death_xswatch_callback: [evg=0x7fb2d0004330:48] nentries=1 rc=1 48..48
libxl: debug: libxl.c:1023:domain_death_xswatch_callback: [evg=0x7fb2d0004330:48]   got=domaininfos[0] got->domain=48
libxl: debug: libxl.c:1050:domain_death_xswatch_callback:  exists shutdown_reported=0 dominf.flags=ffff0012
libxl: debug: libxl.c:1016:domain_death_xswatch_callback: [evg=0] all reported
libxl: debug: libxl.c:1079:domain_death_xswatch_callback: domain death search done
libxl: debug: libxl_create.c:1345:do_domain_create: ao 0x7fb3001e7160: create: how=(nil) callback=(nil) poller=0x7fb2ec001090
libxl: error: libxl_create.c:600:libxl__domain_make: cannot change hotplug execution option once set, please shutdown all guests before changing it
libxl: error: libxl_create.c:743:initiate_domain_create: cannot make domain: -3
libxl: error: libxl_dm.c:1497:kill_device_model: unable to find device model pid in /local/domain/64/image/device-model-pid
libxl: error: libxl.c:1427:libxl__destroy_domid: libxl__destroy_device_model failed for 64
libxl: debug: libxl_event.c:1600:libxl__ao_complete: ao 0x7fb3001e7160: complete, rc=-3
libxl: debug: libxl_create.c:1359:do_domain_create: ao 0x7fb3001e7160: inprogress: poller=0x7fb2ec001090, flags=ic
libxl: debug: libxl_event.c:1572:libxl__ao__destroy: ao 0x7fb3001e7160: destroy
libxl: debug: libxl_event.c:518:watchfd_callback: watch w=0x7fb3000da990 wpath=@releaseDomain token=3/65: event epath=@releaseDomain
libxl: debug: libxl.c:1012:domain_death_xswatch_callback: [evg=0x7fb2d0004330:48] nentries=1 rc=1 48..48
libxl: debug: libxl.c:1023:domain_death_xswatch_callback: [evg=0x7fb2d0004330:48]   got=domaininfos[0] got->domain=48
libxl: debug: libxl.c:1050:domain_death_xswatch_callback:  exists shutdown_reported=0 dominf.flags=ffff0012
libxl: debug: libxl.c:1016:domain_death_xswatch_callback: [evg=0] all reported
libxl: debug: libxl.c:1079:domain_death_xswatch_callback: domain death search done
================================================================================

This is the libvirt guest XML disk configuration of the affected guest "xenhost-main-1":
================================================================================
     <disk type='volume' device='disk'>
       <driver name='qemu' type='qcow2'/>
       <source pool='xenhost-vm-data' volume='xenhost-main-1.qcow2'/>
       <target dev='hda' bus='ide'/>
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
================================================================================

I've tried different combinations of attributes in the <driver/> and <target/> tags, including the following:
================================================================================
<driver name='qemu' type='raw'/>
<target dev='sda' bus='scsi'/>
<target dev='vda' bus='virtio'/>
================================================================================

If the instance boots, the block device is revealed to be "0 Mbytes" in the virtual BIOS, which makes sense, seeing that "-drive file=(null),if=ide,index=0,media=disk,format=qcow2,cache=writeback" was passed to "/usr/lib/xen/bin/qemu-system-i386".

"file=(null)" should show as "file=/opt/xenhost/vms/xenhost-main-1.qcow2,if=ide,bus=0,unit=0,format=qcow2,cache=writeback" if the libvirt pool and volume were working as intended.
Comment 1 Cole Robinson 2016-04-10 18:35:30 EDT
Appears to still be relevant upstream. The function is:

static int
xenFormatXLDiskSrc(virStorageSourcePtr src, char **srcstr)
{
    int actualType = virStorageSourceGetActualType(src);

    *srcstr = NULL;

    if (virStorageSourceIsEmpty(src))
        return 0;

    switch ((virStorageType) actualType) {
    case VIR_STORAGE_TYPE_BLOCK:
    case VIR_STORAGE_TYPE_FILE:
    case VIR_STORAGE_TYPE_DIR:
        if (VIR_STRDUP(*srcstr, src->path) < 0)
            return -1;
        break;

    case VIR_STORAGE_TYPE_NETWORK:
        if (!(*srcstr = xenFormatXLDiskSrcNet(src)))
            return -1;
        break;

    case VIR_STORAGE_TYPE_VOLUME:
    case VIR_STORAGE_TYPE_NONE:
    case VIR_STORAGE_TYPE_LAST:
        break;
    }

    return 0;
}

Notice that STORAGE_TYPE_VOLUME just cleanly falls through. There isn't any explicit type=volume handling in the xl driver, so instead that case should throw an explicit error, until the code learns about TYPE_VOLUME

CCing jfehlig

Note You need to log in before you can comment on or make changes to this bug.