mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-09 06:50:22 +00:00
conf: Fix virDomainObjGetDefs when getting persistent config on a live vm
If @flags contains only VIR_DOMAIN_AFFECT_CONFIG and @vm is active, the function would return the active config rather than the persistent one that it should return. This happened due to the fact that virDomainObjGetDefs was checking the updated flags which may not contain VIR_DOMAIN_AFFECT_LIVE if it is not requested even if @vm is active. Additionally the function would not take the flags into account when setting the pointers which was later used to determine whether the code needs to update the given configuration. The mistake was caught by the virt-test suite.
This commit is contained in:
parent
f486bb0494
commit
63aaf69bbe
@ -2933,11 +2933,11 @@ virDomainObjGetDefs(virDomainObjPtr vm,
|
|||||||
if (virDomainObjUpdateModificationImpact(vm, &flags) < 0)
|
if (virDomainObjUpdateModificationImpact(vm, &flags) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
if (liveDef)
|
if (liveDef && (flags & VIR_DOMAIN_AFFECT_LIVE))
|
||||||
*liveDef = vm->def;
|
*liveDef = vm->def;
|
||||||
|
|
||||||
if (persDef)
|
if (persDef && (flags & VIR_DOMAIN_AFFECT_CONFIG))
|
||||||
*persDef = vm->newDef;
|
*persDef = vm->newDef;
|
||||||
} else {
|
} else {
|
||||||
if (persDef)
|
if (persDef)
|
||||||
|
Loading…
Reference in New Issue
Block a user