[libvirt] [PATCH 7/7] qemu: Implement virDomainSetGuestVcpus
Pavel Hrdina
phrdina at redhat.com
Tue Jun 21 18:43:16 UTC 2016
On Mon, Jun 20, 2016 at 04:34:21PM +0200, Peter Krempa wrote:
> Allow modification of specific vCPU states via the guest agent.
> ---
> src/qemu/qemu_driver.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 83 insertions(+)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 5b96ad8..4bd8c92 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -19837,6 +19837,88 @@ qemuDomainGetGuestVcpus(virDomainPtr dom,
> }
>
>
> +static int
> +qemuDomainSetGuestVcpus(virDomainPtr dom,
> + const char *cpumap,
> + int state,
> + unsigned int flags)
> +{
> + virQEMUDriverPtr driver = dom->conn->privateData;
> + virDomainObjPtr vm = NULL;
> + virBitmapPtr map = NULL;
> + qemuAgentCPUInfoPtr info = NULL;
> + int ninfo = 0;
> + size_t i;
> + int ret = -1;
> +
> + virCheckFlags(0, -1);
> +
> + if (state != 0 && state != 1) {
> + virReportInvalidArg(state, "%s", _("unsupported state value"));
> + return -1;
> + }
> +
> + if (virBitmapParse(cpumap, &map, 4096) < 0)
> + goto cleanup;
s/4096/QEMU_GUEST_VCPU_MAX_ID/
> +
> + if (!(vm = qemuDomObjFromDomain(dom)))
> + goto cleanup;
> +
> + if (virDomainSetGuestVcpusEnsureACL(dom->conn, vm->def) < 0)
> + goto cleanup;
> +
> + if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
> + goto cleanup;
> +
> + if (!qemuDomainAgentAvailable(vm, true))
> + goto endjob;
[...]
ACK
More information about the libvir-list
mailing list