[PATCH go-xml] Add support for CPUTune in Domain

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

 



From: Michal Rostecki <michal.rostecki@xxxxxxxxx>

Signed-off-by: Victoria Efimova <neverpushthisbutton@xxxxxxxxx>
Signed-off-by: Ivan Shvedunov <ischvedunov@xxxxxxxxxxxx>
Signed-off-by: Miha Pleško <miha.plesko@xxxxxxx>
Signed-off-by: Michal Rostecki <michal.rostecki@xxxxxxxxx>
---
 domain.go      | 19 +++++++++++++++++++
 domain_test.go | 20 ++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/domain.go b/domain.go
index bacab11..3efd68c 100644
--- a/domain.go
+++ b/domain.go
@@ -722,6 +722,24 @@ type DomainFeatureList struct {
 	SMM        *DomainFeatureState  `xml:"smm"`
 }
 
+type DomainCPUTuneShares struct {
+	Value uint `xml:",chardata"`
+}
+
+type DomainCPUTunePeriod struct {
+	Value uint64 `xml:",chardata"`
+}
+
+type DomainCPUTuneQuota struct {
+	Value int64 `xml:",chardata"`
+}
+
+type DomainCPUTune struct {
+	Shares *DomainCPUTuneShares `xml:"shares"`
+	Period *DomainCPUTunePeriod `xml:"period"`
+	Quota  *DomainCPUTuneQuota  `xml:"quota"`
+}
+
 type DomainQEMUCommandlineArg struct {
 	Value string `xml:"value,attr"`
 }
@@ -751,6 +769,7 @@ type Domain struct {
 	MemoryBacking   *DomainMemoryBacking `xml:"memoryBacking"`
 	VCPU            *DomainVCPU          `xml:"vcpu"`
 	VCPUs           *DomainVCPUs         `xml:"vcpus"`
+	CPUTune         *DomainCPUTune       `xml:"cputune"`
 	Resource        *DomainResource      `xml:"resource"`
 	SysInfo         *DomainSysInfo       `xml:"sysinfo"`
 	OS              *DomainOS            `xml:"os"`
diff --git a/domain_test.go b/domain_test.go
index dbebe42..b427b50 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -1335,6 +1335,26 @@ var domainTestData = []struct {
 			`</domain>`,
 		},
 	},
+	{
+		Object: &Domain{
+			Name: "test",
+			CPUTune: &DomainCPUTune{
+				Shares: &DomainCPUTuneShares{Value: 1024},
+				Period: &DomainCPUTunePeriod{Value: 500000},
+				Quota:  &DomainCPUTuneQuota{Value: -1},
+			},
+		},
+		Expected: []string{
+			`<domain>`,
+			`  <name>test</name>`,
+			`  <cputune>`,
+			`    <shares>1024</shares>`,
+			`    <period>500000</period>`,
+			`    <quota>-1</quota>`,
+			`  </cputune>`,
+			`</domain>`,
+		},
+	},
 
 	/* Tests for sub-documents that can be hotplugged */
 	{
-- 
2.13.6

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