[libvirt] [PATCH] snapshot: detect when qemu lacks disk-snapshot support

Eric Blake eblake at redhat.com
Tue Oct 18 21:51:05 UTC 2011


Noticed when testing new libvirt against old qemu that lacked the
snapshot_blkdev HMP command.  Libvirt was mistakenly treating the
command as successful, and re-writing the domain XML to use the
just-created 0-byte file, rendering the domain broken on restart.

* src/qemu/qemu_monitor_text.c (qemuMonitorTextDiskSnapshot):
Notice another possible error message.
---
 src/qemu/qemu_monitor_text.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 2f31d99..4774df9 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -3064,7 +3064,8 @@ qemuMonitorTextDiskSnapshot(qemuMonitorPtr mon, const char *device,
         goto cleanup;
     }

-    if (strstr(reply, "error while creating qcow2") != NULL) {
+    if (strstr(reply, "error while creating qcow2") != NULL ||
+        strstr(reply, "unknown command:") != NULL) {
         qemuReportError(VIR_ERR_OPERATION_FAILED,
                         _("Failed to take snapshot: %s"), reply);
         goto cleanup;
-- 
1.7.4.4




More information about the libvir-list mailing list