[libvirt PATCH v2 13/17] ch_driver, ch_domain: vcpupin callback in ch driver

Ján Tomko jtomko at redhat.com
Fri Dec 3 17:34:49 UTC 2021


On a Thursday in 2021, Praveen K Paladugu wrote:
>From: Vineeth Pillai <viremana at linux.microsoft.com>
>
>Signed-off-by: Vineeth Pillai <viremana at linux.microsoft.com>
>Signed-off-by: Praveen K Paladugu <prapal at linux.microsoft.com>
>---
> src/ch/ch_domain.c |  30 +++++++++
> src/ch/ch_domain.h |   1 +
> src/ch/ch_driver.c | 151 +++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 182 insertions(+)
>
>@@ -1129,6 +1130,154 @@ chDomainGetVcpus(virDomainPtr dom,
>     return ret;
> }
>
>+static int
>+chDomainPinVcpuLive(virDomainObj *vm,
>+                    virDomainDef *def,
>+                    int vcpu,
>+                    virCHDriver *driver,
>+                    virCHDriverConfig *cfg,
>+                    virBitmap *cpumap)
>+{
>+    virBitmap *tmpmap = NULL;

You can use
     g_autoptr(virBitmap) tmpmap = NULL;
to automatically free the memory when it goes out of scope
instead of manually calling virBitmapFree


>+    virDomainVcpuDef *vcpuinfo;
>+    virCHDomainObjPrivate *priv = vm->privateData;
>+    virCgroup *cgroup_vcpu = NULL;
>+    g_autofree char *str = NULL;
>+    int ret = -1;
>+
>+    if (!virCHDomainHasVcpuPids(vm)) {
>+

>+    if (persistentDef) {
>+        virBitmapFree(vcpuinfo->cpumask);
>+        vcpuinfo->cpumask = pcpumap;
>+        pcpumap = NULL;
>+
>+        // ret = virDomainDefSave(persistentDef, driver->xmlopt, cfg->configDir);

There's no need for this comment.

>+        goto endjob;

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20211203/9a2e2d99/attachment-0001.sig>


More information about the libvir-list mailing list