[libvirt] [PATCH go-xml] Add support for domain clock and test code

Signed-off-by: zhenwei.pi <zhenwei.pi@youruncloud.com> --- domain.go | 7 +++++++ domain_test.go | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/domain.go b/domain.go index b9b0f77..1d020aa 100644 --- a/domain.go +++ b/domain.go @@ -532,6 +532,12 @@ type DomainCPU struct { Features []DomainCPUFeature `xml:"feature"` } +type DomainClock struct { + Offset string `xml:"offset,attr,omitempty"` + Basic string `xml:"basic,attr,omitempty"` + Adjustment int `xml:"adjustment,attr,omitempty"` +} + type DomainFeature struct { } @@ -607,6 +613,7 @@ type Domain struct { OS *DomainOS `xml:"os"` Features *DomainFeatureList `xml:"features"` CPU *DomainCPU `xml:"cpu"` + Clock *DomainClock `xml:"clock,omitempty"` OnPoweroff string `xml:"on_poweroff,omitempty"` OnReboot string `xml:"on_reboot,omitempty"` OnCrash string `xml:"on_crash,omitempty"` diff --git a/domain_test.go b/domain_test.go index 47e5e26..536b94c 100644 --- a/domain_test.go +++ b/domain_test.go @@ -491,6 +491,11 @@ var domainTestData = []struct { }, }, }, + Clock: &DomainClock{ + Offset: "variable", + Basic: "utc", + Adjustment: 28794, + }, }, Expected: []string{ `<domain type="kvm">`, @@ -524,6 +529,7 @@ var domainTestData = []struct { ` <initarg>--unit</initarg>`, ` <initarg>emergency.service</initarg>`, ` </os>`, + ` <clock offset="variable" basic="utc" adjustment="28794"></clock>`, `</domain>`, }, }, -- 2.7.4

On Mon, Jul 10, 2017 at 11:35:23AM +0800, zhenwei.pi wrote:
Signed-off-by: zhenwei.pi <zhenwei.pi@youruncloud.com> --- domain.go | 7 +++++++ domain_test.go | 6 ++++++ 2 files changed, 13 insertions(+)
diff --git a/domain.go b/domain.go index b9b0f77..1d020aa 100644 --- a/domain.go +++ b/domain.go @@ -532,6 +532,12 @@ type DomainCPU struct { Features []DomainCPUFeature `xml:"feature"` }
+type DomainClock struct { + Offset string `xml:"offset,attr,omitempty"` + Basic string `xml:"basic,attr,omitempty"`
This should be 'basis' not 'basic'. I'll change this when applying to git so no need to resubmit.
+ Adjustment int `xml:"adjustment,attr,omitempty"` +} + type DomainFeature struct { }
@@ -607,6 +613,7 @@ type Domain struct { OS *DomainOS `xml:"os"` Features *DomainFeatureList `xml:"features"` CPU *DomainCPU `xml:"cpu"` + Clock *DomainClock `xml:"clock,omitempty"` OnPoweroff string `xml:"on_poweroff,omitempty"` OnReboot string `xml:"on_reboot,omitempty"` OnCrash string `xml:"on_crash,omitempty"` diff --git a/domain_test.go b/domain_test.go index 47e5e26..536b94c 100644 --- a/domain_test.go +++ b/domain_test.go @@ -491,6 +491,11 @@ var domainTestData = []struct { }, }, }, + Clock: &DomainClock{ + Offset: "variable", + Basic: "utc", + Adjustment: 28794, + }, }, Expected: []string{ `<domain type="kvm">`, @@ -524,6 +529,7 @@ var domainTestData = []struct { ` <initarg>--unit</initarg>`, ` <initarg>emergency.service</initarg>`, ` </os>`, + ` <clock offset="variable" basic="utc" adjustment="28794"></clock>`, `</domain>`, }, }, -- 2.7.4
-- libvir-list mailing list libvir-list@redhat.com 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 :|
participants (2)
-
Daniel P. Berrange
-
zhenwei.pi