>> In addition, the QEMU guest agent requires specified socket. Virt IO
>> Console, too. But unfortunately libvirt does not support to xml tags
>> to give socket name options to QEMU for the QEMU guest agent and
>> Virt IO Console.
>
> Err, yes we do.
>
> <channel type='unix'>
> <source mode='bind' path='/var/lib/libvirt/qemu/f16x86_64.agent'/>
> <target type='virtio' name='org.qemu.guest_agent.0'/>
> </channel>
Yes, I confirmed that it can create the socket for guest agent and
communicate to guest.
> Or for the console
>
> <console type='unix'>
> <source mode='bind'
path='/var/lib/libvirt/qemu/f16x86_64.console'/>
> <target type='virtio'/>
> </channel>
>
> though you really want to use type=pty for consoles, so that 'virsh
console'
> works correctly.
>
> Daniel
But It is not enough. Because I use the socket for VirtIO console, i.e.
gives the option '-device virtconsole,chardev=...,name=foo' for qemu.
And I read the source code, but found funny...
In src/conf/domain_conf.h, struct _virDomainChrDef is
struct _virDomainChrDef {
...
union {
int port; /* parallel, serial, console */
virSocketAddrPtr addr; /* guestfwd */
char *name; /* virtio */
} target;
...
It is written that virtio must use char *name.
But in docs/schemas/domaincommon.rng and others, VirtIO Console use only
int port.
Thoug I do not understand that which should be used, I attaches the
patch for using *name.
P.S. I can not use GIT, because live in restricted network.
MATSUDA Daiki
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 @@
<value>xen</value>
<value>serial</value>
<value>uml</value>
- <value>virtio</value>
</choice>
</attribute>
</define>
<define name="qemucdevTgtDef">
- <element name="target">
- <interleave>
- <optional>
- <ref name="qemucdevConsoleTgtType"/>
- </optional>
- <optional>
- <attribute name="port"/>
- </optional>
- </interleave>
- </element>
+ <choice>
+ <element name="target">
+ <interleave>
+ <optional>
+ <ref name="qemucdevConsoleTgtType"/>
+ </optional>
+ <optional>
+ <attribute name="port"/>
+ </optional>
+ </interleave>
+ </element>
+ <choice>
+ <ref name="virtioTarget"/>
+ </choice>
+ </choice>
</define>
<define name="qemucdevSrcTypeChoice">
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,
- " <target type='%s' port='%d'/>\n",
+ " <target type='%s'",
virDomainChrTargetTypeToString(def->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 @@
<target type='serial' port='0'/>
</console>
<console type='pty'>
- <target type='virtio' port='1'/>
+ <target type='virtio' name='1'/>
</console>
<console type='pty'>
- <target type='virtio' port='2'/>
+ <target type='virtio' name='2'/>
</console>
<console type='pty'>
- <target type='virtio' port='3'/>
+ <target type='virtio' name='3'/>
</console>
<memballoon model='virtio'/>
</devices>
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 @@
<controller type='ide' index='0'/>
<controller type='virtio-serial' index='0'/>
<console type='pty'>
- <target type='virtio' port='0'/>
+ <target type='virtio'/>
</console>
<memballoon model='virtio'/>
</devices>
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list