[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] qemu-xen: fix cpu hotplug
qemu-xen: fix cpu hotplug The current xenstore watch path for a vcpu-set event is wrong and is also wrong the code to parse it. This patch fixes both of them: a xenstore vcpu hotplug command is of the following form: path: /local/domain/DOMID/cpu/VCPU_NUMBER/availability values: "online" or "offline" Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> diff --git a/xenstore.c b/xenstore.c index 6d24613..2c325ad 100644 --- a/xenstore.c +++ b/xenstore.c @@ -680,9 +680,12 @@ void xenstore_parse_domain_config(int hvm_domid) } /* Set a watch for vcpu-set */ - if (pasprintf(&buf, "/local/domain/%u/cpu", domid) != -1) { - xs_watch(xsh, buf, "vcpu-set"); - fprintf(logfile, "Watching %s\n", buf); + for (i = 0; i < vcpus; i++) { + if (pasprintf(&buf, "/local/domain/%u/cpu/%u/availability", + domid, i) != -1) { + xs_watch(xsh, buf, "vcpu-set"); + fprintf(logfile, "Watching %s\n", buf); + } } /* no need for ifdef CONFIG_STUBDOM, since in the qemu case @@ -970,15 +973,14 @@ void xenstore_record_dm_state(const char *state) static void xenstore_process_vcpu_set_event(char **vec) { char *act = NULL; - char *vcpustr, *node = vec[XS_WATCH_PATH]; - unsigned int vcpu, len; + char *node = vec[XS_WATCH_PATH]; + unsigned int vcpu, len, domid; - vcpustr = strstr(node, "cpu/"); - if (!vcpustr) { - fprintf(stderr, "vcpu-set: watch node error.\n"); + if (sscanf(node, "/local/domain/%u/cpu/%u/availability", + &domid, &vcpu) <= 0) { + fprintf(stderr, "vcpu-set: watch node error, path=%s\n", node); return; } - sscanf(vcpustr, "cpu/%u", &vcpu); act = xs_read(xsh, XBT_NULL, node, &len); if (!act) { _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |