Bug 30472 - qemu internal snapshot with raw image not aborted
qemu internal snapshot with raw image not aborted
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Virtualization - KVM
UCS 3.1
Other Linux
: P5 normal (vote)
: UCS 3.1-0-errata
Assigned To: Philipp Hahn
Stefan Gohmann
:
Depends on: 22061
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-15 14:37 CET by Philipp Hahn
Modified: 2013-02-25 14:05 CET (History)
2 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Troubleshooting
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2013-02-15 14:37:11 CET
If the running VM contains a floppy, creating snapshot fails internally, but the error is not detected by libvirt. Success is still reported to the user success, who will see the snapshots, even they are NOT created.

virsh # qemu-monitor-command --hmp winxp-1  savevm \"test\"
Device 'drive-fdc0-0-0' is writable but does not support snapshots.

virsh # snapshot-create-as winxp-1 test
Domain snapshot test created

Since there is no QMP command in qemu, libvirtd sends a HMP command to the running QEMU and parses the returned text. There only the following 4 strings are detected as errors:

src/qemu/qemu_monitor_text.c:2822 # qemuMonitorTextCreateSnapshot()
"Error while creating snapshot"
"No block device can accept snapshots"
"Could not open VM state file"
"Error"

Since none of them match the above message, libvirts thinks the command succeeded.
Comment 1 Philipp Hahn univentionstaff 2013-02-15 15:47:56 CET
failing on removable media was fixed here: <http://git.qemu.org/?p=qemu.git;a=commit;h=07b70bfbb3f3aea9ce7a3a1da78cbfa8ae6bbce6>

the error message was introduced here: <http://git.qemu.org/?p=qemu.git;a=commit;h=feeee5aca765606818e00f5a19d19f141f4ae365>

both happened for post qemu-0.14 but before qemu-1.1.2
Comment 2 Philipp Hahn univentionstaff 2013-02-15 19:07:53 CET
libvirt now detects, when creating the snapshot fails.

As floppy images are currently always included read-write, taking snapshots of VMs with floppies now fails.


Notice that a .vfd is just a raw image of the floppy image. You can convert it to any other format supported by QEMU, especially qcow2, which than becomes snapshotable:
  qemu-img convert -f raw -O qcow2 '/var/lib/libvirt/images/KVM Windows drivers (virtio 1.1.16)'.{vfd,qcow2}

As the floppy is mounted read-write, the image is changeably by any VM mounting it. So the previous behavior of QEMU to allow snapshots was a real bug. This was incorrectly enabled by Bug #22061.
I didn't want to mount floppies read-only by default, because that would disallow using a floppy for exporting debug data from the installation or broken systems without a working network connection.

svn11456, libvirt_0.9.12-5.121.201302151751
3.1-1: svn39066
svn11459, univention-virtual-machine-manager-daemon_2.0.29-1.424.201302151903

2013-01-29-libvirt.yaml: svn16435
2013-02-05-univention-virtual-machine-manager-daemon.yaml: svn16438
  * Snapshots of VMs with floppy images are no longer allowed.

ChangeLog: svn16436
\item Snapshots of VMs with floppy images are no longer allowed,
	because by default the raw image is opened read-write, which is
	not snapshottable (\ucsBug{30472}).
Comment 3 Stefan Gohmann univentionstaff 2013-02-15 20:40:40 CET
If I'm right the admin can't create a snapshot if he uses a Windows VM with our default virtio floppy image. If so, we need at least a way to include the floppy read only via the UVMM GUI.  Next I think the floppy image should be read-only by default.

Alternatively 07b70bfbb3f3aea9ce7a3a1da78cbfa8ae6bbce could be reverted.
Comment 4 Philipp Hahn univentionstaff 2013-02-15 23:23:38 CET
There were two additional problems:
1. empty drives were counted as prohibiting drives. They are now ignored.
svn39068
2. when deleting an empty drive, a confirmation dialog was asking if the empty
media should be detached or deleted. This dialog is now no longer shown for
empty drives: svn39069

3.1-0errata: svn11460, 2.0.29-1.425.201302152317
yaml, ChangeLog: svn16440
  * Empty drives are allowed for snapshots.
  * Removing empty drives no longer asks for deleting the volume.
Comment 5 Philipp Hahn univentionstaff 2013-02-18 16:10:08 CET
svn39137: Allow changing the read-only-flag. Disk are read-write by default, floppie and cdroms are read-only.

svn39138: Do not disable all snapshot functionality as soos as one non-snapshottable device is added.

3.1-0errata: svn11464, 2.0.29-1.426.201302181558
yaml, ChangeLog-3.1-1: svn16486,16488
  * Floppies are now attached read-only.
  * Snapshot operations are still accessible even when 
    non-snapshotable images are attached.
Comment 6 Stefan Gohmann univentionstaff 2013-02-20 08:08:25 CET
Verified: A new instance uses the floppy read only. I can change it via the GUI to read write. If the floppy is read write I can't create a snapshot, but if the floppy is read only I can.

YAML: OK (2013-02-05-univention-virtual-machine-manager-daemon.yaml + 2013-01-29-libvirt.yaml)

Function errata: OK

Changelog 3.1-1: OK

Function / code: OK (checked only the code)
Comment 7 Moritz Muehlenhoff univentionstaff 2013-02-25 14:03:47 CET
http://errata.univention.de/3.1-errata41.html
Comment 8 Moritz Muehlenhoff univentionstaff 2013-02-25 14:05:01 CET
http://errata.univention.de/3.1-errata43.html