From nobody Thu May 2 19:04:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1486746806375654.2088345731091; Fri, 10 Feb 2017 09:13:26 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1AHA40S014009; Fri, 10 Feb 2017 12:10:04 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1AH9p6G025775 for ; Fri, 10 Feb 2017 12:09:51 -0500 Received: from angien.brq.redhat.com (dhcp129-162.brq.redhat.com [10.34.129.162]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1AH9mjq022155; Fri, 10 Feb 2017 12:09:50 -0500 From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 10 Feb 2017 18:10:18 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/5] lib: Add API for specific vCPU hot(un)plug X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Similarly to domainSetGuestVcpus this commit adds API which allows to modify state of individual vcpus rather than just setting the count. This allows to enable CPUs in specific guest NUMA nodes to achieve any necessary configuration. --- include/libvirt/libvirt-domain.h | 5 +++++ src/driver-hypervisor.h | 7 ++++++ src/libvirt-domain.c | 48 ++++++++++++++++++++++++++++++++++++= ++++ src/libvirt_public.syms | 5 +++++ src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 16 +++++++++++++- src/remote_protocol-structs | 7 ++++++ 7 files changed, 88 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index e303140a2..c0f715d66 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -4528,4 +4528,9 @@ int virDomainSetGuestVcpus(virDomainPtr domain, int state, unsigned int flags); +int virDomainSetVcpu(virDomainPtr domain, + const char *vcpumap, + int state, + unsigned int flags); + #endif /* __VIR_LIBVIRT_DOMAIN_H__ */ diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 51af73200..b81420aef 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -1251,6 +1251,12 @@ typedef int int state, unsigned int flags); +typedef int +(*virDrvDomainSetVcpu)(virDomainPtr domain, + const char *cpumap, + int state, + unsigned int flags); + typedef struct _virHypervisorDriver virHypervisorDriver; typedef virHypervisorDriver *virHypervisorDriverPtr; @@ -1489,6 +1495,7 @@ struct _virHypervisorDriver { virDrvDomainMigrateStartPostCopy domainMigrateStartPostCopy; virDrvDomainGetGuestVcpus domainGetGuestVcpus; virDrvDomainSetGuestVcpus domainSetGuestVcpus; + virDrvDomainSetVcpu domainSetVcpu; }; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 5b3e84205..619a9fccb 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -11749,3 +11749,51 @@ virDomainSetGuestVcpus(virDomainPtr domain, virDispatchError(domain->conn); return -1; } + + +/** + * virDomainSetVcpu: + * @domain: pointer to domain object + * @vcpumap: text representation of a bitmap of vcpus to set + * @state: 0 to disable/1 to enable cpus described by @vcpumap + * @flags: bitwise-OR of virDomainModificationImpact + * + * Enables/disables individual vcpus described by @vcpumap in the hypervis= or. + * + * Various hypervisor implementations may limit to operate on just 1 + * hotpluggable entity (which may contain multiple vCPUs on certain platfo= rms). + * + * Note that OSes and hypervisors may require vCPU 0 to stay online. + * + * Returns 0 on success, -1 on error. + */ +int +virDomainSetVcpu(virDomainPtr domain, + const char *vcpumap, + int state, + unsigned int flags) +{ + VIR_DOMAIN_DEBUG(domain, "vcpumap=3D'%s' state=3D%i flags=3D%x", + NULLSTR(vcpumap), state, flags); + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + virCheckReadOnlyGoto(domain->conn->flags, error); + + virCheckNonNullArgGoto(vcpumap, error); + + if (domain->conn->driver->domainSetVcpu) { + int ret; + ret =3D domain->conn->driver->domainSetVcpu(domain, vcpumap, state= , flags); + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + + error: + virDispatchError(domain->conn); + return -1; +} diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index 62885ac41..04ef58021 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -753,4 +753,9 @@ LIBVIRT_3.0.0 { virConnectSecretEventDeregisterAny; } LIBVIRT_2.2.0; +LIBVIRT_3.1.0 { + global: + virDomainSetVcpu; +} LIBVIRT_3.0.0; + # .... define new API here using predicted next version number .... diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index a3f7d9b0b..0c8bfeed1 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8402,6 +8402,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainMigrateStartPostCopy =3D remoteDomainMigrateStartPostCopy, /* 1= .3.3 */ .domainGetGuestVcpus =3D remoteDomainGetGuestVcpus, /* 2.0.0 */ .domainSetGuestVcpus =3D remoteDomainSetGuestVcpus, /* 2.0.0 */ + .domainSetVcpu =3D remoteDomainSetVcpu, /* 3.1.0 */ }; static virNetworkDriver network_driver =3D { diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 68469a5b1..b2a67c801 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -3353,6 +3353,13 @@ struct remote_domain_set_guest_vcpus_args { unsigned int flags; }; +struct remote_domain_set_vcpu_args { + remote_nonnull_domain dom; + remote_nonnull_string cpumap; + int state; + unsigned int flags; +}; + struct remote_domain_event_callback_metadata_change_msg { int callbackID; @@ -6018,6 +6025,13 @@ enum remote_procedure { * @generate: both * @acl: none */ - REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED =3D 383 + REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED =3D 383, + /** + * @generate: both + * @acl: domain:write + * @acl: domain:save:!VIR_DOMAIN_AFFECT_CONFIG|VIR_DOMAIN_AFFECT_LIVE + * @acl: domain:save:VIR_DOMAIN_AFFECT_CONFIG + */ + REMOTE_PROC_DOMAIN_SET_VCPU =3D 384 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 0360600cf..e1e53d21b 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -2800,6 +2800,12 @@ struct remote_domain_set_guest_vcpus_args { int state; u_int flags; }; +struct remote_domain_set_vcpu_args { + remote_nonnull_domain dom; + remote_nonnull_string cpumap; + int state; + u_int flags; +}; struct remote_domain_event_callback_metadata_change_msg { int callbackID; remote_nonnull_domain dom; @@ -3210,4 +3216,5 @@ enum remote_procedure { REMOTE_PROC_CONNECT_SECRET_EVENT_DEREGISTER_ANY =3D 381, REMOTE_PROC_SECRET_EVENT_LIFECYCLE =3D 382, REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED =3D 383, + REMOTE_PROC_DOMAIN_SET_VCPU =3D 384, }; --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 19:04:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1486746837518110.97353930156112; Fri, 10 Feb 2017 09:13:57 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1AHASBT014044; Fri, 10 Feb 2017 12:10:28 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1AH9q9l025790 for ; Fri, 10 Feb 2017 12:09:52 -0500 Received: from angien.brq.redhat.com (dhcp129-162.brq.redhat.com [10.34.129.162]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1AH9mjr022155; Fri, 10 Feb 2017 12:09:51 -0500 From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 10 Feb 2017 18:10:19 +0100 Message-Id: <23b19050952af6a45365df871f2055721ebb0ae8.1486746569.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/5] virsh: Implement command for virDomainSetVcpu called setvcpu X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a simple virsh command handler which makes use of the new API. --- tools/virsh-domain.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++= ++++ tools/virsh.pod | 19 ++++++++++++ 2 files changed, 107 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 023ec8a8b..09a9f8203 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7015,6 +7015,88 @@ cmdGuestvcpus(vshControl *ctl, const vshCmd *cmd) /* + * "setvcpu" command + */ +static const vshCmdInfo info_setvcpu[] =3D { + {.name =3D "help", + .data =3D N_("attach/detach vcpu or groups of threads") + }, + {.name =3D "desc", + .data =3D N_("Add or remove vcpus") + }, + {.name =3D NULL} +}; + +static const vshCmdOptDef opts_setvcpu[] =3D { + VIRSH_COMMON_OPT_DOMAIN_FULL, + {.name =3D "vcpulist", + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("ids of vcpus to manipulate") + }, + {.name =3D "enable", + .type =3D VSH_OT_BOOL, + .help =3D N_("enable cpus specified by cpumap") + }, + {.name =3D "disable", + .type =3D VSH_OT_BOOL, + .help =3D N_("disable cpus specified by cpumap") + }, + VIRSH_COMMON_OPT_DOMAIN_CONFIG, + VIRSH_COMMON_OPT_DOMAIN_LIVE, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, + {.name =3D NULL} +}; + +static bool +cmdSetvcpu(vshControl *ctl, const vshCmd *cmd) +{ + virDomainPtr dom; + bool enable =3D vshCommandOptBool(cmd, "enable"); + bool disable =3D vshCommandOptBool(cmd, "disable"); + bool config =3D vshCommandOptBool(cmd, "config"); + bool live =3D vshCommandOptBool(cmd, "live"); + const char *vcpulist =3D NULL; + int state =3D 0; + bool ret =3D false; + unsigned int flags =3D VIR_DOMAIN_AFFECT_CURRENT; + + VSH_EXCLUSIVE_OPTIONS_VAR(enable, disable); + + VSH_EXCLUSIVE_OPTIONS("current", "live"); + VSH_EXCLUSIVE_OPTIONS("current", "config"); + + if (config) + flags |=3D VIR_DOMAIN_AFFECT_CONFIG; + if (live) + flags |=3D VIR_DOMAIN_AFFECT_LIVE; + + if (!(enable || disable)) { + vshError(ctl, "%s", _("one of --enable, --disable is required")); + return false; + } + + if (vshCommandOptStringReq(ctl, cmd, "vcpulist", &vcpulist)) + return false; + + if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) + return false; + + if (enable) + state =3D 1; + + if (virDomainSetVcpu(dom, vcpulist, state, flags) < 0) + goto cleanup; + + ret =3D true; + + cleanup: + virDomainFree(dom); + return ret; +} + + +/* * "iothreadinfo" command */ static const vshCmdInfo info_iothreadinfo[] =3D { @@ -13951,5 +14033,11 @@ const vshCmdDef domManagementCmds[] =3D { .info =3D info_guestvcpus, .flags =3D 0 }, + {.name =3D "setvcpu", + .handler =3D cmdSetvcpu, + .opts =3D opts_setvcpu, + .info =3D info_setvcpu, + .flags =3D 0 + }, {.name =3D NULL} }; diff --git a/tools/virsh.pod b/tools/virsh.pod index a47040984..606792df1 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -2418,6 +2418,25 @@ be hot-plugged the next time the domain is booted. = As such, it must only be used with the I<--config> flag, and not with the I<--live> or the I<--curr= ent> flag. +=3Ditem B I I [I<--enable>] | [I<--disable>] +[[I<--live>] [I<--config>] | [I<--current>]] + +Change state of individual vCPUs using hot(un)plug mechanism. + +See B for information on format of I. Hypervisor driver= s may +require that I contains exactly vCPUs belonging to one hotplugga= ble +entity. This is usually just a single vCPU but certain architectures such = as +ppc64 require a full core to be specified at once. + +Note that hypervisors may refuse to disable certain vcpus such as vcpu 0 or +others. + +If I<--live> is specified, affect a running domain. +If I<--config> is specified, affect the next startup of a persistent domai= n. +If I<--current> is specified, affect the current domain state. This is the +default. Both I<--live> and I<--config> flags may be given, but I<--curren= t> is +exclusive. + =3Ditem B I [I<--mode MODE-LIST>] Gracefully shuts down a domain. This coordinates with the domain OS --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 19:04:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1486746838746655.9095023636886; Fri, 10 Feb 2017 09:13:58 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1AHAVic014068; Fri, 10 Feb 2017 12:10:31 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1AH9rMf025796 for ; Fri, 10 Feb 2017 12:09:53 -0500 Received: from angien.brq.redhat.com (dhcp129-162.brq.redhat.com [10.34.129.162]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1AH9mjs022155; Fri, 10 Feb 2017 12:09:52 -0500 From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 10 Feb 2017 18:10:20 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/5] qemu: Implement individual vcpu hotplug API X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add code that validates user's selection of cores and then uses the existing code to plug in the vCPU. --- src/qemu/qemu_driver.c | 74 +++++++++++++++++++++++ src/qemu/qemu_hotplug.c | 153 ++++++++++++++++++++++++++++++++++++++++++++= ++++ src/qemu/qemu_hotplug.h | 7 +++ 3 files changed, 234 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 89bc833de..2b875b3e9 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20190,6 +20190,79 @@ qemuDomainSetGuestVcpus(virDomainPtr dom, } +static int +qemuDomainSetVcpu(virDomainPtr dom, + const char *cpumap, + int state, + unsigned int flags) +{ + virQEMUDriverPtr driver =3D dom->conn->privateData; + virDomainObjPtr vm =3D NULL; + virDomainDefPtr def =3D NULL; + virDomainDefPtr persistentDef =3D NULL; + virBitmapPtr map =3D NULL; + ssize_t lastvcpu; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + + if (state !=3D 0 && state !=3D 1) { + virReportInvalidArg(state, "%s", _("unsupported state value")); + return -1; + } + + if (virBitmapParse(cpumap, &map, QEMU_GUEST_VCPU_MAX_ID) < 0) + goto cleanup; + + if ((lastvcpu =3D virBitmapLastSetBit(map)) < 0) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("no vcpus selected for modification")); + goto cleanup; + } + + if (!(vm =3D qemuDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainSetVcpuEnsureACL(dom->conn, vm->def, flags) < 0) + goto cleanup; + + if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + goto cleanup; + + if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) + goto endjob; + + if (persistentDef) { + if (lastvcpu >=3D virDomainDefGetVcpusMax(persistentDef)) { + virReportError(VIR_ERR_INVALID_ARG, + _("vcpu %zd is not present in persistent config= "), + lastvcpu); + goto endjob; + } + } + + if (def) { + if (lastvcpu >=3D virDomainDefGetVcpusMax(def)) { + virReportError(VIR_ERR_INVALID_ARG, + _("vcpu %zd is not present in live config"), + lastvcpu); + goto endjob; + } + } + + ret =3D qemuDomainSetVcpuInternal(driver, vm, def, persistentDef, map,= !!state); + + endjob: + qemuDomainObjEndJob(driver, vm); + + cleanup: + virBitmapFree(map); + virDomainObjEndAPI(&vm); + return ret; +} + + static virHypervisorDriver qemuHypervisorDriver =3D { .name =3D QEMU_DRIVER_NAME, .connectOpen =3D qemuConnectOpen, /* 0.2.0 */ @@ -20403,6 +20476,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainMigrateStartPostCopy =3D qemuDomainMigrateStartPostCopy, /* 1.3= .3 */ .domainGetGuestVcpus =3D qemuDomainGetGuestVcpus, /* 2.0.0 */ .domainSetGuestVcpus =3D qemuDomainSetGuestVcpus, /* 2.0.0 */ + .domainSetVcpu =3D qemuDomainSetVcpu, /* 3.1.0 */ }; diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 2f209f12b..363d1070b 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -5700,3 +5700,156 @@ qemuDomainSetVcpusInternal(virQEMUDriverPtr driver, virObjectUnref(cfg); return ret; } + + +static void +qemuDomainSetVcpuInactive(virDomainDefPtr def, + virBitmapPtr map, + bool state) +{ + virDomainVcpuDefPtr vcpu; + ssize_t next =3D -1; + + def->individualvcpus =3D true; + + while ((next =3D virBitmapNextSetBit(map, next)) > 0) { + if (!(vcpu =3D virDomainDefGetVcpu(def, next))) + continue; + + vcpu->online =3D state; + vcpu->hotpluggable =3D VIR_TRISTATE_BOOL_YES; + vcpu->order =3D 0; + } +} + + +/** + * qemuDomainFilterHotplugVcpuEntities: + * + * Returns a bitmap of hotpluggable vcpu entities that correspond to the l= ogical + * vcpus requested in @vcpus. + */ +static virBitmapPtr +qemuDomainFilterHotplugVcpuEntities(virDomainDefPtr def, + virBitmapPtr vcpus, + bool state) +{ + qemuDomainVcpuPrivatePtr vcpupriv; + virDomainVcpuDefPtr vcpu; + virBitmapPtr map =3D NULL; + virBitmapPtr ret =3D NULL; + ssize_t next =3D -1; + size_t i; + + if (!(map =3D virBitmapNewCopy(vcpus))) + return NULL; + + /* make sure that all selected vcpus are in the correct state */ + while ((next =3D virBitmapNextSetBit(map, next)) > 0) { + if (!(vcpu =3D virDomainDefGetVcpu(def, next))) + continue; + + if (vcpu->online =3D=3D state) { + virReportError(VIR_ERR_INVALID_ARG, + _("vcpu '%zu' is already in requested state"), = next); + goto cleanup; + } + + if (vcpu->online && !vcpu->hotpluggable) { + virReportError(VIR_ERR_INVALID_ARG, + _("vcpu '%zu' can't be hotunplugged"), next); + goto cleanup; + } + } + + /* Make sure that all vCPUs belonging to a single hotpluggable entity = were + * selected and then de-select any sub-threads of it. */ + next =3D -1; + while ((next =3D virBitmapNextSetBit(map, next)) > 0) { + if (!(vcpu =3D virDomainDefGetVcpu(def, next))) + continue; + + vcpupriv =3D QEMU_DOMAIN_VCPU_PRIVATE(vcpu); + + if (vcpupriv->vcpus =3D=3D 0) { + virReportError(VIR_ERR_INVALID_ARG, + _("vcpu '%zu' belongs to a larger hotpluggable = entity, " + "but siblings were not selected"), next); + goto cleanup; + } + + for (i =3D next + 1; i < next + vcpupriv->vcpus; i++) { + if (!virBitmapIsBitSet(map, i)) { + virReportError(VIR_ERR_INVALID_ARG, + _("vcpu '%zu' was not selected but it belon= gs to " + "hotpluggable entity '%zu-%zu' which was " + "partially selected"), + i, next, next + vcpupriv->vcpus - 1); + goto cleanup; + } + + /* clear the subthreads */ + ignore_value(virBitmapClearBit(map, i)); + } + } + + VIR_STEAL_PTR(ret, map); + + cleanup: + virBitmapFree(map); + return ret; +} + + +int +qemuDomainSetVcpuInternal(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainDefPtr def, + virDomainDefPtr persistentDef, + virBitmapPtr map, + bool state) +{ + virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); + virBitmapPtr livevcpus =3D NULL; + int ret =3D -1; + + if (def) { + if (!qemuDomainSupportsNewVcpuHotplug(vm)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("this qemu version does not support specific " + "vCPU hotplug")); + goto cleanup; + } + + if (!(livevcpus =3D qemuDomainFilterHotplugVcpuEntities(def, map, = state))) + goto cleanup; + + /* Make sure that only one hotpluggable entity is selected. + * qemuDomainSetVcpusLive allows setting more at once but error + * resolution in case of a partial failure is hard, so don't let u= sers + * do so */ + if (virBitmapCountBits(livevcpus) !=3D 1) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("only one hotpluggable entity can be selected= ")); + goto cleanup; + } + } + + if (livevcpus && + qemuDomainSetVcpusLive(driver, cfg, vm, livevcpus, state) < 0) + goto cleanup; + + if (persistentDef) { + qemuDomainSetVcpuInactive(persistentDef, map, state); + + if (virDomainSaveConfig(cfg->configDir, driver->caps, persistentDe= f) < 0) + goto cleanup; + } + + ret =3D 0; + + cleanup: + virBitmapFree(livevcpus); + virObjectUnref(cfg); + return ret; +} diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h index 13242eec9..0b11c1ed9 100644 --- a/src/qemu/qemu_hotplug.h +++ b/src/qemu/qemu_hotplug.h @@ -143,4 +143,11 @@ int qemuDomainSetVcpusInternal(virQEMUDriverPtr driver, unsigned int nvcpus, bool hotpluggable); +int qemuDomainSetVcpuInternal(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainDefPtr def, + virDomainDefPtr persistentDef, + virBitmapPtr vcpus, + bool state); + #endif /* __QEMU_HOTPLUG_H__ */ --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 19:04:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1486746813349432.8243965362361; Fri, 10 Feb 2017 09:13:33 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1AH9uVm013995; Fri, 10 Feb 2017 12:09:56 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1AH9ssm025810 for ; Fri, 10 Feb 2017 12:09:54 -0500 Received: from angien.brq.redhat.com (dhcp129-162.brq.redhat.com [10.34.129.162]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1AH9mjt022155; Fri, 10 Feb 2017 12:09:53 -0500 From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 10 Feb 2017 18:10:21 +0100 Message-Id: <036f4613e5d134b60792260631c797122d7a0917.1486746569.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 4/5] test: qemuhotplugtest: Add testing of individual vcpu hotplug X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Test that the vcpu entity selection code works properly --- tests/qemuhotplugtest.c | 63 ++++ .../ppc64-modern-individual-domain.xml | 20 ++ .../ppc64-modern-individual-monitor.json | 318 +++++++++++++++++= ++++ .../ppc64-modern-individual-result-conf.xml | 64 +++++ .../ppc64-modern-individual-result-live.xml | 72 +++++ .../x86-modern-individual-add-domain.xml | 21 ++ .../x86-modern-individual-add-monitor.json | 299 +++++++++++++++++= ++ .../x86-modern-individual-add-result-conf.xml | 40 +++ .../x86-modern-individual-add-result-live.xml | 48 ++++ 9 files changed, 945 insertions(+) create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-domai= n.xml create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-monit= or.json create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-resul= t-conf.xml create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-resul= t-live.xml create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-add-dom= ain.xml create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-add-mon= itor.json create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-add-res= ult-conf.xml create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-add-res= ult-live.xml diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 8a58d5468..cdeb3f1bf 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -493,6 +493,8 @@ testQemuHotplugCpuFinalize(struct testQemuHotplugCpuDat= a *data) struct testQemuHotplugCpuParams { const char *test; int newcpus; + const char *cpumap; + bool state; bool modern; bool fail; }; @@ -534,6 +536,46 @@ testQemuHotplugCpuGroup(const void *opaque) static int +testQemuHotplugCpuIndividual(const void *opaque) +{ + const struct testQemuHotplugCpuParams *params =3D opaque; + struct testQemuHotplugCpuData *data =3D NULL; + virBitmapPtr map =3D NULL; + int ret =3D -1; + int rc; + + if (!(data =3D testQemuHotplugCpuPrepare(params->test, params->modern)= )) + return -1; + + if (virBitmapParse(params->cpumap, &map, 128) < 0) + goto cleanup; + + rc =3D qemuDomainSetVcpuInternal(&driver, data->vm, data->vm->def, + data->vm->newDef, map, params->state); + + if (params->fail) { + if (rc =3D=3D 0) + fprintf(stderr, "cpu test '%s' should have failed\n", params->= test); + else + ret =3D 0; + + goto cleanup; + } else { + if (rc < 0) + goto cleanup; + } + + ret =3D testQemuHotplugCpuFinalize(data); + + cleanup: + virBitmapFree(map); + testQemuHotplugCpuDataFree(data); + return ret; +} + + + +static int mymain(void) { int ret =3D 0; @@ -789,6 +831,27 @@ mymain(void) DO_TEST_CPU_GROUP("ppc64-modern-bulk", 23, true, true); DO_TEST_CPU_GROUP("ppc64-modern-bulk", 25, true, true); +#define DO_TEST_CPU_INDIVIDUAL(prefix, mapstr, statefl, modernhp, expectfa= il) \ + do { = \ + cpudata.test =3D prefix; = \ + cpudata.cpumap =3D mapstr; = \ + cpudata.state =3D statefl; = \ + cpudata.modern =3D modernhp; = \ + cpudata.fail =3D expectfail; = \ + if (virTestRun("hotplug vcpus group " prefix, = \ + testQemuHotplugCpuIndividual, &cpudata) < 0) = \ + ret =3D -1; = \ + } while (0) + + DO_TEST_CPU_INDIVIDUAL("x86-modern-individual-add", "7", true, true, f= alse); + DO_TEST_CPU_INDIVIDUAL("x86-modern-individual-add", "6,7", true, true,= true); + DO_TEST_CPU_INDIVIDUAL("x86-modern-individual-add", "7", false, true, = true); + DO_TEST_CPU_INDIVIDUAL("x86-modern-individual-add", "7", true, false, = true); + + DO_TEST_CPU_INDIVIDUAL("ppc64-modern-individual", "16-23", true, true,= false); + DO_TEST_CPU_INDIVIDUAL("ppc64-modern-individual", "16-22", true, true,= true); + DO_TEST_CPU_INDIVIDUAL("ppc64-modern-individual", "17", true, true, tr= ue); + qemuTestDriverFree(&driver); return (ret =3D=3D 0) ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-domain.xml b= /tests/qemuhotplugtestcpus/ppc64-modern-individual-domain.xml new file mode 100644 index 000000000..eb04e42b6 --- /dev/null +++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-domain.xml @@ -0,0 +1,20 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 32 + + hvm + + + + + + destroy + restart + destroy + + /usr/bin/qemu + + diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-monitor.json= b/tests/qemuhotplugtestcpus/ppc64-modern-individual-monitor.json new file mode 100644 index 000000000..ad5cc984a --- /dev/null +++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-monitor.json @@ -0,0 +1,318 @@ +{"execute":"query-hotpluggable-cpus","id":"libvirt-1"} + +{ + "return": [ + { + "props": { + "core-id": 24 + }, + "vcpus-count": 8, + "type": "host-spapr-cpu-core" + }, + { + "props": { + "core-id": 16 + }, + "vcpus-count": 8, + "type": "host-spapr-cpu-core" + }, + { + "props": { + "core-id": 8 + }, + "vcpus-count": 8, + "type": "host-spapr-cpu-core" + }, + { + "props": { + "core-id": 0 + }, + "vcpus-count": 8, + "qom-path": "/machine/unattached/device[1]", + "type": "host-spapr-cpu-core" + } + ], + "id": "libvirt-15" +} + +{"execute":"query-cpus","id":"libvirt-2"} + +{ + "return": [ + { + "arch": "ppc", + "current": true, + "CPU": 0, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[0]", + "halted": false, + "thread_id": 21925 + }, + { + "arch": "ppc", + "current": false, + "CPU": 1, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[1]", + "halted": false, + "thread_id": 21926 + }, + { + "arch": "ppc", + "current": false, + "CPU": 2, + "nip": -4611686018422360608, + "qom_path": "/machine/unattached/device[1]/thread[2]", + "halted": false, + "thread_id": 21927 + }, + { + "arch": "ppc", + "current": false, + "CPU": 3, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[3]", + "halted": false, + "thread_id": 21928 + }, + { + "arch": "ppc", + "current": false, + "CPU": 4, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[4]", + "halted": false, + "thread_id": 21930 + }, + { + "arch": "ppc", + "current": false, + "CPU": 5, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[5]", + "halted": false, + "thread_id": 21931 + }, + { + "arch": "ppc", + "current": false, + "CPU": 6, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[6]", + "halted": false, + "thread_id": 21932 + }, + { + "arch": "ppc", + "current": false, + "CPU": 7, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[7]", + "halted": false, + "thread_id": 21933 + } + ], + "id": "libvirt-12" +} + +{ + "execute": "device_add", + "arguments": { + "driver": "host-spapr-cpu-core", + "id": "vcpu16", + "core-id": 16 + }, + "id": "libvirt-3" +} + +{"return": {}} + +{"execute":"query-hotpluggable-cpus","id":"libvirt-4"} + +{ + "return": [ + { + "props": { + "core-id": 24 + }, + "vcpus-count": 8, + "type": "host-spapr-cpu-core" + }, + { + "props": { + "core-id": 16 + }, + "vcpus-count": 8, + "qom-path": "/machine/peripheral/vcpu16", + "type": "host-spapr-cpu-core" + }, + { + "props": { + "core-id": 8 + }, + "vcpus-count": 8, + "type": "host-spapr-cpu-core" + }, + { + "props": { + "core-id": 0 + }, + "vcpus-count": 8, + "qom-path": "/machine/unattached/device[1]", + "type": "host-spapr-cpu-core" + } + ], + "id": "libvirt-15" +} + +{"execute":"query-cpus","id":"libvirt-5"} + +{ + "return": [ + { + "arch": "ppc", + "current": true, + "CPU": 0, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[0]", + "halted": false, + "thread_id": 21925 + }, + { + "arch": "ppc", + "current": false, + "CPU": 1, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[1]", + "halted": false, + "thread_id": 21926 + }, + { + "arch": "ppc", + "current": false, + "CPU": 2, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[2]", + "halted": false, + "thread_id": 21927 + }, + { + "arch": "ppc", + "current": false, + "CPU": 3, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[3]", + "halted": false, + "thread_id": 21928 + }, + { + "arch": "ppc", + "current": false, + "CPU": 4, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[4]", + "halted": false, + "thread_id": 21930 + }, + { + "arch": "ppc", + "current": false, + "CPU": 5, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[5]", + "halted": false, + "thread_id": 21931 + }, + { + "arch": "ppc", + "current": false, + "CPU": 6, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[6]", + "halted": false, + "thread_id": 21932 + }, + { + "arch": "ppc", + "current": false, + "CPU": 7, + "nip": -4611686018426772172, + "qom_path": "/machine/unattached/device[1]/thread[7]", + "halted": false, + "thread_id": 21933 + }, + { + "arch": "ppc", + "current": false, + "CPU": 8, + "nip": -4611686018426772172, + "qom_path": "/machine/peripheral/vcpu16/thread[0]", + "halted": false, + "thread_id": 22131 + }, + { + "arch": "ppc", + "current": false, + "CPU": 9, + "nip": -4611686018426772172, + "qom_path": "/machine/peripheral/vcpu16/thread[1]", + "halted": false, + "thread_id": 22132 + }, + { + "arch": "ppc", + "current": false, + "CPU": 10, + "nip": -4611686018426772172, + "qom_path": "/machine/peripheral/vcpu16/thread[2]", + "halted": false, + "thread_id": 22133 + }, + { + "arch": "ppc", + "current": false, + "CPU": 11, + "nip": -4611686018426772172, + "qom_path": "/machine/peripheral/vcpu16/thread[3]", + "halted": false, + "thread_id": 22134 + }, + { + "arch": "ppc", + "current": false, + "CPU": 12, + "nip": -4611686018426772172, + "qom_path": "/machine/peripheral/vcpu16/thread[4]", + "halted": false, + "thread_id": 22135 + }, + { + "arch": "ppc", + "current": false, + "CPU": 13, + "nip": -4611686018426772172, + "qom_path": "/machine/peripheral/vcpu16/thread[5]", + "halted": false, + "thread_id": 22136 + }, + { + "arch": "ppc", + "current": false, + "CPU": 14, + "nip": -4611686018426772172, + "qom_path": "/machine/peripheral/vcpu16/thread[6]", + "halted": false, + "thread_id": 22137 + }, + { + "arch": "ppc", + "current": false, + "CPU": 15, + "nip": -4611686018426772172, + "qom_path": "/machine/peripheral/vcpu16/thread[7]", + "halted": false, + "thread_id": 22138 + } + ], + "id": "libvirt-14" +} diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.= xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml new file mode 100644 index 000000000..bda1bc579 --- /dev/null +++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml @@ -0,0 +1,64 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + +
+ + + + + +
+ + + diff --git a/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.= xml b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml new file mode 100644 index 000000000..8621b62b7 --- /dev/null +++ b/tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml @@ -0,0 +1,72 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + + +
+ + + + + + + + + + + + +
+ + + diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-domain.xml= b/tests/qemuhotplugtestcpus/x86-modern-individual-add-domain.xml new file mode 100644 index 000000000..1c2a5b131 --- /dev/null +++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-domain.xml @@ -0,0 +1,21 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 8 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + + diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.js= on b/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json new file mode 100644 index 000000000..294198b27 --- /dev/null +++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json @@ -0,0 +1,299 @@ +{"execute":"query-hotpluggable-cpus","id":"libvirt-1"} + +{ + "return": [ + { + "props": { + "core-id": 1, + "thread-id": 1, + "socket-id": 1 + }, + "vcpus-count": 1, + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 1, + "thread-id": 0, + "socket-id": 1 + }, + "vcpus-count": 1, + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 1, + "socket-id": 1 + }, + "vcpus-count": 1, + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 1 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[5]", + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 1, + "thread-id": 1, + "socket-id": 0 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[4]", + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 1, + "thread-id": 0, + "socket-id": 0 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[3]", + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 1, + "socket-id": 0 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[2]", + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 0 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[0]", + "type": "qemu64-x86_64-cpu" + } + ], + "id": "libvirt-23" +} + +{"execute":"query-cpus","id":"libvirt-2"} + +{ + "return": [ + { + "arch": "x86", + "current": true, + "CPU": 0, + "qom_path": "/machine/unattached/device[0]", + "pc": -2130415978, + "halted": true, + "thread_id": 518291 + }, + { + "arch": "x86", + "current": false, + "CPU": 1, + "qom_path": "/machine/unattached/device[2]", + "pc": -2130415978, + "halted": true, + "thread_id": 518292 + }, + { + "arch": "x86", + "current": false, + "CPU": 2, + "qom_path": "/machine/unattached/device[3]", + "pc": -2130415978, + "halted": true, + "thread_id": 518294 + }, + { + "arch": "x86", + "current": false, + "CPU": 3, + "qom_path": "/machine/unattached/device[4]", + "pc": -2130415978, + "halted": true, + "thread_id": 518295 + }, + { + "arch": "x86", + "current": false, + "CPU": 4, + "qom_path": "/machine/unattached/device[5]", + "pc": -2130415978, + "halted": true, + "thread_id": 518296 + } + ], + "id": "libvirt-22" +} + +{ + "execute": "device_add", + "arguments": { + "driver": "qemu64-x86_64-cpu", + "id": "vcpu7", + "socket-id": 1, + "core-id": 1, + "thread-id": 1 + }, + "id": "libvirt-3" +} + +{"return": {}} + +{"execute":"query-hotpluggable-cpus","id":"libvirt-4"} + +{ + "return": [ + { + "props": { + "core-id": 1, + "thread-id": 1, + "socket-id": 1 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu7", + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 1, + "thread-id": 0, + "socket-id": 1 + }, + "vcpus-count": 1, + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 1, + "socket-id": 1 + }, + "vcpus-count": 1, + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 1 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[5]", + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 1, + "thread-id": 1, + "socket-id": 0 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[4]", + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 1, + "thread-id": 0, + "socket-id": 0 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[3]", + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 1, + "socket-id": 0 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[2]", + "type": "qemu64-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 0 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[0]", + "type": "qemu64-x86_64-cpu" + } + ], + "id": "libvirt-23" +} + +{"execute":"query-cpus","id":"libvirt-5"} + +{ + "return": [ + { + "arch": "x86", + "current": true, + "CPU": 0, + "qom_path": "/machine/unattached/device[0]", + "pc": -2130415978, + "halted": true, + "thread_id": 518291 + }, + { + "arch": "x86", + "current": false, + "CPU": 1, + "qom_path": "/machine/unattached/device[2]", + "pc": -2130415978, + "halted": true, + "thread_id": 518292 + }, + { + "arch": "x86", + "current": false, + "CPU": 2, + "qom_path": "/machine/unattached/device[3]", + "pc": -2130415978, + "halted": true, + "thread_id": 518294 + }, + { + "arch": "x86", + "current": false, + "CPU": 3, + "qom_path": "/machine/unattached/device[4]", + "pc": -2130415978, + "halted": true, + "thread_id": 518295 + }, + { + "arch": "x86", + "current": false, + "CPU": 4, + "qom_path": "/machine/unattached/device[5]", + "pc": -2130415978, + "halted": true, + "thread_id": 518296 + }, + { + "arch": "x86", + "current": false, + "CPU": 5, + "qom_path": "/machine/peripheral/vcpu7", + "pc": -2130415978, + "halted": true, + "thread_id": 518297 + } + ], + "id": "libvirt-22" +} diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-con= f.xml b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml new file mode 100644 index 000000000..75e833558 --- /dev/null +++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml @@ -0,0 +1,40 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 8 + + + + + + + + + + + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + +
+ + + + + +
+ + + diff --git a/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-liv= e.xml b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml new file mode 100644 index 000000000..a21db6f3b --- /dev/null +++ b/tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml @@ -0,0 +1,48 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 8 + + + + + + + + + + + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + + +
+ + + + + + + + + + + + +
+ + + --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 19:04:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1486746821610478.5043932170837; Fri, 10 Feb 2017 09:13:41 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1AHASPW028756; Fri, 10 Feb 2017 12:10:28 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1AH9tde025816 for ; Fri, 10 Feb 2017 12:09:55 -0500 Received: from angien.brq.redhat.com (dhcp129-162.brq.redhat.com [10.34.129.162]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1AH9mju022155; Fri, 10 Feb 2017 12:09:54 -0500 From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 10 Feb 2017 18:10:22 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 5/5] news: Mention specific vCPU hotplug API X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- docs/news.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index a214b3316..3a540deba 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -44,6 +44,16 @@ openvswitch calls in the libvirtd configuration file. + + + Add API for individual/specific vCPU hotplug + + + The new API allows selecting specific vCPUs to be added/removed = from + the VM. The existing APIs allowed only adding/removing from the = end + which did not play well with NUMA. + +
--=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list