diff -uNrp libvirt-0.9.8.orig/docs/schemas/domaincommon.rng libvirt-0.9.8/docs/schemas/domaincommon.rng --- libvirt-0.9.8.orig/docs/schemas/domaincommon.rng 2011-12-08 11:29:49.000000000 +0900 +++ libvirt-0.9.8/docs/schemas/domaincommon.rng 2011-12-12 07:54:30.939996765 +0900 @@ -1800,22 +1800,26 @@ xen serial uml - virtio - - - - - - - - - - + + + + + + + + + + + + + + + diff -uNrp libvirt-0.9.8.orig/src/conf/domain_conf.c libvirt-0.9.8/src/conf/domain_conf.c --- libvirt-0.9.8.orig/src/conf/domain_conf.c 2011-12-08 11:29:49.000000000 +0900 +++ libvirt-0.9.8/src/conf/domain_conf.c 2011-12-12 08:13:06.958096724 +0900 @@ -3969,6 +3969,11 @@ virDomainChrDefParseTargetXML(virCapsPtr break; default: + if (def->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO && + def->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE) { + def->target.name = virXMLPropString(cur, "name"); + break; + } portStr = virXMLPropString(cur, "port"); if (portStr == NULL) { /* Set to negative value to indicate we should set it later */ @@ -7573,7 +7578,12 @@ static virDomainDefPtr virDomainDefParse } } - chr->target.port = i; + /* + * target.port is not accepted for virtio + * See domain_conf.h for struct _virDomainChrDef + */ + if (chr->targetType != VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) + chr->target.port = i; def->consoles[def->nconsoles++] = chr; } @@ -10406,10 +10416,15 @@ virDomainChrDefFormat(virBufferPtr buf, case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE: virBufferAsprintf(buf, - " \n", + " deviceType, - def->targetType), - def->target.port); + def->targetType)); + if (def->targetType != VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) + virBufferAsprintf(buf, " port='%d'/>\n", def->target.port); + else if (def->target.name) + virBufferAsprintf(buf, " name='%s'/>\n", def->target.name); + else + virBufferAsprintf(buf, "/>\n"); break; default: diff -uNrp libvirt-0.9.8.orig/src/qemu/qemu_command.c libvirt-0.9.8/src/qemu/qemu_command.c --- libvirt-0.9.8.orig/src/qemu/qemu_command.c 2011-12-02 12:59:50.000000000 +0900 +++ libvirt-0.9.8/src/qemu/qemu_command.c 2011-12-12 08:15:39.200968095 +0900 @@ -3061,7 +3061,9 @@ qemuBuildVirtioSerialPortDevStr(virDomai qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC))) { virBufferAsprintf(&buf, ",chardev=char%s,id=%s", dev->info.alias, dev->info.alias); - if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL && + if ((dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL || + (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && + dev->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO)) && dev->target.name) { virBufferAsprintf(&buf, ",name=%s", dev->target.name); } diff -uNrp libvirt-0.9.8.orig/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.args libvirt-0.9.8/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.args --- libvirt-0.9.8.orig/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.args 2011-11-03 23:48:23.000000000 +0900 +++ libvirt-0.9.8/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.args 2011-12-12 08:55:41.686622150 +0900 @@ -5,8 +5,8 @@ chardev=charmonitor,id=monitor,mode=read virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 -hda \ /dev/HostVG/QEMUGuest1 -chardev pty,id=charserial0 \ -device isa-serial,chardev=charserial0,id=serial0 -chardev pty,id=charconsole1 \ --device virtconsole,chardev=charconsole1,id=console1 -chardev \ -pty,id=charconsole2 -device virtconsole,chardev=charconsole2,id=console2 \ +-device virtconsole,chardev=charconsole1,id=console1,name=1 -chardev \ +pty,id=charconsole2 -device virtconsole,chardev=charconsole2,id=console2,name=2 \ -chardev pty,id=charconsole3 -device virtconsole,chardev=charconsole3,\ -id=console3 -usb -device virtio-balloon-pci,id=balloon0,\ +id=console3,name=3 -usb -device virtio-balloon-pci,id=balloon0,\ bus=pci.0,addr=0x4 diff -uNrp libvirt-0.9.8.orig/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.xml libvirt-0.9.8/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.xml --- libvirt-0.9.8.orig/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.xml 2011-11-03 23:48:23.000000000 +0900 +++ libvirt-0.9.8/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.xml 2011-12-12 08:54:47.887425251 +0900 @@ -28,13 +28,13 @@ - + - + - + diff -uNrp libvirt-0.9.8.orig/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml libvirt-0.9.8/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml --- libvirt-0.9.8.orig/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml 2011-06-10 15:50:15.000000000 +0900 +++ libvirt-0.9.8/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml 2011-12-12 08:58:35.419374433 +0900 @@ -22,7 +22,7 @@ - +