mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
test: Break out wrapper for setting up started domain state.
This should be a no op for now, but we will use this function to set up transient state in the future.
This commit is contained in:
parent
7624b47d1e
commit
4e40aee273
@ -325,6 +325,17 @@ testDomainGenerateIfnames(virConnectPtr conn,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
testDomainStartState(virConnectPtr conn,
|
||||||
|
virDomainObjPtr dom)
|
||||||
|
{
|
||||||
|
testConnPtr privconn = conn->privateData;
|
||||||
|
|
||||||
|
dom->state = VIR_DOMAIN_RUNNING;
|
||||||
|
dom->def->id = privconn->nextDomID++;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int testOpenDefault(virConnectPtr conn) {
|
static int testOpenDefault(virConnectPtr conn) {
|
||||||
int u;
|
int u;
|
||||||
@ -391,8 +402,12 @@ static int testOpenDefault(virConnectPtr conn) {
|
|||||||
&privconn->domains, domdef)))
|
&privconn->domains, domdef)))
|
||||||
goto error;
|
goto error;
|
||||||
domdef = NULL;
|
domdef = NULL;
|
||||||
domobj->def->id = privconn->nextDomID++;
|
|
||||||
domobj->state = VIR_DOMAIN_RUNNING;
|
if (testDomainStartState(conn, domobj) < 0) {
|
||||||
|
virDomainObjUnlock(domobj);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
domobj->persistent = 1;
|
domobj->persistent = 1;
|
||||||
virDomainObjUnlock(domobj);
|
virDomainObjUnlock(domobj);
|
||||||
|
|
||||||
@ -746,8 +761,11 @@ static int testOpenFromFile(virConnectPtr conn,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
dom->state = VIR_DOMAIN_RUNNING;
|
if (testDomainStartState(conn, dom) < 0) {
|
||||||
dom->def->id = privconn->nextDomID++;
|
virDomainObjUnlock(dom);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
dom->persistent = 1;
|
dom->persistent = 1;
|
||||||
virDomainObjUnlock(dom);
|
virDomainObjUnlock(dom);
|
||||||
}
|
}
|
||||||
@ -1083,8 +1101,9 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
|
|||||||
&privconn->domains, def)))
|
&privconn->domains, def)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
def = NULL;
|
def = NULL;
|
||||||
dom->state = VIR_DOMAIN_RUNNING;
|
|
||||||
dom->def->id = privconn->nextDomID++;
|
if (testDomainStartState(conn, dom) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
event = virDomainEventNewFromObj(dom,
|
event = virDomainEventNewFromObj(dom,
|
||||||
VIR_DOMAIN_EVENT_STARTED,
|
VIR_DOMAIN_EVENT_STARTED,
|
||||||
@ -1633,8 +1652,9 @@ static int testDomainRestore(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
def = NULL;
|
def = NULL;
|
||||||
|
|
||||||
dom->state = VIR_DOMAIN_RUNNING;
|
if (testDomainStartState(conn, dom) < 0)
|
||||||
dom->def->id = privconn->nextDomID++;
|
goto cleanup;
|
||||||
|
|
||||||
event = virDomainEventNewFromObj(dom,
|
event = virDomainEventNewFromObj(dom,
|
||||||
VIR_DOMAIN_EVENT_STARTED,
|
VIR_DOMAIN_EVENT_STARTED,
|
||||||
VIR_DOMAIN_EVENT_STARTED_RESTORED);
|
VIR_DOMAIN_EVENT_STARTED_RESTORED);
|
||||||
@ -1993,8 +2013,10 @@ static int testDomainCreate(virDomainPtr domain) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
domain->id = privdom->def->id = privconn->nextDomID++;
|
if (testDomainStartState(domain->conn, privdom) < 0)
|
||||||
privdom->state = VIR_DOMAIN_RUNNING;
|
goto cleanup;
|
||||||
|
domain->id = privdom->def->id;
|
||||||
|
|
||||||
event = virDomainEventNewFromObj(privdom,
|
event = virDomainEventNewFromObj(privdom,
|
||||||
VIR_DOMAIN_EVENT_STARTED,
|
VIR_DOMAIN_EVENT_STARTED,
|
||||||
VIR_DOMAIN_EVENT_STARTED_BOOTED);
|
VIR_DOMAIN_EVENT_STARTED_BOOTED);
|
||||||
|
Loading…
Reference in New Issue
Block a user