Bug 1353296 - Libvirt fails to validate following virsh edit. XML created by virt-manager.
Summary: Libvirt fails to validate following virsh edit. XML created by virt-manager.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-06 17:59 UTC by Eric Griffith
Modified: 2017-05-18 20:59 UTC (History)
12 users (show)

Fixed In Version: libvirt-1.3.3.3-1.fc24
Clone Of:
Environment:
Last Closed: 2017-05-18 20:59:03 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Eric Griffith 2016-07-06 17:59:55 UTC
I'm not sure who's technically at fault here, because I'm not sure what part libvirt thinks is in violation. But, the following XML file fails to validate against libvirt's Domain.rng schema. The following XML was created by virt-manager, and will fail to validate, even if all I change is bumping the memory by 1 KiB. 

<domain type='kvm'>
  <name>Windows_10_Pro</name>
  <uuid>(censored)</uuid>
  <memory unit='KiB'>12288000</memory>
  <currentMemory unit='KiB'>12288000</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.6'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/Windows_10_Pro_VARS.fd</nvram>
    <bootmenu enable='yes'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
    </hyperv>
    <vmport state='off'/>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='4' threads='1'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
    <timer name='hypervclock' present='yes'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none' io='native'/>
      <source file='/mnt/Data/Virtual Machines/virt-manager/Windows_10_Pro.qcow2'/>
      <target dev='sda' bus='scsi'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/Data/Virtual Machines/virt-manager/virtio-win-0.1.102.iso'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>
    <controller type='usb' index='0' model='nec-xhci'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <controller type='scsi' index='0' model='virtio-scsi'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:c2:73:bc'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </memballoon>
  </devices>
</domain>

Comment 1 Eric Griffith 2016-07-06 18:01:41 UTC
Error is: 

error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content

Comment 2 Ján Tomko 2016-07-07 08:44:07 UTC
domain.rng is overly restrictive about path names:
test.xml:43:84: error: value of attribute "file" is invalid; must be a string matching the regular expression "/[a-zA-Z0-9_\.\+\-\\&"'<>/%,:]+"


As a workaround, you can use 'i' to ignore the validation error:

Element domain failed to validate content
Failed. Try again? [y,n,i,f,?]: ?
...
i - turn off validation and try to redefine again

Comment 3 Cole Robinson 2016-08-11 17:39:56 UTC
Particularly in this case it's rejecting the space in the filename, even though it's a valid path, and libvirt will handle it correctly.

Comment 4 Michal Privoznik 2016-08-15 08:34:30 UTC
I've just pushed the patch upstream:

commit c4b92f1a8a9cb64a2c4a9f0ed899ed8a7d95d935
Author:     Michal Privoznik <mprivozn>
AuthorDate: Fri Aug 12 10:52:30 2016 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Fri Aug 12 10:59:21 2016 +0200

    schema: Don't validate paths
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1353296
    
    On UNIX like systems there are no constraints on what characters
    can be in file/dir names (except for NULL, obviously). Moreover,
    some values that we think of as paths (e.g. disk source) are not
    necessarily paths at all. For instance, some hypervisors take
    that as an arbitrary identifier and corresponding file is then
    looked up by hypervisor in its table. Instead of trying to fix
    our regular expressions (and forgetting to include yet another
    character there), lets drop the validation completely.
    
    Signed-off-by: Michal Privoznik <mprivozn>

Comment 5 Christophe Fergeau 2016-09-13 10:14:22 UTC
Just hit this issue, would be great to have this fixed in the  f24 package :)

Comment 6 Fedora Update System 2017-05-10 22:01:10 UTC
libvirt-1.3.3.3-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-6055198a14

Comment 7 Fedora Update System 2017-05-12 22:33:49 UTC
libvirt-1.3.3.3-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-6055198a14

Comment 8 Fedora Update System 2017-05-18 20:59:03 UTC
libvirt-1.3.3.3-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.


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