On 09/22/2016 01:53 PM, Joao Martins wrote: > 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@xxxxxxxxxx> > --- > docs/schemas/domaincommon.rng | 11 +++++++++++ > src/conf/domain_conf.c | 18 ++++++++++++++---- > src/conf/domain_conf.h | 1 + > src/qemu/qemu_command.c | 1 + > 4 files changed, 27 insertions(+), 4 deletions(-) > > 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"/> Sorry for not mentioning this while reviewing V1, but changes to the domain schema typically need a corresponding change to docs/formatdomain.html. I think it behooves us to mention the Xen support in the 'channels' section of that page. Regards, Jim > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c > index 5fede3d..1b14efd 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; > @@ -9909,10 +9911,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; > > @@ -10203,7 +10207,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; > @@ -14403,6 +14408,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; > @@ -18415,6 +18421,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, > @@ -21537,11 +21545,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 d4a84c3..a0619f5 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 f6d26b0..ddfdb85 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; -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list