Skip to content

Commit

Permalink
Merge pull request #376 from miha-plesko/follow-libvirt-xml-upstream
Browse files Browse the repository at this point in the history
Follow upstream changes of libvirt-xml-go
  • Loading branch information
ivan4th authored Aug 8, 2017
2 parents 311d07d + 610ceb1 commit 8823244
Show file tree
Hide file tree
Showing 15 changed files with 305 additions and 139 deletions.
7 changes: 3 additions & 4 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import:
- package: github.com/libvirt/libvirt-go
version: c3209e4ba8b8dda65c85ca0ac04302e55895caf7
- package: github.com/libvirt/libvirt-go-xml
version: cc4025ea01eee7c73a7c75b4211b07125a8119ae
version: 83a754119fc7239caffd1f50e08cb13b1b3825ef
- package: k8s.io/kubernetes
version: v1.7.0
- package: k8s.io/apiserver
Expand Down
103 changes: 46 additions & 57 deletions libvirt-xml-go.patch
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
diff --git a/domain.go b/domain.go
index eb7ff9e..46cd806 100644
index a5d3203..d15af6b 100644
--- a/domain.go
+++ b/domain.go
@@ -522,27 +522,70 @@ type DomainFeatureList struct {
@@ -597,6 +597,32 @@ type DomainFeatureList struct {
SMM *DomainFeatureState `xml:"smm"`
}

+type QemuArg struct {
+ Value string `xml:"value,attr"`
+}
+
+type QemuEnv struct {
+ Name string `xml:"name,attr"`
+ Value string `xml:"value,attr,omitempty"`
+}
+
+type DomainCMDLine struct {
+ Args []QemuArg `xml:"arg"`
+ Envs []QemuEnv `xml:"env"`
+}
+

+type DomainCPUTuneShares struct {
+ Value uint `xml:",chardata"`
+}
Expand All @@ -46,47 +32,50 @@ index eb7ff9e..46cd806 100644
+ Locked *DomainMemoryBackingLocked `xml:"locked"`
+}
+
// NB, try to keep the order of fields in this struct
type DomainQEMUCommandlineArg struct {
Value string `xml:"value,attr"`
}
@@ -616,24 +642,26 @@ type DomainQEMUCommandline struct {
// matching the order of XML elements that libvirt
// will generate when dumping XML.
type Domain struct {
- XMLName xml.Name `xml:"domain"`
- Type string `xml:"type,attr,omitempty"`
- Name string `xml:"name"`
- UUID string `xml:"uuid,omitempty"`
- Memory *DomainMemory `xml:"memory"`
- CurrentMemory *DomainMemory `xml:"currentMemory"`
- MaximumMemory *DomainMaxMemory `xml:"maxMemory"`
- VCPU *DomainVCPU `xml:"vcpu"`
- Resource *DomainResource `xml:"resource"`
- SysInfo *DomainSysInfo `xml:"sysinfo"`
- OS *DomainOS `xml:"os"`
- Features *DomainFeatureList `xml:"features"`
- CPU *DomainCPU `xml:"cpu"`
- OnPoweroff string `xml:"on_poweroff,omitempty"`
- OnReboot string `xml:"on_reboot,omitempty"`
- OnCrash string `xml:"on_crash,omitempty"`
- Devices *DomainDeviceList `xml:"devices"`
+ XMLName xml.Name `xml:"domain"`
+ Type string `xml:"type,attr,omitempty"`
+ Name string `xml:"name"`
+ UUID string `xml:"uuid,omitempty"`
+ Memory *DomainMemory `xml:"memory"`
+ CurrentMemory *DomainMemory `xml:"currentMemory"`
+ MaximumMemory *DomainMaxMemory `xml:"maxMemory"`
+ MemoryBacking *DomainMemoryBacking `xml:"memoryBacking"`
+ VCPU *DomainVCPU `xml:"vcpu"`
+ CPUTune *DomainCPUTune `xml:"cputune"`
+ Resource *DomainResource `xml:"resource"`
+ SysInfo *DomainSysInfo `xml:"sysinfo"`
+ OS *DomainOS `xml:"os"`
+ Features *DomainFeatureList `xml:"features"`
+ CPU *DomainCPU `xml:"cpu"`
+ OnPoweroff string `xml:"on_poweroff,omitempty"`
+ OnReboot string `xml:"on_reboot,omitempty"`
+ OnCrash string `xml:"on_crash,omitempty"`
+ Devices *DomainDeviceList `xml:"devices"`
+ CMDLine *DomainCMDLine `xml:"http://libvirt.org/schemas/domain/qemu/1.0 commandline"`
- XMLName xml.Name `xml:"domain"`
- Type string `xml:"type,attr,omitempty"`
- Name string `xml:"name"`
- UUID string `xml:"uuid,omitempty"`
- Memory *DomainMemory `xml:"memory"`
- CurrentMemory *DomainMemory `xml:"currentMemory"`
- MaximumMemory *DomainMaxMemory `xml:"maxMemory"`
- VCPU *DomainVCPU `xml:"vcpu"`
- Resource *DomainResource `xml:"resource"`
- SysInfo *DomainSysInfo `xml:"sysinfo"`
- 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"`
- Devices *DomainDeviceList `xml:"devices"`
+ XMLName xml.Name `xml:"domain"`
+ Type string `xml:"type,attr,omitempty"`
+ Name string `xml:"name"`
+ UUID string `xml:"uuid,omitempty"`
+ Memory *DomainMemory `xml:"memory"`
+ CurrentMemory *DomainMemory `xml:"currentMemory"`
+ MaximumMemory *DomainMaxMemory `xml:"maxMemory"`
+ MemoryBacking *DomainMemoryBacking `xml:"memoryBacking"`
+ VCPU *DomainVCPU `xml:"vcpu"`
+ CPUTune *DomainCPUTune `xml:"cputune"`
+ Resource *DomainResource `xml:"resource"`
+ SysInfo *DomainSysInfo `xml:"sysinfo"`
+ 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"`
+ Devices *DomainDeviceList `xml:"devices"`
QEMUCommandline *DomainQEMUCommandline
}

func (d *Domain) Unmarshal(doc string) error {
28 changes: 22 additions & 6 deletions pkg/libvirttools/TestContainerLifecycle.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"SMM": null
},
"CPU": null,
"Clock": null,
"OnPoweroff": "destroy",
"OnReboot": "restart",
"OnCrash": "restart",
Expand Down Expand Up @@ -224,7 +225,8 @@
"Type": "qcow2",
"Cache": "",
"IO": "",
"ErrorPolicy": ""
"ErrorPolicy": "",
"Discard": ""
},
"Auth": null,
"Source": {
Expand All @@ -241,6 +243,7 @@
"Dev": "sda",
"Bus": "scsi"
},
"IOTune": null,
"Serial": "",
"ReadOnly": null,
"Shareable": null,
Expand All @@ -255,7 +258,8 @@
"Target": 0,
"Unit": 0
},
"Boot": null
"Boot": null,
"WWN": ""
},
{
"XMLName": {
Expand All @@ -270,7 +274,8 @@
"Type": "raw",
"Cache": "",
"IO": "",
"ErrorPolicy": ""
"ErrorPolicy": "",
"Discard": ""
},
"Auth": null,
"Source": {
Expand All @@ -287,6 +292,7 @@
"Dev": "sdb",
"Bus": "scsi"
},
"IOTune": null,
"Serial": "",
"ReadOnly": {},
"Shareable": null,
Expand All @@ -301,7 +307,8 @@
"Target": 0,
"Unit": 1
},
"Boot": null
"Boot": null,
"WWN": ""
}
],
"Filesystems": null,
Expand Down Expand Up @@ -351,6 +358,10 @@
],
"Graphics": [
{
"XMLName": {
"Space": "",
"Local": ""
},
"Type": "vnc",
"AutoPort": "",
"Port": -1,
Expand Down Expand Up @@ -390,9 +401,14 @@
],
"Channels": null,
"MemBalloon": null,
"Sounds": null
"Sounds": null,
"RNGs": null
},
"CMDLine": {
"QEMUCommandline": {
"XMLName": {
"Space": "",
"Local": ""
},
"Args": null,
"Envs": [
{
Expand Down
35 changes: 27 additions & 8 deletions pkg/libvirttools/TestDomainDefinitions__ceph_flexvolume.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
"SMM": null
},
"CPU": null,
"Clock": null,
"OnPoweroff": "destroy",
"OnReboot": "restart",
"OnCrash": "restart",
Expand Down Expand Up @@ -243,7 +244,8 @@
"Type": "qcow2",
"Cache": "",
"IO": "",
"ErrorPolicy": ""
"ErrorPolicy": "",
"Discard": ""
},
"Auth": null,
"Source": {
Expand All @@ -260,6 +262,7 @@
"Dev": "sda",
"Bus": "scsi"
},
"IOTune": null,
"Serial": "",
"ReadOnly": null,
"Shareable": null,
Expand All @@ -274,7 +277,8 @@
"Target": 0,
"Unit": 0
},
"Boot": null
"Boot": null,
"WWN": ""
},
{
"XMLName": {
Expand All @@ -289,7 +293,8 @@
"Type": "raw",
"Cache": "",
"IO": "",
"ErrorPolicy": ""
"ErrorPolicy": "",
"Discard": ""
},
"Auth": {
"Username": "libvirt",
Expand Down Expand Up @@ -320,6 +325,7 @@
"Dev": "sdb",
"Bus": "scsi"
},
"IOTune": null,
"Serial": "",
"ReadOnly": null,
"Shareable": null,
Expand All @@ -334,7 +340,8 @@
"Target": 0,
"Unit": 1
},
"Boot": null
"Boot": null,
"WWN": ""
},
{
"XMLName": {
Expand All @@ -349,7 +356,8 @@
"Type": "raw",
"Cache": "",
"IO": "",
"ErrorPolicy": ""
"ErrorPolicy": "",
"Discard": ""
},
"Auth": null,
"Source": {
Expand All @@ -366,6 +374,7 @@
"Dev": "sdc",
"Bus": "scsi"
},
"IOTune": null,
"Serial": "",
"ReadOnly": {},
"Shareable": null,
Expand All @@ -380,7 +389,8 @@
"Target": 0,
"Unit": 2
},
"Boot": null
"Boot": null,
"WWN": ""
}
],
"Filesystems": null,
Expand Down Expand Up @@ -430,6 +440,10 @@
],
"Graphics": [
{
"XMLName": {
"Space": "",
"Local": ""
},
"Type": "vnc",
"AutoPort": "",
"Port": -1,
Expand Down Expand Up @@ -469,9 +483,14 @@
],
"Channels": null,
"MemBalloon": null,
"Sounds": null
"Sounds": null,
"RNGs": null
},
"CMDLine": {
"QEMUCommandline": {
"XMLName": {
"Space": "",
"Local": ""
},
"Args": null,
"Envs": [
{
Expand Down
Loading

0 comments on commit 8823244

Please sign in to comment.