Bug 1089422 - Virt-manager flags mount_tag as path rather than tag
Summary: Virt-manager flags mount_tag as path rather than tag
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: virt-manager
Version: 20
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Cole Robinson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-18 21:58 UTC by Brian Harrington
Modified: 2014-05-02 20:57 UTC (History)
4 users (show)

Fixed In Version: virt-manager-1.0.1-3.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-05-02 20:57:16 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Brian Harrington 2014-04-18 21:58:52 UTC
Description of problem:
Virt-manager incorrectly interprets mount_tag for the qemu "-device" option as a path.  When used as an actual tag as interpreted by udev & systemd this results in units which cannot actually be configured.
e.g
Given the following udev rules:

# A normal config drive. Block device formatted with iso9660 or fat
SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="iso9660|vfat", ENV{ID_FS_LABEL}=="config-2", TAG+="systemd", ENV{SYSTEMD_WANTS}+="configdrive-block.service"

# Addtionally support virtfs from QEMU
SUBSYSTEM=="virtio", DRIVER=="9pnet_virtio", ATTR{mount_tag}=="config-2", TAG+="systemd", ENV{SYSTEMD_WANTS}+="configdrive-virtfs.service"


This has problems being specified in virt-manager.

Furthermore this gets mapped correctly when done through "add hardware" but fails in attempting to modify the virtual machine config.

Version-Release number of selected component (if applicable):
[bharrington@leviathan-alticon-net images]$ rpm -qa virt-manager
virt-manager-1.0.1-1.fc20.noarch


How reproducible:


Steps to Reproduce:
1. Add a "filesystem" to a virtual machine definition
2. Change the "path" of the filesystem to the correct mount_tag 
3. Virt-manager will not commit the changes complaining "Error changing VM configuration: Filesystem target 'config-2' must be an absolute path"

As a workaround you can completely remove the "filesystem" "device" and re-add it.  This check does not occur on the initial creation of the device, only modifying it.

Comment 1 Cole Robinson 2014-04-21 20:52:25 UTC
Thanks for the report, fixed upstream now:

commit e6a67fc7099ac39257108080c8cbcfcdc6371e56
Author: Cole Robinson <crobinso>
Date:   Mon Apr 21 16:51:23 2014 -0400

    filesystem: Fix target validation when editing device (bz 1089422)

Comment 2 Brian Harrington 2014-04-21 21:34:32 UTC
FYI, I just grabbed this commit from git and applied it.  Unfortunately it doesn't fix the issue....

Error changing VM configuration: Filesystem target 'config-2' must be an absolute path

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/details.py", line 2307, in _change_config_helper
    define_func(devobj, False, **define_args)
  File "/usr/share/virt-manager/virtManager/domain.py", line 907, in define_filesystem
    return self._redefine_device(change, devobj, use_live_device)
  File "/usr/share/virt-manager/virtManager/domain.py", line 542, in _redefine_device
    cb(dev)
  File "/usr/share/virt-manager/virtManager/domain.py", line 905, in change
    editdev.target = newdev.target
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 620, in setter
    self._convert_set_value(xmlbuilder, val))
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 502, in _convert_set_value
    val = self._convert_value_for_setter_cb(xmlbuilder, val)
  File "/usr/share/virt-manager/virtinst/devicefilesystem.py", line 108, in _validate_set_target
    raise ValueError(_("Filesystem target '%s' must be an absolute "
ValueError: Filesystem target 'config-2' must be an absolute path

Comment 3 Cole Robinson 2014-04-21 22:16:26 UTC
Can you show the VM xml ? sudo virsh dumpxml $vmname

Comment 4 Brian Harrington 2014-04-21 22:19:39 UTC
Sure thing:

<domain type='kvm' id='7'>
  <name>vm1</name>
  <uuid>3399a628-b838-4406-805c-394b83e24ee6</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-0.15'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/media/Bulk/VM/images/vm1.img'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/var/lib/libvirt/filesystems/metadata'/>
      <target dir='config-2'/>
      <alias name='fs0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </filesystem>
    <interface type='network'>
      <mac address='52:54:00:62:ff:9f'/>
      <source network='default'/>
      <target dev='vnet1'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/2'>
      <source path='/dev/pts/2'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5901' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <sound model='ich6'>
      <alias name='sound0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </sound>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c149,c228</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c149,c228</imagelabel>
  </seclabel>
</domain>


Specifically this relates to "<target dir='config-2'/>"

Comment 5 Cole Robinson 2014-04-21 22:38:52 UTC
I can't reproduce the issue with that XML. Just to make sure something isn't missing:

- fully shut down virt-manager
- git clone git://git.fedorahosted.org/virt-manager.git
- cd virt-manager
- ./virt-manager --debug

And try to reproduce

Comment 6 Brian Harrington 2014-04-21 22:44:37 UTC
Full code checkout rather than just a patch fixes it.

[Mon, 21 Apr 2014 15:41:22 virt-manager 29524] DEBUG (libvirtobject:67) Redefining <vmmDomain name=coreos3> with XML diff:
--- Original XML
+++ New XML
@@ -29,9 +29,9 @@
       <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x2"/>
     </controller>
     <controller type="pci" index="0" model="pci-root"/>
-    <filesystem type="mount" accessmode="passthrough">
+    <filesystem accessmode="passthrough">
       <source dir="/var/lib/libvirt/filesystems/metadata/"/>
-      <target dir="config-3"/>
+      <target dir="config-2"/>
       <address type="pci" domain="0x0000" bus="0x00" slot="0x04" function="0x0"/>
     </filesystem>
     <interface type="network">


It appears that previously it would set type=mount (in fact it still shows it in the gui).

Regardless, it appears that things are now cleaned up.

Comment 7 Fedora Update System 2014-04-29 18:52:19 UTC
virt-manager-1.0.1-3.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/virt-manager-1.0.1-3.fc20

Comment 8 Fedora Update System 2014-05-01 07:03:55 UTC
Package virt-manager-1.0.1-3.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing virt-manager-1.0.1-3.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-5846/virt-manager-1.0.1-3.fc20
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2014-05-02 20:57:16 UTC
virt-manager-1.0.1-3.fc20 has been pushed to the Fedora 20 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.