mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +00:00
Factor out def assignment to existing domain from virDomainAssignDef
We need to be able to assign new def to an existing virDomainObj which is already locked. This patch factors out the relevant code from virDomainAssignDef into virDomainObjAssignDef.
This commit is contained in:
parent
de5a60e1cc
commit
575cf9a9ce
@ -808,15 +808,10 @@ static virDomainObjPtr virDomainObjNew(virCapsPtr caps)
|
||||
return domain;
|
||||
}
|
||||
|
||||
virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
|
||||
virDomainObjListPtr doms,
|
||||
void virDomainObjAssignDef(virDomainObjPtr domain,
|
||||
const virDomainDefPtr def,
|
||||
bool live)
|
||||
{
|
||||
virDomainObjPtr domain;
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
|
||||
if ((domain = virDomainFindByUUID(doms, def->uuid))) {
|
||||
if (!virDomainObjIsActive(domain)) {
|
||||
if (live) {
|
||||
/* save current configuration to be restored on domain shutdown */
|
||||
@ -831,7 +826,18 @@ virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
|
||||
virDomainDefFree(domain->newDef);
|
||||
domain->newDef = def;
|
||||
}
|
||||
}
|
||||
|
||||
virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
|
||||
virDomainObjListPtr doms,
|
||||
const virDomainDefPtr def,
|
||||
bool live)
|
||||
{
|
||||
virDomainObjPtr domain;
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
|
||||
if ((domain = virDomainFindByUUID(doms, def->uuid))) {
|
||||
virDomainObjAssignDef(domain, def, live);
|
||||
return domain;
|
||||
}
|
||||
|
||||
|
@ -954,6 +954,9 @@ virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
|
||||
virDomainObjListPtr doms,
|
||||
const virDomainDefPtr def,
|
||||
bool live);
|
||||
void virDomainObjAssignDef(virDomainObjPtr domain,
|
||||
const virDomainDefPtr def,
|
||||
bool live);
|
||||
void virDomainRemoveInactive(virDomainObjListPtr doms,
|
||||
virDomainObjPtr dom);
|
||||
|
||||
|
@ -215,6 +215,7 @@ virDomainSnapshotObjUnref;
|
||||
virDomainSnapshotDefParseString;
|
||||
virDomainSnapshotDefFormat;
|
||||
virDomainSnapshotAssignDef;
|
||||
virDomainObjAssignDef;
|
||||
|
||||
|
||||
# domain_event.h
|
||||
|
Loading…
x
Reference in New Issue
Block a user