When doing a memory-only snapshot libvirt would still issue the
'transaction' command without any disk. Skip it if it isn't necessary.
---
src/qemu/qemu_driver.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1161aa0..39c2c05 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14331,6 +14331,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virJSONValuePtr actions = NULL;
+ bool do_transaction = false;
int ret = 0;
size_t i;
bool persist = false;
@@ -14379,9 +14380,11 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
reuse, asyncJob);
if (ret < 0)
break;
+
+ do_transaction = true;
}
if (actions) {
- if (ret == 0) {
+ if (ret == 0 && do_transaction) {
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
ret = qemuMonitorTransaction(priv->mon, actions);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
@@ -14390,6 +14393,8 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
/* failed to enter monitor, clean stuff up and quit */
ret = -1;
}
+ } else {
+ VIR_DEBUG("no disks to snapshot, skipping 'transaction'
command");
}
virJSONValueFree(actions);
--
2.6.2