xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: George.Dunlap@eu.citrix.com, Ian.Jackson@eu.citrix.com,
	xen-devel@lists.xensource.com, Ian.Campbell@citrix.com
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH 2/2] xl/vcpuset: Make it work for PV guests.
Date: Wed, 25 Sep 2013 16:40:17 -0400	[thread overview]
Message-ID: <1380141617-8981-3-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1380141617-8981-1-git-send-email-konrad.wilk@oracle.com>

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 <konrad.wilk@oracle.com>
---
 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

  parent reply	other threads:[~2013-09-25 20:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-25 20:40 [RFC] Make xl vcpu-set work in overcommit and with PV guests. (v2) Konrad Rzeszutek Wilk
2013-09-25 20:40 ` [PATCH 1/2] xl: neuter vcpu-set --ignore-host Konrad Rzeszutek Wilk
2013-09-26  7:23   ` Dario Faggioli
2013-09-26 12:45     ` Konrad Rzeszutek Wilk
2013-09-26  9:06   ` Ian Campbell
2013-09-26 12:48     ` Konrad Rzeszutek Wilk
2013-09-26 16:25       ` George Dunlap
2013-09-27  1:44         ` Konrad Rzeszutek Wilk
2013-09-26 15:28     ` Konrad Rzeszutek Wilk
2013-09-26 15:47       ` Ian Campbell
2013-09-26 16:01         ` Andrew Cooper
2013-09-26 16:05           ` Ian Campbell
2013-09-27  1:52         ` Konrad Rzeszutek Wilk
2013-09-27  8:41           ` Ian Campbell
2013-09-30 18:40             ` Konrad Rzeszutek Wilk
2013-09-25 20:40 ` Konrad Rzeszutek Wilk [this message]
2013-09-26  9:10   ` [PATCH 2/2] xl/vcpuset: Make it work for PV guests Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1380141617-8981-3-git-send-email-konrad.wilk@oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).