diff mbox series

[2/3] qemu: monitor cleanup delvm error handling

Message ID 3dca227ff69081be71af1c52ac6283798fd50d24.1554919494.git.crobinso@redhat.com
State Accepted
Commit d9ed7bb1dd4d4c4e44b6a1a56c1bdf9852cb2ee5
Headers show
Series qemu: monitor: detect more snapshot errors | expand

Commit Message

Cole Robinson April 10, 2019, 6:29 p.m. UTC
Drop redundant NULL checks, and add an error string prefix

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/qemu/qemu_monitor_text.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox series

Patch

diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 414da0ca28..76095674ab 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -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;
     }