Re: [PATCH go-xml] qemu: extend serial console source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 02, 2017 at 12:10:40PM +0200, Jeroen Simonetti wrote:
> *Warning* this is a BWC breaking change!

That's fine - we don't promise API compat for this module.

> This will change the type of `DomainSerial.Source` from
> `*DomainChardevSource` to a new `*DomainSerialSource`.
> 
> This is done to add support for networked serial ports and
> keep the original DomainChardevSource unchanged.

I'm not sure I see the point of this. Any chardev backed device type
(parallel, serial, vmchannel) should be allowed to use network
backends - there's no restriction that says its only for serial
ports.

> 
> DomainSerialSource contains all possible xml variations
> for a serial device source.
> 
> Signed-off-by: Jeroen Simonetti <jeroen@xxxxxxxxxxxx>
> ---
>  domain.go      | 32 ++++++++++++++++++++++++++------
>  domain_test.go | 30 ++++++++++++++++++++++++++++--
>  2 files changed, 54 insertions(+), 8 deletions(-)
> 
> diff --git a/domain.go b/domain.go
> index 8c2cc1b..3221423 100644
> --- a/domain.go
> +++ b/domain.go
> @@ -309,12 +309,32 @@ type DomainConsole struct {
>  }
>  
>  type DomainSerial struct {
> -	XMLName xml.Name             `xml:"serial"`
> -	Type    string               `xml:"type,attr"`
> -	Source  *DomainChardevSource `xml:"source"`
> -	Target  *DomainSerialTarget  `xml:"target"`
> -	Alias   *DomainAlias         `xml:"alias"`
> -	Address *DomainAddress       `xml:"address"`
> +	XMLName  xml.Name              `xml:"serial"`
> +	Type     string                `xml:"type,attr"`
> +	Source   *DomainSerialSource   `xml:"source"`
> +	Protocol *DomainSerialProtocol `xml:"protocol"`
> +	Target   *DomainSerialTarget   `xml:"target"`
> +	Alias    *DomainAlias          `xml:"alias"`
> +	Address  *DomainAddress        `xml:"address"`
> +}
> +
> +type DomainSerialSource struct {
> +	Mode     string                      `xml:"mode,attr,omitempty"`
> +	Path     string                      `xml:"path,attr,omitempty"`
> +	Append   string                      `xml:"append,attr,omitempty"`
> +	Host     string                      `xml:"host,attr,omitempty"`
> +	Service  string                      `xml:"service,attr,omitempty"`
> +	TLS      string                      `xml:"tls,attr,omitempty"`
> +	SecLabel *DomainSerialSourceSecLabel `xml:"seclabel"`
> +}
> +
> +type DomainSerialProtocol struct {
> +	Type string `xml:"type,attr"`
> +}
> +
> +type DomainSerialSourceSecLabel struct {
> +	Model   string `xml:"model,attr,omitempty"`
> +	Relabel string `xml:"relabel,attr,omitempty"`
>  }
>  
>  type DomainChannel struct {
> diff --git a/domain_test.go b/domain_test.go
> index 4fe6bfe..d301ace 100644
> --- a/domain_test.go
> +++ b/domain_test.go
> @@ -314,9 +314,28 @@ var domainTestData = []struct {
>  					},
>  					DomainSerial{
>  						Type: "file",
> -						Source: &DomainChardevSource{
> +						Source: &DomainSerialSource{
>  							Path:   "/tmp/serial.log",
>  							Append: "off",
> +							SecLabel: &DomainSerialSourceSecLabel{
> +								Model:   "dac",
> +								Relabel: "no",
> +							},
> +						},
> +						Target: &DomainSerialTarget{
> +							Port: &serialPort,
> +						},
> +					},
> +					DomainSerial{
> +						Type: "tcp",
> +						Source: &DomainSerialSource{
> +							Mode:    "bind",
> +							Host:    "127.0.0.1",
> +							Service: "1234",
> +							TLS:     "yes",
> +						},
> +						Protocol: &DomainSerialProtocol{
> +							Type: "telnet",
>  						},
>  						Target: &DomainSerialTarget{
>  							Port: &serialPort,
> @@ -382,7 +401,14 @@ var domainTestData = []struct {
>  			`      <target type="isa" port="0"></target>`,
>  			`    </serial>`,
>  			`    <serial type="file">`,
> -			`      <source path="/tmp/serial.log" append="off"></source>`,
> +			`      <source path="/tmp/serial.log" append="off">`,
> +			`        <seclabel model="dac" relabel="no"></seclabel>`,
> +			`      </source>`,
> +			`      <target port="0"></target>`,
> +			`    </serial>`,
> +			`    <serial type="tcp">`,
> +			`      <source mode="bind" host="127.0.0.1" service="1234" tls="yes"></source>`,
> +			`      <protocol type="telnet"></protocol>`,
>  			`      <target port="0"></target>`,
>  			`    </serial>`,
>  			`    <console type="pty">`,
> -- 
> 2.14.2
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux