[PATCHv2 01/13] conf: Fix virDomainObjGetDefs when getting persistent config on a live vm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
---
Version 2 actually fixes the function.

 src/conf/domain_conf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ca55981..3cc182b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2933,11 +2933,11 @@ virDomainObjGetDefs(virDomainObjPtr vm,
     if (virDomainObjUpdateModificationImpact(vm, &flags) < 0)
         return -1;

-    if (flags & VIR_DOMAIN_AFFECT_LIVE) {
-        if (liveDef)
+    if (virDomainObjIsActive(vm)) {
+        if (liveDef && (flags & VIR_DOMAIN_AFFECT_LIVE))
             *liveDef = vm->def;

-        if (persDef)
+        if (persDef && (flags & VIR_DOMAIN_AFFECT_CONFIG))
             *persDef = vm->newDef;
     } else {
         if (persDef)
-- 
2.4.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]