Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1117196

Summary: Unable to create snapshot of windows virtual machine machine: Error -22 while writing VM
Product: Red Hat Enterprise Linux 7 Reporter: Robin Hack <rhack>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED WONTFIX QA Contact: Gu Nini <ngu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: bcostescu, berrange, chayang, guidomureddu, hhuang, jinzhao, juzhang, ktordeur, michen, mike, pladd, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-07 15:01:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
windows virtual machine configuration
none
Output of virt-manager --debug
none
qemu libvirt log-file none

Description Robin Hack 2014-07-08 09:11:59 UTC
Created attachment 916311 [details]
windows virtual machine configuration

Description of problem:
Hi again :). My journey to better virt-manager still continues.

Version-Release number of selected component (if applicable):
virt-manager-1.0.1-3.fc20.noarch

How reproducible:
always

Steps to Reproduce:
1. Install rhel7 server
2. Create windows 2008 virtual machine (xml config is attached)
3. Try to snapshot machine from virt-manager on fedora 20

Actual results:
Error dialog box with:
Error creating snapshot: operation failed: Error -22 while writing VM

Details:
Error creating snapshot: operation failed: Error -22 while writing VM


Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 91, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/snapshots.py", line 466, in _do_create_snapshot
    self.vm.create_snapshot(xml)
  File "/usr/share/virt-manager/virtManager/domain.py", line 1053, in create_snapshot
    self._backend.snapshotCreateXML(xml, flags)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 1788, in snapshotCreateXML
    if ret is None:raise libvirtError('virDomainSnapshotCreateXML() failed', dom=self)
libvirtError: operation failed: Error -22 while writing VM



Expected results:
Snapshoted machine.

Additional info:
I'm able to snapshot all other machines on server.

Comment 1 Robin Hack 2014-07-08 09:14:34 UTC
Created attachment 916313 [details]
Output of virt-manager --debug

Debug output of virt-manager on my fedora box.

Comment 2 Cole Robinson 2014-07-08 17:21:40 UTC
Please also provide /var/log/libvirt/qemu/$vmname.log from the VMs host.

This error comes straight from qemu, so reassigning to RHEL7 qemu. There's another bug open with the same error (bug 953062) however that specifically mentions AHCI/q35 which your VM isn't using, so it must be something else

Comment 4 Robin Hack 2014-07-09 11:11:17 UTC
Created attachment 916722 [details]
qemu libvirt log-file

