So far only guestfwd and virtio were supported. Add an additional
for Xen as libxl channels create Xen console visible to the guest.
Signed-off-by: Joao Martins <joao.m.martins(a)oracle.com>
---
Changes since v2:
* Add relevant documentation about target type xen.
---
docs/formatdomain.html.in | 10 ++++++++++
docs/schemas/domaincommon.rng | 11 +++++++++++
src/conf/domain_conf.c | 18 ++++++++++++++----
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 1 +
5 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f48a4d8..129ba62 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5980,6 +5980,16 @@ qemu-kvm -net nic,model=? /dev/null
Possible values for the <code>state</code> attribute are
<code>connected</code> and <code>disconnected</code>.
</dd>
+ <dt><code>xen</code></dt>
+ <dd> Paravirtualized xen channel. Channel is exposed in the guest as a
+ xen console but identified with a name. The setup of the channel
+ depends to guest own rules and can live in a arbitrary path (for more
+ info, please see <a
href="http://xenbits.xen.org/docs/unstable/misc/channel.txt">...>).
+ Channel source path semantics are the same as the virtio target type.
+ Although <code>state</code> attribute is not provided as xen
channels
+ lack the necessary probing mechanism.
+ <span class="since">Since 2.3.0</span>
+ </dd>
<dt><code>spicevmc</code></dt>
<dd>Paravirtualized SPICE channel. The domain must also have a
SPICE server as a <a href="#elementsGraphics">graphics
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 95c7882..6eeb4e9 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3690,6 +3690,16 @@
</optional>
</element>
</define>
+ <define name="xenTarget">
+ <element name="target">
+ <attribute name="type">
+ <value>xen</value>
+ </attribute>
+ <optional>
+ <attribute name="name"/>
+ </optional>
+ </element>
+ </define>
<define name="channel">
<element name="channel">
<ref name="qemucdevSrcType"/>
@@ -3698,6 +3708,7 @@
<choice>
<ref name="guestfwdTarget"/>
<ref name="virtioTarget"/>
+ <ref name="xenTarget"/>
</choice>
<optional>
<ref name="alias"/>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a06da46..7972a4e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -434,7 +434,8 @@ VIR_ENUM_IMPL(virDomainChrChannelTarget,
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST,
"none",
"guestfwd",
- "virtio")
+ "virtio",
+ "xen")
VIR_ENUM_IMPL(virDomainChrConsoleTarget,
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST,
@@ -2068,6 +2069,7 @@ void virDomainChrDefFree(virDomainChrDefPtr def)
VIR_FREE(def->target.addr);
break;
+ case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN:
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
VIR_FREE(def->target.name);
break;
@@ -9923,10 +9925,12 @@ virDomainChrDefParseTargetXML(virDomainChrDefPtr def,
virSocketAddrSetPort(def->target.addr, port);
break;
+ case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN:
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
def->target.name = virXMLPropString(cur, "name");
- if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
+ if (def->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO
&&
+ !(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) &&
(stateStr = virXMLPropString(cur, "state"))) {
int tmp;
@@ -10217,7 +10221,8 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
/* path can be auto generated */
if (!path &&
(!chr_def ||
- chr_def->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO)) {
+ (chr_def->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN
&&
+ chr_def->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Missing source path attribute for char
device"));
goto error;
@@ -14417,6 +14422,7 @@ virDomainChrEquals(virDomainChrDefPtr src,
if (src->targetType != tgt->targetType)
return false;
switch ((virDomainChrChannelTargetType) src->targetType) {
+ case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN:
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
return STREQ_NULLABLE(src->target.name, tgt->target.name);
break;
@@ -18434,6 +18440,8 @@ virDomainChannelDefCheckABIStability(virDomainChrDefPtr src,
}
switch (src->targetType) {
+
+ case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN:
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
if (STRNEQ_NULLABLE(src->target.name, dst->target.name)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -21556,11 +21564,13 @@ virDomainChrDefFormat(virBufferPtr buf,
break;
}
+ case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN:
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
if (def->target.name)
virBufferEscapeString(buf, " name='%s'",
def->target.name);
- if (def->state != VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT &&
+ if (def->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO
&&
+ def->state != VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT &&
!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) {
virBufferAsprintf(buf, " state='%s'",
virDomainChrDeviceStateTypeToString(def->state));
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index d2065cf..561a179 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1021,6 +1021,7 @@ typedef enum {
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_NONE = 0,
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD,
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO,
+ VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN,
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST
} virDomainChrChannelTargetType;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f24a98b..29f0c3b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9719,6 +9719,7 @@ qemuBuildChannelChrDeviceStr(char **deviceStr,
goto cleanup;
break;
+ case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN:
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_NONE:
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST:
return ret;
--
2.1.4