Bug 1080613 - Can't clone VM
Summary: Can't clone VM
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Fedora
Classification: Fedora
Component: virt-manager
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Cole Robinson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-25 19:17 UTC by Tim Waugh
Modified: 2014-04-07 15:02 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-04-07 15:02:53 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
virt-manager --debug &>output.log (17.78 KB, text/x-log)
2014-03-26 17:20 UTC, Tim Waugh
no flags Details

Description Tim Waugh 2014-03-25 19:17:11 UTC
Description of problem:
When attempting to clone a VM using virt-manager I get an error dialog:

==>
Error setting clone parameters: An error occurred, but the cause is unknown

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/engine.py", line 915, in _do_show_clone
    clone_window.show(src.topwin)
  File "/usr/share/virt-manager/virtManager/clone.py", line 173, in show
    self.reset_state()
  File "/usr/share/virt-manager/virtManager/clone.py", line 243, in reset_state
    self.storage_list, self.target_list = self.check_all_storage()
  File "/usr/share/virt-manager/virtManager/clone.py", line 374, in check_all_storage
    vol = self.conn.get_vol_by_path(path)
  File "/usr/share/virt-manager/virtManager/connection.py", line 756, in get_vol_by_path
    if vol.get_target_path() == path:
  File "/usr/share/virt-manager/virtManager/storagepool.py", line 68, in get_target_path
    return self.get_xmlobj().target_path or ""
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 141, in get_xmlobj
    xml = self._get_raw_xml(inactive, refresh_if_nec)
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 197, in _get_raw_xml
    self.refresh_xml()
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 160, in refresh_xml
    self._xml = self._XMLDesc(self._active_xml_flags)
  File "/usr/share/virt-manager/virtManager/storagepool.py", line 44, in _XMLDesc
    return self._backend.XMLDesc(flags)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2697, in XMLDesc
    if ret is None: raise libvirtError ('virStorageVolGetXMLDesc() failed', vol=self)
libvirtError: An error occurred, but the cause is unknown
<==

Version-Release number of selected component (if applicable):
libvirt-daemon-1.1.3.4-3.fc20.x86_64
virt-manager-1.0.0-6.fc20.noarch

How reproducible:
Happens every time I try.

Steps to Reproduce:
1.In the virt-manager window, right-click on any VM and select Clone...

Comment 1 Cole Robinson 2014-03-25 21:39:39 UTC
Please update to virt-manager 1.0.1 in updates-testing. Probably won't fix this though.

Can you attach the virt-manager --debug output when reproducing?
And 'sudo virsh vol-dumpxml $path' for every path that belongs to the VM you are trying to clone

Comment 2 Tim Waugh 2014-03-26 17:20:32 UTC
Created attachment 879132 [details]
virt-manager --debug &>output.log

virt-manager-1.0.1-1.fc20.noarch shows the same symptom.

Comment 3 Cole Robinson 2014-03-26 18:42:18 UTC
Okay, a few bits:

Does 'sudo virsh vol-dumpxml $path' fail in the same way for any of the disks attached to your VM?

if not, can you try removing python-libguestfs and then see if the issue still reproduces?

Finally, if it's still broken, try updating to latest libvirt with fedora-virt-preview and see if the issues reproduces: http://fedoraproject.org/wiki/Virtualization_Preview_Repository

Comment 4 Tim Waugh 2014-03-27 10:52:35 UTC
'virsh vol-dumpxml ...' worked fine (sorrymissed that question before).

After removing python-libguestfs cloning now works.

Comment 5 Adam Young 2014-03-27 17:57:27 UTC



[Thu, 27 Mar 2014 13:56:47 virt-manager 6941] ERROR (inspection:158) qemu:///system:F20: exception while processing
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/inspection.py", line 148, in _process_vms
    data = self._process(conn, vm, vmuuid)
  File "/usr/share/virt-manager/virtManager/inspection.py", line 193, in _process
    g.launch()
  File "/usr/lib/python2.7/site-packages/guestfs.py", line 323, in launch
    r = libguestfsmod.launch (self._o)
RuntimeError: could not create appliance through libvirt.

Try running qemu directly without libvirt using this environment variable:
export LIBGUESTFS_BACKEND=direct

Original error from libvirt: unable to set security context 'system_u:object_r:virt_content_t:s0' on '/var/lib/libvirt/images/f20-stack.qcow2': Operation not permitted [code=38 domain=24]
[Thu, 27 Mar 2014 13:56:47 virt-manager 6941] DEBUG (clone:172) Showing clone wizard
[Thu, 27 Mar 2014 13:56:47 virt-manager 6941] DEBUG (cloner:268) Validating original guest parameters
[Thu, 27 Mar 2014 13:56:47 virt-manager 6941] DEBUG (cloner:277) Original XML:
<domain type='kvm'>
  <name>F20</name>
  <uuid>0a6d57bd-06e8-4dd6-ba7c-8fcebdb7bc9f</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-1.6'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>SandyBridge</model>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <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='/var/lib/libvirt/images/f20-stack.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>
    <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='0x06' function='0x0'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:3b:96:33'/>
      <source network='default'/>
      <model type='rtl8139'/>
      <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>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='mouse' bus='ps2'/>
    <graphics type='spice' autoport='yes'/>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' ram='65536' vram='65536' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
    </redirdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </memballoon>
  </devices>
