Signed-off-by: zhenwei.pi <zhenwei...@youruncloud.com>
---
 domain.go      | 12 ++++++++++++
 domain_test.go | 24 ++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/domain.go b/domain.go
index 3ab54a1..d81ac2a 100644
--- a/domain.go
+++ b/domain.go
@@ -533,6 +533,17 @@ type DomainVCPU struct {
        Value     int    `xml:",chardata"`
 }
 
+type DomainVCPUsVCPU struct {
+       Id           *uint  `xml:"id,attr,omitempty"`
+       Enabled      string `xml:"enabled,attr,omitempty"`
+       Hotpluggable string `xml:"hotpluggable,attr,omitempty"`
+       Order        *uint  `xml:"order,attr,omitempty"`
+}
+
+type DomainVCPUs struct {
+       VCPU []DomainVCPUsVCPU `xml:"vcpu"`
+}
+
 type DomainCPUModel struct {
        Fallback string `xml:"fallback,attr,omitempty"`
        Value    string `xml:",chardata"`
@@ -678,6 +689,7 @@ type Domain struct {
        CurrentMemory   *DomainMemory      `xml:"currentMemory"`
        MaximumMemory   *DomainMaxMemory   `xml:"maxMemory"`
        VCPU            *DomainVCPU        `xml:"vcpu"`
+       VCPUs           *DomainVCPUs       `xml:"vcpus"`
        Resource        *DomainResource    `xml:"resource"`
        SysInfo         *DomainSysInfo     `xml:"sysinfo"`
        OS              *DomainOS          `xml:"os"`
diff --git a/domain_test.go b/domain_test.go
index 0ae9594..3ff1dc1 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -62,6 +62,10 @@ var tabletPort uint = 1
 var nicAverage int = 1000
 var nicBurst int = 10000
 
+var vcpuId0 uint = 0
+var vcpuOrder0 uint = 1
+var vcpuId1 uint = 1
+
 var domainTestData = []struct {
        Object   Document
        Expected []string
@@ -635,6 +639,22 @@ var domainTestData = []struct {
                                Current:   "1",
                                Value:     2,
                        },
+                       VCPUs: &DomainVCPUs{
+                               VCPU: []DomainVCPUsVCPU{
+                                       DomainVCPUsVCPU{
+                                               Id:           &vcpuId0,
+                                               Enabled:      "yes",
+                                               Hotpluggable: "no",
+                                               Order:        &vcpuOrder0,
+                                       },
+                                       DomainVCPUsVCPU{
+                                               Id:           &vcpuId1,
+                                               Enabled:      "no",
+                                               Hotpluggable: "yes",
+                                               Order:        nil,
+                                       },
+                               },
+                       },
                        Devices: &DomainDeviceList{
                                Interfaces: []DomainInterface{
                                        DomainInterface{
@@ -656,6 +676,10 @@ var domainTestData = []struct {
                        `<domain type="kvm">`,
                        `  <name>test</name>`,
                        `  <vcpu placement="static" cpuset="1-4,^3,6" 
current="1">2</vcpu>`,
+                       `  <vcpus>`,
+                       `    <vcpu id="0" enabled="yes" hotpluggable="no" 
order="1"></vcpu>`,
+                       `    <vcpu id="1" enabled="no" 
hotpluggable="yes"></vcpu>`,
+                       `  </vcpus>`,
                        `  <devices>`,
                        `    <interface type="network">`,
                        `      <mac address="00:11:22:33:44:55"></mac>`,
-- 
2.7.4

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

Reply via email to