if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
goto cleanup;
+ /* Do this last, since it depends on domain being active */
+ DEBUG0("Setting running domain def as transient");
+ if (virDomainObjSetDefTransient(driver->caps, vm) < 0)
+ goto cleanup;
+
VIR_FORCE_CLOSE(logfile);
return 0;
return ret;
}
+static void
+testDomainShutdownState(virDomainPtr domain,
+ virDomainObjPtr privdom)
+{
+ if (privdom->newDef) {
+ virDomainDefFree(privdom->def);
+ privdom->def = privdom->newDef;
+ privdom->newDef = NULL;
+ }
+
+ privdom->state = VIR_DOMAIN_SHUTOFF;
+ privdom->def->id = -1;
+ if (domain)
+ domain->id = -1;
+}
+
/* Set up domain runtime state */
static int
testDomainStartState(virConnectPtr conn,
if (testDomainUpdateVCPUs(conn, dom, dom->def->vcpus, 1) < 0)
goto cleanup;
- /* Set typical run state */
dom->state = VIR_DOMAIN_RUNNING;
dom->def->id = privconn->nextDomID++;
+ if (virDomainObjSetDefTransient(privconn->caps, dom) < 0) {
+ goto cleanup;
+ }
+
ret = 0;
cleanup:
+ if (ret < 0)
+ testDomainShutdownState(NULL, dom);
return ret;
}
-static void
-testDomainShutdownState(virDomainPtr domain,
- virDomainObjPtr privdom)
-{
- if (privdom->newDef) {
- virDomainDefFree(privdom->def);
- privdom->def = privdom->newDef;
- privdom->newDef = NULL;
- }
-
- privdom->state = VIR_DOMAIN_SHUTOFF;
- privdom->def->id = -1;
- domain->id = -1;
-}
-
static int testOpenDefault(virConnectPtr conn) {
int u;
struct timeval tv;
goto error;
domdef = NULL;
+ domobj->persistent = 1;
if (testDomainStartState(conn, domobj) < 0) {
virDomainObjUnlock(domobj);
goto error;
}
- domobj->persistent = 1;
virDomainObjUnlock(domobj);
if (!(netdef = virNetworkDefParseString(defaultNetworkXML)))
goto error;
}
+ dom->persistent = 1;
if (testDomainStartState(conn, dom) < 0) {
virDomainObjUnlock(dom);
goto error;
}
- dom->persistent = 1;
virDomainObjUnlock(dom);
}
VIR_FREE(domains);
VIR_EXEC_CLEAR_CAPS,
NULL, NULL, NULL);
VIR_FORCE_CLOSE(logfd);
+ if (ret < 0)
+ goto cleanup;
+ ret = virDomainObjSetDefTransient(driver->caps, vm);
+cleanup:
/*
* At the moment, the only thing that populates keepfd is
* umlBuildCommandLineChr. We want to close every fd it opens.
umlCleanupTapDevices(conn, vm);
}
-
/* NB we don't mark it running here - we do that async
with inotify */
/* XXX what if someone else tries to start it again