Skip to contentSkip to conversation

libxl: add PV console if not explicitly specified

PATCH In review Jim Fehlig 2 participants 3 messages Jun 30, 2014 – Jul 1, 2014 1 message not in the archive

lore
Share & tools
lore

Jim Fehlig

author
#0 lore raw

PATCH 1/1 libxl: add PV console if not explicitly specified

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.

---
 src/libxl/libxl_domain.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
src/libxl/libxl_domain.c +29 -0
index da3f241..0c86601 100644
@@ -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,
 };
 
 
Signature · 1 line
1.8.4.5
#1 lore raw
Quoted 5 lines · Jim Fehlig

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.

Quoted 8 lines

virsh console pv-domain

will no longer work after upgrading a xm/xend stack to xl/libxl.

---
 src/libxl/libxl_domain.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Sounds like a good thing to have in 1.2.6, then.

ACK

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#3 lore raw
Quoted 11 lines · Eric Blake
Quoted 9 lines · Jim Fehlig

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.

Quoted 8 lines
Quoted 5 lines
---
 src/libxl/libxl_domain.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Sounds like a good thing to have in 1.2.6, then.

Yep. With this fix, users can 'virsh create existing-dom-config --console' after switching out Xen toolstacks and still get access to their PV console.

Quoted 2 lines

ACK

Thanks, pushed.

Regards,
Jim