virObjectLock(vm);
priv->agentStart = 0;
+ if (agent == NULL)
+ virObjectUnref(vm);
+
+ if (!virDomainObjIsActive(vm)) {
+ qemuAgentClose(agent);
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("guest crashed while connecting to the guest agent"));
+ ret = -2;
+ goto cleanup;
+ }
+
if (virSecurityManagerClearSocketLabel(driver->securityManager,
vm->def) < 0) {
VIR_ERROR(_("Failed to clear security context for agent for %s"),
goto cleanup;
}
- if (agent == NULL)
- virObjectUnref(vm);
- if (!virDomainObjIsActive(vm)) {
- qemuAgentClose(agent);
- goto cleanup;
- }
priv->agent = agent;
if (priv->agent == NULL) {
int reason;
virQEMUDriverConfigPtr cfg;
size_t i;
+ int ret;
memcpy(&oldjob, &data->oldjob, sizeof(oldjob));
goto error;
/* Failure to connect to agent shouldn't be fatal */
- if (qemuConnectAgent(driver, obj) < 0) {
+ if ((ret = qemuConnectAgent(driver, obj)) < 0) {
+ if (ret == -2)
+ goto error;
+
VIR_WARN("Cannot connect to QEMU guest agent for %s",
obj->def->name);
virResetLastError();
goto cleanup;
/* Failure to connect to agent shouldn't be fatal */
- if (qemuConnectAgent(driver, vm) < 0) {
+ if ((ret = qemuConnectAgent(driver, vm)) < 0) {
+ if (ret == -2)
+ goto cleanup;
+
VIR_WARN("Cannot connect to QEMU guest agent for %s",
vm->def->name);
virResetLastError();
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
virCapsPtr caps = NULL;
bool active = false;
+ int ret;
VIR_DEBUG("Beginning VM attach process");
goto error;
/* Failure to connect to agent shouldn't be fatal */
- if (qemuConnectAgent(driver, vm) < 0) {
+ if ((ret = qemuConnectAgent(driver, vm)) < 0) {
+ if (ret == -2)
+ goto error;
+
VIR_WARN("Cannot connect to QEMU guest agent for %s",
vm->def->name);
virResetLastError();