mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
qemu: agent: reissue sync on garbage sync reply
We can easily handle receiving garbage on sync. We don't have to make client deal with this situation. We just need to resend sync command but this time garbage is not be possible.
This commit is contained in:
parent
5e5019bf78
commit
3f90a1aac0
@ -85,6 +85,7 @@ struct _qemuAgentMessage {
|
|||||||
bool sync;
|
bool sync;
|
||||||
/* id of the issued sync comand */
|
/* id of the issued sync comand */
|
||||||
unsigned long long id;
|
unsigned long long id;
|
||||||
|
bool first;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -316,8 +317,8 @@ qemuAgentIOProcessLine(qemuAgentPtr mon,
|
|||||||
VIR_DEBUG("Line [%s]", line);
|
VIR_DEBUG("Line [%s]", line);
|
||||||
|
|
||||||
if (!(obj = virJSONValueFromString(line))) {
|
if (!(obj = virJSONValueFromString(line))) {
|
||||||
/* receiving garbage on sync is regular situation */
|
/* receiving garbage on first sync is regular situation */
|
||||||
if (msg && msg->sync) {
|
if (msg && msg->sync && msg->first) {
|
||||||
VIR_DEBUG("Received garbage on sync");
|
VIR_DEBUG("Received garbage on sync");
|
||||||
msg->finished = 1;
|
msg->finished = 1;
|
||||||
return 0;
|
return 0;
|
||||||
@ -959,7 +960,10 @@ qemuAgentGuestSync(qemuAgentPtr mon)
|
|||||||
qemuAgentMessage sync_msg;
|
qemuAgentMessage sync_msg;
|
||||||
|
|
||||||
memset(&sync_msg, 0, sizeof(sync_msg));
|
memset(&sync_msg, 0, sizeof(sync_msg));
|
||||||
|
/* set only on first sync */
|
||||||
|
sync_msg.first = true;
|
||||||
|
|
||||||
|
retry:
|
||||||
if (virTimeMillisNow(&id) < 0)
|
if (virTimeMillisNow(&id) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -983,9 +987,15 @@ qemuAgentGuestSync(qemuAgentPtr mon)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!sync_msg.rxObject) {
|
if (!sync_msg.rxObject) {
|
||||||
virReportError(VIR_ERR_AGENT_UNSYNCED, "%s",
|
if (sync_msg.first) {
|
||||||
_("Missing monitor reply object"));
|
VIR_FREE(sync_msg.txBuffer);
|
||||||
goto cleanup;
|
memset(&sync_msg, 0, sizeof(sync_msg));
|
||||||
|
goto retry;
|
||||||
|
} else {
|
||||||
|
virReportError(VIR_ERR_AGENT_UNSYNCED, "%s",
|
||||||
|
_("Missing monitor reply object"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user