[libvirt] [PATCH v2 1/3] qemuDomainUpdateDeviceFlags: Parse device as live if needed

Michal Privoznik posted 3 patches 7 years, 7 months ago
[libvirt] [PATCH v2 1/3] qemuDomainUpdateDeviceFlags: Parse device as live if needed
Posted by Michal Privoznik 7 years, 7 months ago
When updating device it's worth parsing live info too as users
might want to update it as well.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_driver.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 129bacdd34..e3fb4919a5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8631,7 +8631,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
     int ret = -1;
     virQEMUDriverConfigPtr cfg = NULL;
     virCapsPtr caps = NULL;
-    unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
+    unsigned int parse_flags = 0;
 
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
                   VIR_DOMAIN_AFFECT_CONFIG |
@@ -8653,15 +8653,19 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
     if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;
 
+    if (virDomainObjUpdateModificationImpact(vm, &flags) < 0)
+        goto endjob;
+
+    if ((flags & VIR_DOMAIN_AFFECT_CONFIG) &&
+        !(flags & VIR_DOMAIN_AFFECT_LIVE))
+        parse_flags |= VIR_DOMAIN_DEF_PARSE_INACTIVE;
+
     dev = dev_copy = virDomainDeviceDefParse(xml, vm->def,
                                              caps, driver->xmlopt,
                                              parse_flags);
     if (dev == NULL)
         goto endjob;
 
-    if (virDomainObjUpdateModificationImpact(vm, &flags) < 0)
-        goto endjob;
-
     if (flags & VIR_DOMAIN_AFFECT_CONFIG &&
         flags & VIR_DOMAIN_AFFECT_LIVE) {
         /* If we are affecting both CONFIG and LIVE
-- 
2.16.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 1/3] qemuDomainUpdateDeviceFlags: Parse device as live if needed
Posted by John Ferlan 7 years, 7 months ago

On 06/26/2018 06:21 AM, Michal Privoznik wrote:
> When updating device it's worth parsing live info too as users
> might want to update it as well.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> 
> Reviewed-by: John Ferlan <jferlan@redhat.com>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

^^ Clean this up - I assume you added the R-by and the extra which
caused your automatic one to be confused and thus add another for the
send - just check to see if it's clean in whatever is pushed...

John

> ---
>  src/qemu/qemu_driver.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 

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