Adds network backing for a DomainChardevSource and
protocol selection for serial device of type tcp.
Signed-off-by: Jeroen Simonetti <jeroen(a)simonetti.nl>
---
domain.go | 26 +++++++++++++++++---------
domain_test.go | 26 +++++++++++++++++++++++---
2 files changed, 40 insertions(+), 12 deletions(-)
diff --git a/domain.go b/domain.go
index f4ef35c..47e9dc6 100644
--- a/domain.go
+++ b/domain.go
@@ -256,9 +256,12 @@ type DomainInterface struct {
}
type DomainChardevSource struct {
- Mode string `xml:"mode,attr,omitempty"`
- Path string `xml:"path,attr"`
- Append string `xml:"append,attr,omitempty"`
+ 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"`
}
type DomainChardevTarget struct {
@@ -329,12 +332,17 @@ 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 *DomainChardevSource `xml:"source"`
+ Protocol *DomainSerialProtocol `xml:"protocol"`
+ Target *DomainSerialTarget `xml:"target"`
+ Alias *DomainAlias `xml:"alias"`
+ Address *DomainAddress `xml:"address"`
+}
+
+type DomainSerialProtocol struct {
+ Type string `xml:"type,attr"`
}
type DomainChannel struct {
diff --git a/domain_test.go b/domain_test.go
index 1ad5125..99d5022 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -330,6 +330,21 @@ var domainTestData = []struct {
Port: &serialPort,
},
},
+ DomainSerial{
+ Type: "tcp",
+ Source: &DomainChardevSource{
+ Mode: "bind",
+ Host: "127.0.0.1",
+ Service: "1234",
+ TLS: "yes",
+ },
+ Protocol: &DomainSerialProtocol{
+ Type: "telnet",
+ },
+ Target: &DomainSerialTarget{
+ Port: &serialPort,
+ },
+ },
},
Channels: []DomainChannel{
DomainChannel{
@@ -415,6 +430,11 @@ var domainTestData = []struct {
` <source path="/tmp/serial.log"
append="off"></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">`,
` <target type="virtio" port="0"></target>`,
` </console>`,
@@ -1725,9 +1745,9 @@ var domainTestData = []struct {
/* Host Bootloader -- bhyve, Xen */
{
Object: &Domain{
- Type: "bhyve",
- Name: "test",
- Bootloader: "/usr/local/sbin/grub-bhyve",
+ Type: "bhyve",
+ Name: "test",
+ Bootloader: "/usr/local/sbin/grub-bhyve",
BootloaderArgs: "-r cd0 -m /tmp/test-device.map -M 1024M linuxguest",
},
Expected: []string{
--
2.15.0