Re: [PATCH v2 2/2] lxc: Rearrange order in lxcDomainUpdateDeviceFlags

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

 



On 06/30/2018 04:51 PM, John Ferlan wrote:
> Although commit e3497f3f noted that the LIVE option doesn't
> matter and removed the call to virDomainDefCompatibleDevice,
> it didn't go quite far enough and change the order of the checks
> and rework the code to just handle the config change causing
> a failure after virDomainObjUpdateModificationImpact updates
> the @flags. Since we only support config a lot of previously
> conditional code is now just inlined.
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/lxc/lxc_driver.c | 63 ++++++++++++++++++----------------------------------
>  1 file changed, 21 insertions(+), 42 deletions(-)
> 
> diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
> index aea48e5e3d..72c6daa507 100644
> --- a/src/lxc/lxc_driver.c
> +++ b/src/lxc/lxc_driver.c
> @@ -4827,7 +4827,7 @@ static int lxcDomainUpdateDeviceFlags(virDomainPtr dom,
>      virCapsPtr caps = NULL;
>      virDomainObjPtr vm = NULL;
>      virDomainDefPtr vmdef = NULL;
> -    virDomainDeviceDefPtr dev = NULL, dev_copy = NULL;
> +    virDomainDeviceDefPtr dev = NULL;
>      int ret = -1;
>      virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver);
>  

> -        }

> +    ret = virDomainSaveConfig(cfg->configDir, driver->caps, vmdef);
> +    if (!ret) {
> +        virDomainObjAssignDef(vm, vmdef, false, NULL);
> +        vmdef = NULL;
>      }

Well, this can be written a bit nicer:

    if (virDomainSaveConfig(cfg->configDir, driver->caps, vmdef) < 0)
        goto endjob;

    virDomainObjAssignDef(vm, vmdef, false, NULL);
    vmdef = NULL;
    ret = 0;

Michal

--
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]

  Powered by Linux