xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jim Fehlig <jfehlig@suse.com>
To: libvir-list@redhat.com
Cc: Jim Fehlig <jfehlig@suse.com>, xen-devel@lists.xen.org
Subject: [PATCH V2 4/4] libxl: support enabling and disabling <hap> feature
Date: Mon, 29 Feb 2016 21:00:48 -0700	[thread overview]
Message-ID: <1456804848-13127-5-git-send-email-jfehlig@suse.com> (raw)
In-Reply-To: <1456804848-13127-1-git-send-email-jfehlig@suse.com>

Until now, the libxl driver ignored any <hap> setting in domain XML
and deferred to libxl, which enables hap if not specified. While
this is a good default, it prevents disabling hap if desired.

This change allows disabling hap with <hap state='off'/>. hap is
explicitly enabled with <hap/> or <hap state='on/>. Absense of <hap>
retains current behavior of deferring default state to libxl.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
 src/libxl/libxl_conf.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 6efd9b5..116dc22 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -511,10 +511,24 @@ libxlMakeDomCreateInfo(libxl_ctx *ctx,
 
     libxl_domain_create_info_init(c_info);
 
-    if (def->os.type == VIR_DOMAIN_OSTYPE_HVM)
+    if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
         c_info->type = LIBXL_DOMAIN_TYPE_HVM;
-    else
+        switch ((virTristateSwitch) def->features[VIR_DOMAIN_FEATURE_HAP]) {
+        case VIR_TRISTATE_SWITCH_OFF:
+            libxl_defbool_set(&c_info->hap, false);
+            break;
+
+        case VIR_TRISTATE_SWITCH_ON:
+            libxl_defbool_set(&c_info->hap, true);
+            break;
+
+        case VIR_TRISTATE_SWITCH_ABSENT:
+        case VIR_TRISTATE_SWITCH_LAST:
+            break;
+        }
+    } else {
         c_info->type = LIBXL_DOMAIN_TYPE_PV;
+    }
 
     if (VIR_STRDUP(c_info->name, def->name) < 0)
         goto error;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-03-01  4:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01  4:00 [PATCH V2 0/4] Extend <hap> to a tristate Jim Fehlig
2016-03-01  4:00 ` [PATCH V2 1/4] conf: add 'state' attribute to <hap> feature Jim Fehlig
2016-03-08 16:37   ` [libvirt] " Joao Martins
2016-03-08 20:21     ` Jim Fehlig
2016-03-01  4:00 ` [PATCH V2 2/4] xenconfig: change 'hap' setting to align with Xen behavior Jim Fehlig
2016-03-08 16:37   ` [libvirt] " Joao Martins
2016-03-01  4:00 ` [PATCH V2 3/4] Xen drivers: show hap enabled by default in capabilities Jim Fehlig
2016-03-08 16:37   ` [libvirt] " Joao Martins
2016-03-01  4:00 ` Jim Fehlig [this message]
2016-03-08 16:37   ` [libvirt] [PATCH V2 4/4] libxl: support enabling and disabling <hap> feature Joao Martins
2016-03-08  4:02 ` [libvirt] [PATCH V2 0/4] Extend <hap> to a tristate Jim Fehlig
     [not found] ` <56DE4ED8.4060905@suse.com>
2016-03-16 21:06   ` Jim Fehlig
2016-03-21 12:49 ` Ján Tomko
2016-03-21 15:45   ` Jim Fehlig

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=1456804848-13127-5-git-send-email-jfehlig@suse.com \
    --to=jfehlig@suse.com \
    --cc=libvir-list@redhat.com \
    --cc=xen-devel@lists.xen.org \
    /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).