[libvirt] [PATCH go-xml] add append attr for chardev

zhenwei.pi posted 1 patch 6 years, 9 months ago
Failed in applying to current master (apply log)
domain.go      |  5 +++--
domain_test.go | 14 ++++++++++++++
2 files changed, 17 insertions(+), 2 deletions(-)
[libvirt] [PATCH go-xml] add append attr for chardev
Posted by zhenwei.pi 6 years, 9 months ago
---
 domain.go      |  5 +++--
 domain_test.go | 14 ++++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/domain.go b/domain.go
index 82bf728..00231b2 100644
--- a/domain.go
+++ b/domain.go
@@ -227,8 +227,9 @@ type DomainInterface struct {
 }
 
 type DomainChardevSource struct {
-	Mode string `xml:"mode,attr"`
-	Path string `xml:"path,attr"`
+	Mode   string `xml:"mode,attr,omitempty"`
+	Path   string `xml:"path,attr"`
+	Append string `xml:"append,attr,omitempty"`
 }
 
 type DomainChardevTarget struct {
diff --git a/domain_test.go b/domain_test.go
index 122aada..f50f1fd 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -297,6 +297,16 @@ var domainTestData = []struct {
 							Port: &serialPort,
 						},
 					},
+					DomainSerial{
+						Type: "file",
+						Source: &DomainChardevSource{
+							Path:   "/tmp/serial.log",
+							Append: "off",
+						},
+						Target: &DomainSerialTarget{
+							Port: &serialPort,
+						},
+					},
 				},
 				Channels: []DomainChannel{
 					DomainChannel{
@@ -332,6 +342,10 @@ var domainTestData = []struct {
 			`    <serial type="pty">`,
 			`      <target type="isa" port="0"></target>`,
 			`    </serial>`,
+			`    <serial type="file">`,
+			`      <source path="/tmp/serial.log" append="off"></source>`,
+			`      <target port="0"></target>`,
+			`    </serial>`,
 			`    <console type="pty">`,
 			`      <target type="virtio" port="0"></target>`,
 			`    </console>`,
-- 
2.7.4

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