From: Jim Fehlig Subject: [PATCH] libxl: add PV console if not explicitly specified Date: Mon, 30 Jun 2014 10:29:46 -0600 Message-ID: <1404145786-26712-1-git-send-email-jfehlig@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: libvir-list@redhat.com Cc: Jim Fehlig , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Xen PV domains always have a PV console, so add one to the domain config via post-parse callback if not explicitly specified in the XML. The legacy Xen driver behaves similarly, causing a regression when switching to the new Xen toolstack. I.e. virsh console pv-domain will no longer work after upgrading a xm/xend stack to xl/libxl. Signed-off-by: Jim Fehlig --- src/libxl/libxl_domain.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index da3f241..0c86601 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -503,9 +503,38 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, return 0; } +static int +libxlDomainDefPostParse(virDomainDefPtr def, + virCapsPtr caps ATTRIBUTE_UNUSED, + void *opaque ATTRIBUTE_UNUSED) +{ + if (STREQ(def->os.type, "hvm")) + return 0; + + if (def->nconsoles == 0) { + virDomainChrDefPtr chrdef; + + if (!(chrdef = virDomainChrDefNew())) + return -1; + + chrdef->source.type = VIR_DOMAIN_CHR_TYPE_PTY; + chrdef->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE; + chrdef->target.port = 0; + chrdef->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN; + + if (VIR_ALLOC_N(def->consoles, 1) < 0) + return -1; + + def->nconsoles = 1; + def->consoles[0] = chrdef; + } + return 0; +} + virDomainDefParserConfig libxlDomainDefParserConfig = { .macPrefix = { 0x00, 0x16, 0x3e }, .devicesPostParseCallback = libxlDomainDeviceDefPostParse, + .domainPostParseCallback = libxlDomainDefPostParse, }; -- 1.8.4.5