From: Ian Campbell Subject: Re: [PATCH 2/2] xl/vcpuset: Make it work for PV guests. Date: Thu, 26 Sep 2013 10:10:55 +0100 Message-ID: <1380186655.29483.22.camel@kazak.uk.xensource.com> References: <1380141617-8981-1-git-send-email-konrad.wilk@oracle.com> <1380141617-8981-3-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-3-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: Konrad Rzeszutek Wilk , Anthony Perard Cc: George.Dunlap@eu.citrix.com, xen-devel@lists.xensource.com, Ian.Jackson@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Wed, 2013-09-25 at 16:40 -0400, Konrad Rzeszutek Wilk wrote: > 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) Please switch on libxl__domain_type(), that way we will get a build error if/when a new type is added. > 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; > }