[libvirt] [PATCHv2 04/10] libxl: fill HVM SDL and VNC settings based on <graphics/> entries

Marek Marczykowski-Górecki marmarek at invisiblethingslab.com
Tue Feb 10 02:36:47 UTC 2015


On Sat, Feb 07, 2015 at 12:22:51PM +0100, Marek Marczykowski-Górecki wrote:
> On Thu, Feb 05, 2015 at 02:53:44PM -0700, Jim Fehlig wrote:
> > Marek Marczykowski-Górecki wrote:
> > > Vfb entries in domain config are used only by PV drivers. Qemu
> > > parameters are build based on b_info struct. So fill it with the same
> > > data as vfb entries (actually the first one).
> > > This will additionally allow graphic-less domain, when no <graphics/>
> > > entries are present in domain XML (previously VNC was always enabled).
> > >   
> > 
> > This should already be handled in libxlMakeVfbList().
> 
> Indeed, I've blindly rebased that patch from older version, but...
> 
> > Is there
> > something missing in that function?
> 
> ... yes, if there is no graphics defined, the driver will set
> b_info->u.hvm.nographic to 1. Which isn't enough to disable graphic,
> because actual condition in libxl is:
>     if (info->nographic && (!info->sdl && !info->vnc)) {
>         flexarray_append(dm_args, "-nographic");
>     }
> 
> I'll think about some better solution (perhaps only part about initially setting
> vnc and sdl to false?).

The problem is when domain XML contains no <video/> nor <graphics/>
elements - libxl defaults then to setting up VNC (on 127.0.0.1). The
solution here is to disable VNC/SDL and enable only when domain config
says so. This still make VNC set when only <video/> is present (without
<graphics type='vnc'/>), but at least there is a way make domain really
headless.

Below is patch which implement that approach. Note that it makes a
big change in behaviour - it can make user's configuration broken (if
he/she relied on this bug).

Disclaimer: I've tested it only with qemu in stubdomain.

-----8<-----
From 37126eea6927f38fcb7f7f1190143fd7de54e9e6 Mon Sep 17 00:00:00 2001
From: Marek Marczykowski <marmarek at invisiblethingslab.com>
Date: Sun, 7 Apr 2013 19:48:03 +0200
Subject: [PATCH] libxl: disable VNC and SDL until explicitly enabled
Cc: Marek Marczykowski-Górecki <marmarek at invisiblethingslab.com>

Otherwise when VM have no graphics defined, it is still enabled (with
some libxl defaults).

Signed-off-by: Marek Marczykowski-Górecki <marmarek at invisiblethingslab.com>
---
 src/libxl/libxl_conf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 1811a83..7ee4e54 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -745,6 +745,10 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
             return -1;
         }
 
+        /* Disable VNC and SDL until explicitly enabled */
+        libxl_defbool_set(&b_info->u.hvm.vnc.enable, 0);
+        libxl_defbool_set(&b_info->u.hvm.sdl.enable, 0);
+
         /*
          * The following comment and calculation were taken directly from
          * libxenlight's internal function libxl_get_required_shadow_memory():
-- 
1.8.3.1


-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150210/7492a77d/attachment-0001.sig>


More information about the libvir-list mailing list