提交 aa3e8bd4 编写于 作者: M Michal Privoznik

Introduce new VIR_ERR_AGENT_UNRESPONSIVE error code

Currently, when guest agent is configured but not responsive
(e.g. due to appropriate service not running in the guest)
we return VIR_ERR_INTERNAL_ERROR. Both are wrong. Therefore
we need to introduce new error code to reflect this case.
上级 1fe6d219
...@@ -283,6 +283,8 @@ typedef enum { ...@@ -283,6 +283,8 @@ typedef enum {
VIR_ERR_OPERATION_UNSUPPORTED = 84, /* The requested operation is not VIR_ERR_OPERATION_UNSUPPORTED = 84, /* The requested operation is not
supported */ supported */
VIR_ERR_SSH = 85, /* error in ssh transport driver */ VIR_ERR_SSH = 85, /* error in ssh transport driver */
VIR_ERR_AGENT_UNRESPONSIVE = 86, /* guest agent is unresponsive,
not running or not usable */
} virErrorNumber; } virErrorNumber;
/** /**
......
...@@ -880,7 +880,7 @@ static int qemuAgentSend(qemuAgentPtr mon, ...@@ -880,7 +880,7 @@ static int qemuAgentSend(qemuAgentPtr mon,
if ((timeout && virCondWaitUntil(&mon->notify, &mon->lock, then) < 0) || if ((timeout && virCondWaitUntil(&mon->notify, &mon->lock, then) < 0) ||
(!timeout && virCondWait(&mon->notify, &mon->lock) < 0)) { (!timeout && virCondWait(&mon->notify, &mon->lock) < 0)) {
if (errno == ETIMEDOUT) { if (errno == ETIMEDOUT) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s",
_("Guest agent not available for now")); _("Guest agent not available for now"));
ret = -2; ret = -2;
} else { } else {
......
...@@ -1734,8 +1734,9 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags) { ...@@ -1734,8 +1734,9 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags) {
if (useAgent) { if (useAgent) {
if (priv->agentError) { if (priv->agentError) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s",
_("QEMU guest agent is not available due to an error")); _("QEMU guest agent is not "
"available due to an error"));
goto cleanup; goto cleanup;
} }
if (!priv->agent) { if (!priv->agent) {
...@@ -1815,8 +1816,9 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags) ...@@ -1815,8 +1816,9 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
if (useAgent) { if (useAgent) {
if (priv->agentError) { if (priv->agentError) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s",
_("QEMU guest agent is not available due to an error")); _("QEMU guest agent is not "
"available due to an error"));
goto cleanup; goto cleanup;
} }
if (!priv->agent) { if (!priv->agent) {
...@@ -10391,7 +10393,7 @@ qemuDomainSnapshotFSFreeze(struct qemud_driver *driver, ...@@ -10391,7 +10393,7 @@ qemuDomainSnapshotFSFreeze(struct qemud_driver *driver,
int freezed; int freezed;
if (priv->agentError) { if (priv->agentError) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s",
_("QEMU guest agent is not " _("QEMU guest agent is not "
"available due to an error")); "available due to an error"));
return -1; return -1;
...@@ -10419,7 +10421,7 @@ qemuDomainSnapshotFSThaw(struct qemud_driver *driver, ...@@ -10419,7 +10421,7 @@ qemuDomainSnapshotFSThaw(struct qemud_driver *driver,
if (priv->agentError) { if (priv->agentError) {
if (report) if (report)
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s",
_("QEMU guest agent is not " _("QEMU guest agent is not "
"available due to an error")); "available due to an error"));
return -1; return -1;
...@@ -13708,8 +13710,9 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, ...@@ -13708,8 +13710,9 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
} }
if (priv->agentError) { if (priv->agentError) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s",
_("QEMU guest agent is not available due to an error")); _("QEMU guest agent is not "
"available due to an error"));
goto cleanup; goto cleanup;
} }
...@@ -13849,8 +13852,9 @@ qemuDomainAgentCommand(virDomainPtr domain, ...@@ -13849,8 +13852,9 @@ qemuDomainAgentCommand(virDomainPtr domain,
} }
if (priv->agentError) { if (priv->agentError) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s",
_("QEMU guest agent is not available due to an error")); _("QEMU guest agent is not "
"available due to an error"));
goto cleanup; goto cleanup;
} }
......
...@@ -1199,6 +1199,13 @@ virErrorMsg(virErrorNumber error, const char *info) ...@@ -1199,6 +1199,13 @@ virErrorMsg(virErrorNumber error, const char *info)
errmsg = _("SSH transport error"); errmsg = _("SSH transport error");
else else
errmsg = _("SSH transport error: %s"); errmsg = _("SSH transport error: %s");
break;
case VIR_ERR_AGENT_UNRESPONSIVE:
if (info == NULL)
errmsg = _("Guest agent is not responding");
else
errmsg = _("Guest agent is not responding: %s");
break;
} }
return errmsg; return errmsg;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册