]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: monitor cleanup delvm error handling
authorCole Robinson <crobinso@redhat.com>
Wed, 10 Apr 2019 17:43:39 +0000 (13:43 -0400)
committerCole Robinson <crobinso@redhat.com>
Tue, 23 Apr 2019 15:05:44 +0000 (11:05 -0400)
Drop redundant NULL checks, and add an error string prefix

Acked-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
src/qemu/qemu_monitor_text.c

index 414da0ca28f9e7c2b0b22391889a52f5d7ea891c..76095674ab854d99cb8756992e0249c6cd45c6d2 100644 (file)
@@ -259,16 +259,17 @@ int qemuMonitorTextDeleteSnapshot(qemuMonitorPtr mon, const char *name)
     if (qemuMonitorHMPCommand(mon, cmd, &reply))
         goto cleanup;
 
-    if (strstr(reply, "No block device supports snapshots") != NULL) {
+    if (strstr(reply, "No block device supports snapshots")) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("this domain does not have a device to delete snapshots"));
         goto cleanup;
-    } else if (strstr(reply, "Snapshots not supported on device") != NULL) {
+    } else if (strstr(reply, "Snapshots not supported on device")) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s", reply);
         goto cleanup;
-    } else if (strstr(reply, "Error") != NULL
-             && strstr(reply, "while deleting snapshot") != NULL) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s", reply);
+    } else if (strstr(reply, "Error") &&
+               strstr(reply, "while deleting snapshot")) {
+        virReportError(VIR_ERR_OPERATION_FAILED,
+                       _("Failed to delete snapshot: %s"), reply);
         goto cleanup;
     }