Re: [PATCH] qemu_driver: fix setting vcpus for offline domain

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

 



On Tue, Jan 13, 2015 at 02:46:03PM +0100, Pavel Hrdina wrote:
> Commit e3435caf fixed hot-plugging of vcpus with strict memory pinning
> on NUMA hosts, but unfortunately it also broke updating number of vcpus
> for offline guests using our API.
> 
> The issue is that we try to create a cpu cgroup for non-running guest
> which fails as there are no cgroups for that domain. We should create
> cgroups and update cpuset.mems only if we are hot-plugging.
> 
> Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 26 ++++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index cdf4173..3a343d0 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -4576,21 +4576,23 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
>  
>      priv = vm->privateData;
>  
> -    if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_temp) < 0)
> -        goto cleanup;
> -
> -    if (!(all_nodes = virNumaGetHostNodeset()))
> -        goto cleanup;
> -
> -    if (!(all_nodes_str = virBitmapFormat(all_nodes)))
> -        goto cleanup;
> -
>      if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
>          goto cleanup;
>  
> -    if (virCgroupGetCpusetMems(cgroup_temp, &mem_mask) < 0 ||
> -        virCgroupSetCpusetMems(cgroup_temp, all_nodes_str) < 0)
> -        goto endjob;
> +    if (flags & VIR_DOMAIN_AFFECT_LIVE) {

As we are also doing the guest agent cpu config stuff in this function
and the cgroup stuff isn't required for that operation please add

&& !(flags & VIR_DOMAIN_VCPU_GUEST)

to the condition.

> +        if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_temp) < 0)
> +            goto cleanup;
> +
> +        if (!(all_nodes = virNumaGetHostNodeset()))
> +            goto cleanup;
> +
> +        if (!(all_nodes_str = virBitmapFormat(all_nodes)))
> +            goto cleanup;
> +
> +        if (virCgroupGetCpusetMems(cgroup_temp, &mem_mask) < 0 ||
> +            virCgroupSetCpusetMems(cgroup_temp, all_nodes_str) < 0)
> +            goto endjob;
> +    }
>  
>      maximum = (flags & VIR_DOMAIN_VCPU_MAXIMUM) != 0;
>      flags &= ~VIR_DOMAIN_VCPU_MAXIMUM;


ACK with the addition.

Peter

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