[libvirt] [PATCH] 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. The mistake was caught by the virt-test suite. --- src/conf/domain_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2e79610..fd38c5d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2933,7 +2933,7 @@ virDomainObjGetDefs(virDomainObjPtr vm, if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) return -1; - if (flags & VIR_DOMAIN_AFFECT_LIVE) { + if (virDomainObjIsActive(vm)) { if (liveDef) *liveDef = vm->def; -- 2.4.1

On Fri, Jun 12, 2015 at 14:41:03 +0200, Peter Krempa wrote:
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.
The mistake was caught by the virt-test suite. --- src/conf/domain_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2e79610..fd38c5d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2933,7 +2933,7 @@ virDomainObjGetDefs(virDomainObjPtr vm, if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) return -1;
- if (flags & VIR_DOMAIN_AFFECT_LIVE) { + if (virDomainObjIsActive(vm)) { if (liveDef) *liveDef = vm->def;
Self NACK, this patch is incomplete and would not work correctly. Peter
participants (1)
-
Peter Krempa