From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: [PATCH 2/2] xl/vcpuset: Make it work for PV guests. Date: Wed, 25 Sep 2013 16:40:17 -0400 Message-ID: <1380141617-8981-3-git-send-email-konrad.wilk@oracle.com> References: <1380141617-8981-1-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1380141617-8981-1-git-send-email-konrad.wilk@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George.Dunlap@eu.citrix.com, Ian.Jackson@eu.citrix.com, xen-devel@lists.xensource.com, Ian.Campbell@citrix.com Cc: Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org When we try to set the number of VCPUs for a PV guest we might have QEMU running serving the framebuffer, or not. Either way we should not use QMP when trying to alter the number of VCPUs a PV guest can have. This fixes the bug where for a PV guest 'xl vcpuset' results in: libxl: error: libxl_qmp.c:702:libxl__qmp_initialize: Connection error: No such file or directory Signed-off-by: Konrad Rzeszutek Wilk --- tools/libxl/libxl.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 0879f23..8786074 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -4307,16 +4307,28 @@ int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap) { GC_INIT(ctx); int rc; - switch (libxl__device_model_version_running(gc, domid)) { - case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: + + libxl_domain_type type = libxl__domain_type(gc, domid); + if (type == LIBXL_DOMAIN_TYPE_INVALID) { + rc = ERROR_FAIL; + goto out; + } + + if (type == LIBXL_DOMAIN_TYPE_PV) rc = libxl__set_vcpuonline_xenstore(gc, domid, cpumap); - break; - case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: - rc = libxl__set_vcpuonline_qmp(gc, domid, cpumap); - break; - default: - rc = ERROR_INVAL; + else { + switch (libxl__device_model_version_running(gc, domid)) { + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: + rc = libxl__set_vcpuonline_xenstore(gc, domid, cpumap); + break; + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: + rc = libxl__set_vcpuonline_qmp(gc, domid, cpumap); + break; + default: + rc = ERROR_INVAL; + } } +out: GC_FREE; return rc; } -- 1.8.3.1