</domain>

[Thu, 27 Mar 2014 13:56:47 virt-manager 6941] DEBUG (cloner:287) Original paths: ['/var/lib/libvirt/images/f20-stack.qcow2']
[Thu, 27 Mar 2014 13:56:47 virt-manager 6941] DEBUG (cloner:289) Original sizes: [1079.0000009536743]
[Thu, 27 Mar 2014 13:56:47 virt-manager 6941] DEBUG (clone:412) Original path: /var/lib/libvirt/images/f20-stack.qcow2
Generated clone path: /var/lib/libvirt/images/f20-stack-clone.qcow2
[Thu, 27 Mar 2014 13:56:47 virt-manager 6941] DEBUG (diskbackend:171) Path '/var/lib/libvirt/images' is target for pool 'default'. Creating volume 'f20-stack-clone.qcow2'.
[Thu, 27 Mar 2014 13:56:47 virt-manager 6941] DEBUG (xmlbuilder:694) Error parsing xml=
<volume>
  <name>AMEDD MC & DC O-6 Promotion Board Results.pdf</name>
  <key>/home/ayoung/Downloads/AMEDD MC & DC O-6 Promotion Board Results.pdf</key>
  <source>
  </source>
  <capacity unit='bytes'>194691</capacity>
  <allocation unit='bytes'>196608</allocation>
  <target>
    <path>/home/ayoung/Downloads/AMEDD MC & DC O-6 Promotion Board Results.pdf</path>
    <format type='raw'/>
    <permissions>
      <mode>0664</mode>
      <owner>14370</owner>
      <group>14370</group>
      <label>unconfined_u:object_r:user_home_t:s0</label>
    </permissions>
    <timestamps>
      <atime>1395927026.414478459</atime>
      <mtime>1387467770.837491637</mtime>
      <ctime>1389387966.728119838</ctime>
    </timestamps>
  </target>
</volume>

[Thu, 27 Mar 2014 13:56:48 virt-manager 6941] DEBUG (error:84) error dialog message:
summary=Error setting clone parameters: xmlParseDoc() failed
details=Error setting clone parameters: xmlParseDoc() failed

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/engine.py", line 915, in _do_show_clone
    clone_window.show(src.topwin)
  File "/usr/share/virt-manager/virtManager/clone.py", line 173, in show
    self.reset_state()
  File "/usr/share/virt-manager/virtManager/clone.py", line 243, in reset_state
    self.storage_list, self.target_list = self.check_all_storage()
  File "/usr/share/virt-manager/virtManager/clone.py", line 374, in check_all_storage
    vol = self.conn.get_vol_by_path(path)
  File "/usr/share/virt-manager/virtManager/connection.py", line 756, in get_vol_by_path
    if vol.get_target_path() == path:
  File "/usr/share/virt-manager/virtManager/storagepool.py", line 68, in get_target_path
    return self.get_xmlobj().target_path or ""
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 151, in get_xmlobj
    self._reparse_xml()
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 216, in _reparse_xml
    self._xmlobj = self._build_xmlobj(self._get_raw_xml())
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 219, in _build_xmlobj
    return self._parseclass(self.conn.get_backend(), parsexml=xml)
  File "/usr/share/virt-manager/virtinst/storage.py", line 535, in __init__
    _StorageObject.__init__(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 777, in __init__
    parent_xpath, relative_object_xpath)
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 679, in __init__
    self._parse(parsexml, parsexmlnode)
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 692, in _parse
    doc = libxml2.parseDoc(xml)
  File "/usr/lib64/python2.7/site-packages/libxml2.py", line 1325, in parseDoc
    if ret is None:raise parserError('xmlParseDoc() failed')
parserError: xmlParseDoc() failed
[Thu, 27 Mar 2014 13:56:48 virt-manager 6941] DEBUG (xmlbuilder:694) Error parsing xml=
<volume>
  <name>AMEDD MC & DC O-6 Promotion Board Results.pdf</name>
  <key>/home/ayoung/Downloads/AMEDD MC & DC O-6 Promotion Board Results.pdf</key>
  <source>
  </source>
  <capacity unit='bytes'>194691</capacity>
  <allocation unit='bytes'>196608</allocation>
  <target>
    <path>/home/ayoung/Downloads/AMEDD MC & DC O-6 Promotion Board Results.pdf</path>
    <format type='raw'/>
    <permissions>
      <mode>0664</mode>
      <owner>14370</owner>
      <group>14370</group>
      <label>unconfined_u:object_r:user_home_t:s0</label>
    </permissions>
    <timestamps>
      <atime>1395927026.414478459</atime>
      <mtime>1387467770.837491637</mtime>
      <ctime>1389387966.728119838</ctime>
    </timestamps>
  </target>
</volume>

[Thu, 27 Mar 2014 13:56:48 virt-manager 6941] DEBUG (cli:182) Uncaught exception:
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 216, in _reparse_xml
    self._xmlobj = self._build_xmlobj(self._get_raw_xml())
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 219, in _build_xmlobj
    return self._parseclass(self.conn.get_backend(), parsexml=xml)
  File "/usr/share/virt-manager/virtinst/storage.py", line 535, in __init__
    _StorageObject.__init__(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 777, in __init__
    parent_xpath, relative_object_xpath)
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 679, in __init__
    self._parse(parsexml, parsexmlnode)
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 692, in _parse
    doc = libxml2.parseDoc(xml)
  File "/usr/lib64/python2.7/site-packages/libxml2.py", line 1325, in parseDoc
    if ret is None:raise parserError('xmlParseDoc() failed')
parserError: xmlParseDoc() failed

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 216, in _reparse_xml
    self._xmlobj = self._build_xmlobj(self._get_raw_xml())
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 219, in _build_xmlobj
    return self._parseclass(self.conn.get_backend(), parsexml=xml)
  File "/usr/share/virt-manager/virtinst/storage.py", line 535, in __init__
    _StorageObject.__init__(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 777, in __init__
    parent_xpath, relative_object_xpath)
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 679, in __init__
    self._parse(parsexml, parsexmlnode)
  File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 692, in _parse
    doc = libxml2.parseDoc(xml)
  File "/usr/lib64/python2.7/site-packages/libxml2.py", line 1325, in parseDoc
    if ret is None:raise parserError('xmlParseDoc() failed')
libxml2.parserError: xmlParseDoc() failed

Comment 6 Richard W.M. Jones 2014-03-27 19:09:09 UTC
(In reply to Adam Young from comment #5)

> [Thu, 27 Mar 2014 13:56:47 virt-manager 6941] ERROR (inspection:158)
> qemu:///system:F20: exception while processing
> Traceback (most recent call last):
>   File "/usr/share/virt-manager/virtManager/inspection.py", line 148, in
> _process_vms
>     data = self._process(conn, vm, vmuuid)
>   File "/usr/share/virt-manager/virtManager/inspection.py", line 193, in
> _process
>     g.launch()
>   File "/usr/lib/python2.7/site-packages/guestfs.py", line 323, in launch
>     r = libguestfsmod.launch (self._o)
> RuntimeError: could not create appliance through libvirt.
> 
> Try running qemu directly without libvirt using this environment variable:
> export LIBGUESTFS_BACKEND=direct
> 
> Original error from libvirt: unable to set security context
> 'system_u:object_r:virt_content_t:s0' on
> '/var/lib/libvirt/images/f20-stack.qcow2': Operation not permitted [code=38
> domain=24]

This is an instance of bug 1075164.

However it should be a non-fatal error.  Inspection is written to
avoid causing any problems in virt-manager if it fails [except that
one time we caused an actual segfault in the Python bindings ...
which is fixed].

Comment 7 Cole Robinson 2014-03-30 17:46:29 UTC
Actually rich, there's two bits here. Adam had that backtrace in his logs, but the original issue seems to be if libguestfs is inspecting a disk image while virt-manager is trying to clone it, cloning fails and libvirt doesn't properly register an error message. I still need to try and reproduce to at least fix the libvirt error reporting, and then see how we can avoid it in virt-manager.

Comment 8 Richard W.M. Jones 2014-03-30 18:07:50 UTC
(In reply to Cole Robinson from comment #7)
> Actually rich, there's two bits here. Adam had that backtrace in his logs,
> but the original issue seems to be if libguestfs is inspecting a disk image
> while virt-manager is trying to clone it, cloning fails and libvirt doesn't
> properly register an error message. I still need to try and reproduce to at
> least fix the libvirt error reporting, and then see how we can avoid it in
> virt-manager.

Perhaps inspection._run should acquire a lock inside that loop,
and then clone could grab the same lock thus preventing inspection
from happening at all for the duration of the clone.  Note that
the inspection._run runs as a background thread.

Comment 9 Cole Robinson 2014-03-30 22:13:36 UTC
Okay, I think i've found a code path in libvirt where we can hit that 'cause is unknown' error. But I still don't understand what side effect of libguestfs is causing the vol dumpxml to fail, and I can't reproduce.

Tim, can you run:

sudo service libvirtd stop
sudo LIBVIRT_DEBUG=2 libvirtd

reproduce the issue, and post the libvirtd stderr/stdout ?

Comment 10 Cole Robinson 2014-03-31 00:43:53 UTC
Sent some patches that probably fix the libvirt error reporting:

http://www.redhat.com/archives/libvir-list/2014-March/msg01921.html

Comment 11 Tim Waugh 2014-04-04 15:44:52 UTC
(In reply to Cole Robinson from comment #9)
> Tim, can you run:
> 
> sudo service libvirtd stop
> sudo LIBVIRT_DEBUG=2 libvirtd
> 
> reproduce the issue, and post the libvirtd stderr/stdout ?

Sorry, I tried this but was unable to reproduce the problem.

Comment 12 Cole Robinson 2014-04-07 15:02:53 UTC
Thanks for trying Tim. If anyone can reproduce, please reopen this bug


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