Skip to contentSkip to conversation

hmp: delvm: use hmp_handle_error

PATCH In review Cole Robinson 2 participants 2 messages Apr 24, 2019 – May 1, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hmp: delvm: use hmp_handle_error

This gives us the consistent 'Error:' prefix added in 66363e9a43f, which helps users like libvirt who still need to scrape hmp error messages to detect failure.

---
v2:
Drop now redundant "Error while" string prefix

 hmp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hmp.c +4 -3
index 4bb3af748e..56a3ed7375 100644
@@ -1480,10 +1480,11 @@ void hmp_delvm(Monitor *mon, const QDict *qdict)
     const char *name = qdict_get_str(qdict, "name");
 
     if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) {
-        error_reportf_err(err,
-                          "Error while deleting snapshot on device '%s': ",
-                          bdrv_get_device_name(bs));
+        error_prepend(&err,
+                      "deleting snapshot on device '%s': ",
+                      bdrv_get_device_name(bs));
     }
+    hmp_handle_error(mon, &err);
 }
 
 void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
Signature · 1 line
2.21.0
#1 lore raw
Quoted 6 lines · * Cole Robinson ([email protected]) wrote:

This gives us the consistent 'Error:' prefix added in 66363e9a43f, which helps users like libvirt who still need to scrape hmp error messages to detect failure.

Queued

Quoted 29 lines

---
v2:
Drop now redundant "Error while" string prefix

 hmp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hmp.c +4 -3
index 4bb3af748e..56a3ed7375 100644
@@ -1480,10 +1480,11 @@ void hmp_delvm(Monitor *mon, const QDict *qdict)
     const char *name = qdict_get_str(qdict, "name");
 
     if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) {
-        error_reportf_err(err,
-                          "Error while deleting snapshot on device '%s': ",
-                          bdrv_get_device_name(bs));
+        error_prepend(&err,
+                      "deleting snapshot on device '%s': ",
+                      bdrv_get_device_name(bs));
     }
+    hmp_handle_error(mon, &err);
 }
 
 void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
Signature · 1 line
2.21.0

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK