libvirt/src/qemu
Eric Blake cb231b4bee snapshot: avoid crash when deleting qemu snapshots
This one's nasty.  Ever since we fixed virHashForEach to prevent
nested hash iterations for safety reasons (commit fba550f6),
virDomainSnapshotDelete with VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN
has been broken for qemu: it deletes children, while leaving
grandchildren intact but pointing to a no-longer-present parent.
But even before then, the code would often appear to succeed to
clean up grandchildren, but risked memory corruption if you have
a large and deep hierarchy of snapshots.

For acting on just children, a single virHashForEach is sufficient.
But for acting on an entire subtree, it requires iteration; and
since we declared recursion as invalid, we have to switch to a
while loop.  Doing this correctly requires quite a bit of overhaul,
so I added a new helper function to isolate the algorithm from the
actions, so that callers do not have to reinvent the iteration.

Note that this _still_ does not handle CHILDREN correctly if one
of the children is the current snapshot; that will be next.

* src/conf/domain_conf.h (_virDomainSnapshotDef): Add mark.
(virDomainSnapshotForEachDescendant): New prototype.
* src/libvirt_private.syms (domain_conf.h): Export it.
* src/conf/domain_conf.c (virDomainSnapshotMarkDescendant)
(virDomainSnapshotActOnDescendant)
(virDomainSnapshotForEachDescendant): New functions.
* src/qemu/qemu_driver.c (qemuDomainSnapshotDiscardChildren):
Replace...
(qemuDomainSnapshotDiscardDescenent): ...with callback that
doesn't nest hash traversal.
(qemuDomainSnapshotDelete): Use new function.
2011-09-02 16:04:32 -06:00
..
libvirtd_qemu.aug save: support bypass-cache flag in qemu.conf 2011-07-21 16:24:09 -06:00
MIGRATION.txt qemu: Implement migration job phases 2011-07-27 08:45:09 -06:00
qemu_bridge_filter.c Remove conn parameter from virReportSystemError 2010-02-09 01:04:54 +01:00
qemu_bridge_filter.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
qemu_capabilities.c Add USB hub device 2011-09-02 23:38:52 +08:00
qemu_capabilities.h Add USB hub device 2011-09-02 23:38:52 +08:00
qemu_cgroup.c set cpu bandwidth for the vm 2011-07-26 22:12:57 +08:00
qemu_cgroup.h qemu: Implement period and quota tunable XML configuration and parsing 2011-07-21 17:11:12 +08:00
qemu_command.c Add "redirdev" redirection device 2011-09-02 23:39:03 +08:00
qemu_command.h Add "redirdev" redirection device 2011-09-02 23:39:03 +08:00
qemu_conf.c build: support warnings on RHEL 5 2011-07-27 07:31:38 -06:00
qemu_conf.h save: support bypass-cache flag in qemu.conf 2011-07-21 16:24:09 -06:00
qemu_domain.c qemu: fix crash when mixing sync and async monitor jobs 2011-08-01 09:41:57 -06:00
qemu_domain.h qemu: fix crash when mixing sync and async monitor jobs 2011-08-01 09:41:57 -06:00
qemu_driver.c snapshot: avoid crash when deleting qemu snapshots 2011-09-02 16:04:32 -06:00
qemu_driver.h Split all QEMU process mangement code into separate file 2011-02-17 12:48:55 +00:00
qemu_hostdev.c pci: fix pciDeviceListSteal on multiple devices 2011-08-24 10:31:29 -06:00
qemu_hostdev.h Move QEMU hostdev helper code out of the QEMU driver 2010-12-17 13:50:21 +00:00
qemu_hotplug.c Add "redirdev" redirection device 2011-09-02 23:39:03 +08:00
qemu_hotplug.h Add "redirdev" redirection device 2011-09-02 23:39:03 +08:00
qemu_migration.c qemu: refactor file opening 2011-09-01 22:08:13 -06:00
qemu_migration.h qemu: refactor file opening 2011-09-01 22:08:13 -06:00
qemu_monitor_json.c BlockPull: Set initial bandwidth limit if specified 2011-09-01 20:11:50 -06:00
qemu_monitor_json.h Implement virDomainBlockPull for the qemu driver 2011-07-22 13:39:37 +08:00
qemu_monitor_text.c BlockJob: Bandwidth parameter is in MB when using text monitor 2011-09-01 20:11:50 -06:00
qemu_monitor_text.h Implement virDomainBlockPull for the qemu driver 2011-07-22 13:39:37 +08:00
qemu_monitor.c Asynchronous event for BlockJob completion 2011-07-22 13:57:42 +08:00
qemu_monitor.h Asynchronous event for BlockJob completion 2011-07-22 13:57:42 +08:00
qemu_process.c Fix sanlock socket security labelling 2011-08-31 11:07:31 +01:00
qemu_process.h snapshot: only pass snapshot to qemu command line when reverting 2011-08-25 15:07:57 -06:00
qemu.conf Correct the default value of lock_manager in qemu.conf 2011-08-01 21:15:46 +08:00
test_libvirtd_qemu.aug Integrate the QEMU driver with the lock manager infrastructure 2011-06-02 10:54:01 +01:00
THREADS.txt qemu: fix crash when mixing sync and async monitor jobs 2011-08-01 09:41:57 -06:00