]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: guest agent: introduce new error code VIR_ERR_AGENT_UNSYNCED
authorYuri Pudgorodskiy <yur@virtuozzo.com>
Thu, 28 Jan 2016 08:55:09 +0000 (11:55 +0300)
committerMaxim Nestratov <mnestratov@virtuozzo.com>
Wed, 7 Sep 2016 09:35:18 +0000 (12:35 +0300)
A separate error code will help recognize real failures from
necessity to try again

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
include/libvirt/virterror.h
src/qemu/qemu_agent.c
src/util/virerror.c

index 2ec560e063c7d171d5dd44462b2af9ae9bd9d29d..efe83aadb2b3f5a725dc5c38edf4d1085d6c83b6 100644 (file)
@@ -315,6 +315,8 @@ typedef enum {
     VIR_ERR_AUTH_UNAVAILABLE = 94,     /* authentication unavailable */
     VIR_ERR_NO_SERVER = 95,             /* Server was not found */
     VIR_ERR_NO_CLIENT = 96,             /* Client was not found */
+    VIR_ERR_AGENT_UNSYNCED = 97,        /* guest agent replies with wrong id
+                                           to guest-sync command */
 } virErrorNumber;
 
 /**
index eeede6b1dab7795238cbebf20300abbde9d78598..fdc4fed277e4255c4960b886c10f836abecc58e1 100644 (file)
@@ -966,21 +966,21 @@ qemuAgentGuestSync(qemuAgentPtr mon)
         goto cleanup;
 
     if (!sync_msg.rxObject) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+        virReportError(VIR_ERR_AGENT_UNSYNCED, "%s",
                        _("Missing monitor reply object"));
         goto cleanup;
     }
 
     if (virJSONValueObjectGetNumberUlong(sync_msg.rxObject,
                                          "return", &id_ret) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+        virReportError(VIR_ERR_AGENT_UNSYNCED, "%s",
                        _("Malformed return value"));
         goto cleanup;
     }
 
     VIR_DEBUG("Guest returned ID: %llu", id_ret);
     if (id_ret != id) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_AGENT_UNSYNCED,
                        _("Guest agent returned ID: %llu instead of %llu"),
                        id_ret, id);
         goto cleanup;
index 1177570ef0d540249302ca14cb5ea00d0681c962..29583084e94a3cf13172d6887637fcd293776d71 100644 (file)
@@ -1394,6 +1394,12 @@ virErrorMsg(virErrorNumber error, const char *info)
             else
                 errmsg = _("Client not found: %s");
             break;
+        case VIR_ERR_AGENT_UNSYNCED:
+            if (info == NULL)
+                errmsg = _("guest agent replied with wrong id to guest-sync command");
+            else
+                errmsg = _("guest agent replied with wrong id to guest-sync command: %s");
+            break;
     }
     return errmsg;
 }