]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: agent: ignore delayed reply when unsynced
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Fri, 16 Sep 2016 10:35:32 +0000 (13:35 +0300)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 20 Sep 2016 14:27:58 +0000 (16:27 +0200)
Errors in qemuAgentIOProcessLine stop agent IO processing just
like any regular IO error, however some of current errors
that this functions spawns are false positives. Consider
next case for example:

1. send sync (unsynced state)
2. receive sync reply (sync established)
3. command send, but timeout occured (unsynced state)
4. receive command reply

Last IO triggers error because current code ignores
only delayed syncs when unsynced

We should not treat any delayed reply as error in unsynced
state. Until client and qga are not in sync delayed reply to any
command is possible. msg == NULL is the exact criterion
that we are not in sync.

src/qemu/qemu_agent.c

index e8b7186b1c86487560ae4d069dfeecc7d6789ec5..18cc473ad4f717f4176d69c8ac9ebd04c002b436 100644 (file)
@@ -308,7 +308,6 @@ qemuAgentIOProcessLine(qemuAgentPtr mon,
 {
     virJSONValuePtr obj = NULL;
     int ret = -1;
-    unsigned long long id;
 
     VIR_DEBUG("Line [%s]", line);
 
@@ -331,25 +330,11 @@ qemuAgentIOProcessLine(qemuAgentPtr mon,
             msg->rxObject = obj;
             msg->finished = 1;
             obj = NULL;
-            ret = 0;
         } else {
-            /* If we've received something like:
-             *  {"return": 1234}
-             * it is likely that somebody started GA
-             * which is now processing our previous
-             * guest-sync commands. Check if this is
-             * the case and don't report an error but
-             * return silently.
-             */
-            if (virJSONValueObjectGetNumberUlong(obj, "return", &id) == 0) {
-                VIR_DEBUG("Ignoring delayed reply to guest-sync: %llu", id);
-                ret = 0;
-                goto cleanup;
-            }
-
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Unexpected JSON reply '%s'"), line);
+            /* we are out of sync */
+            VIR_DEBUG("Ignoring delayed reply");
         }
+        ret = 0;
     } else {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unknown JSON reply '%s'"), line);