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

zhenwei.pi zhenwei.pi at youruncloud.com
Mon Jun 26 02:09:23 UTC 2017


---
 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




More information about the libvir-list mailing list