On Tue, May 17, 2016 at 12:36:54AM +0300, Katerina Koukiou wrote:
> Use the recently added job functions and unlock the virDomainObj while
> performing the respective modify operation.
> This commit affects lxcDomain{DestroyFlags, Reboot, SetBlkioParameters,
> SetMemoryParameters, SetMetadata, SetSchedulerParameterFlags, ShutdownFlags}
> 
> Signed-off-by: Katerina Koukiou <k.kouk...@gmail.com>
> ---
>  src/lxc/lxc_driver.c | 114 
> +++++++++++++++++++++++++++++++++++++--------------
>  1 file changed, 83 insertions(+), 31 deletions(-)
> 
> diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
> index 2d610f4..7cdea2c 100644
> --- a/src/lxc/lxc_driver.c
> +++ b/src/lxc/lxc_driver.c
> @@ -857,16 +857,19 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,

Adding extra context:

    if (virDomainSetMemoryParametersEnsureACL(dom->conn, vm->def, flags) < 0 ||
        !(caps = virLXCDriverGetCapabilities(driver, false)) ||
        virDomainLiveConfigHelperMethod(caps, driver->xmlopt,
>                                          vm, &flags, &vmdef) < 0)
>          goto cleanup;
>  
> +    if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0)
> +        goto cleanup;

This should be called between the virDomainSetMemoryParametersEnsureACL and
virDomainLiveConfigHelperMethod calls above.

In virDomainLiveConfigHelperMethod, there is a check to see if the
domain is active when AFFECT_LIVE is set.

Since virLXCDomainObjBeginJob unlocks the virDomainObjPtr lock,
the domain could possibly be destroyed while we wait for the job
and the check results would no longer be valid.

(Found while trying to remove the remaining uses of
 virDomainLiveConfigHelperMethod)

Jan

> +
>      if (flags & VIR_DOMAIN_AFFECT_LIVE &&
>          !virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_MEMORY)) 
> {
>          virReportError(VIR_ERR_OPERATION_INVALID,
>                         "%s", _("cgroup memory controller is not mounted"));

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

Reply via email to