(In reply to Cole Robinson from comment #2)
> Please also provide /var(In reply to Cole Robinson from comment #2)
> Please also provide /var/log/libvirt/qemu/$vmname.log from the VMs host.
Hi Cole.
No problem./log/libvirt/qemu/$vmname.log from the VMs host.

Comment 5 Bogdan Costescu 2014-08-22 13:12:32 UTC
I seem to have the same or a similar problem. My setup is simpler: host is Fedora 20, virt-manager runs on the host, VM runs CentOS7. However, I have the feeling that this has nothing to do with what runs in the VM.

The error message appears only when I attempt to snapshot a running VM. If the VM is shutdown, snapshotting is successful. The error is not related to a particular VM, newly created VMs are also affected. This is a regression introduced recently in the Fedora 20 packages (although I can't identify which one...) as 2-3 weeks ago snapshotting of a running VM was working; apart from installing updated packages, there were no changes in the setup of the host in the meantime.

The VMs are created with the following commands:

qemu-img create -f qcow2 -o preallocation=metadata ${VMNAME}-sda 8G
virt-install --accelerate --noautoconsole --name=${VMNAME} --ram=2048 --vcpus=1 --cpu host --disk path=${VMNAME}-sda,format=qcow2,bus=sata,cache=none --network=bridge=br0,mac=52:54:00:01:23:45 --graphics spice --location=http://mirror/centos/7/os/x86_64/ --extra-args="noselinux ks=http://install/ks.cfg"

Please let me know if further data would be helpful.

Comment 6 Cole Robinson 2014-09-05 21:03:20 UTC
Bogdan, please open a bug against fedora qemu to track that issue, they might be the same root cause but the fedora and rhel qemu code bases are quite different.

Comment 9 Mike Goodwin 2016-01-31 12:42:32 UTC
Still seeing this on a centos host using virt-manager on Fedora 23 as the client 

This bug is quite old, did id progress elsewhere?

Comment 10 Mike Goodwin 2016-01-31 12:42:55 UTC
Still seeing this on a centos host using virt-manager on Fedora 23 as the client 

This bug is quite old, did it progress elsewhere?

Comment 11 Mike Goodwin 2016-02-11 17:06:31 UTC
As it turns out this is caused by having a SATA bus attached to the VM. Removing that is the workaround.

Comment 13 Kenny Tordeurs 2017-10-18 07:36:15 UTC
Issue can still be reproduced with:

# rpm -qa qemu*
~~~
qemu-kvm-1.5.3-126.el7_3.9.x86_64
qemu-img-1.5.3-126.el7_3.9.x86_64
qemu-kvm-common-1.5.3-126.el7_3.9.x86_64
~~~

# grep -Ri "operation failed: Failed to take snapshot: Error -22 while writing VM" /var/log/messages -B1 -A1
~~~
Oct 18 10:30:55 satotest systemd: Starting Session 27472 of user root.
Oct 18 10:31:01 satotest journal: operation failed: Failed to take snapshot: Error -22 while writing VM#015
Oct 18 10:31:01 satotest NetworkManager[1046]: <info>  [1508315461.6810] device (macvtap2): link connected
--
Oct 18 10:49:12 satotest yum[19905]: Updated: perl-Socket-2.010-4.el7.x86_64
Oct 18 10:49:13 satotest journal: operation failed: Failed to take snapshot: Error -22 while writing VM#015
Oct 18 10:49:13 satotest NetworkManager[1046]: <info>  [1508316553.1583] device (macvtap2): link connected
~~~

# tail -n 5 /var/log/libvirt/qemu/ktordeur-satellite6-provisioning.log
2017-08-24 11:18:46.769+0000: starting up libvirt version: 2.0.0, package: 10.el7_3.4 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2017-01-05-04:19:14, x86-034.build.eng.bos.redhat.com), qemu version: 1.5.3 (qemu-kvm-1.5.3-126.el7_3.9), hostname: satotest.gsslab.brq.redhat.com
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -name ktordeur-satellite6-provisioning -S -machine pc-i440fx-rhel7.0.0,accel=kvm,usb=off -cpu Haswell,-hle,-rtm -m 14016 -realtime mlock=off -smp 5,sockets=5,cores=1,threads=1 -uuid 1ce55230-d33b-436b-b580-31c84ebcc153 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-5-ktordeur-satellite6-/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x6.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x6 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x6.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x6.0x2 -device ahci,id=sata0,bus=pci.0,addr=0x9 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive file=/home/kenny/ktordeur-sat6-provisioning.qcow2,format=qcow2,if=none,id=drive-ide0-0-0 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive file=/home/kenny/ktordeur-sat6-provisioning-disk2.qcow2,format=qcow2,if=none,id=drive-ide0-0-1 -device ide-hd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 -drive file=/home/kenny/ktordeur-sat6-provisioning-disk3.qcow2,format=qcow2,if=none,id=drive-ide0-1-0 -device ide-hd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -drive file=/home/kenny/ktordeur-sat6-provisioning-last.qcow2,format=qcow2,if=none,id=drive-ide0-1-1 -device ide-hd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 -drive file=/home/kenny/ktordeur-sat6-provisioning-4.qcow2,format=qcow2,if=none,id=drive-sata0-0-0 -device ide-hd,bus=sata0.0,drive=drive-sata0-0-0,id=sata0-0-0 -drive file=/home/provisioning/ktordeur-provisioning-5.qcow2,format=qcow2,if=none,id=drive-sata0-0-1 -device ide-hd,bus=sata0.1,drive=drive-sata0-0-1,id=sata0-0-1 -netdev tap,fd=32,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:86:59:a9,bus=pci.0,addr=0x3,bootindex=2 -netdev tap,fd=35,id=hostnet1 -device rtl8139,netdev=hostnet1,id=net1,mac=52:54:00:1c:95:58,bus=pci.0,addr=0x8 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -vnc 127.0.0.1:3 -vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=67108864 -global qxl-vga.vgamem_mb=16 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=1 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 -msg timestamp=on
char device redirected to /dev/pts/4 (label charserial0)
((null):10638): Spice-Warning **: reds.c:3890:spice_server_add_interface: unsupported char device interface
((null):10638): Spice-Warning **: reds.c:3890:spice_server_add_interface: unsupported char device interface