On 03/25/2013 10:17 AM, Peter Krempa wrote:
This patch refactors various places to allow removing of the
defaultConsoleTargetType callback from the virCaps structure.
A new console character device target type is introduced -
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE - to mark that no type was
specified in the XML. This type is at the end converted to the standard
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL. Other types that are
different from this default have to be processed separately in the
device post parse callback.
---
Notes:
Version 4:
- new in series
@@ -2538,6 +2554,91 @@ virDomainDefPostParseInternal(virDomainDefPtr
def,
return -1;
}
+ /*
+ * Some really crazy backcompat stuff for consoles
No joke! Even it if it is the same comment just moved from elsewhere
+ /* create the serial port definition from the console
definition */
+ if (def->nserials == 0) {
+ if (VIR_APPEND_ELEMENT(def->serials, def->nserials,
+ def->consoles[0]) < 0)
+ goto no_memory;
+
+ /* modify it to be a serial port */
+ def->serials[0]->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
+ def->serials[0]->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA;
+ def->serials[0]->target.port = 0;
+ } else {
+ /* if the console source does't match */
s/does't/doesn't/
ACK with the typo fix (and modulo any renaming earlier in the series)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org