summaryrefslogtreecommitdiff
path: root/libvirt/domain_def.go
diff options
context:
space:
mode:
authorEamonn O'Toole <eamonn.otoole@hpe.com>2017-01-20 15:28:40 +0000
committerEamonn O'Toole <eamonn.otoole@hpe.com>2017-02-08 13:58:27 +0000
commitea96b6696d29713639d9f167e1d38616bcd5f753 (patch)
tree2873c40b8bbc76c3309195ef281278313ff49443 /libvirt/domain_def.go
parentb43db5136f5d80267a8172289af3133e4ab241ab (diff)
downloadterraform-provider-libvirt-ea96b6696d29713639d9f167e1d38616bcd5f753.tar
terraform-provider-libvirt-ea96b6696d29713639d9f167e1d38616bcd5f753.tar.gz
Add support for CoreOS ignition and console blocks
A few changes here: 1. CoreOS Ignition support: A CoreOS Ignition file can be specified for a domain using the "coreos_ignition" parameter. This requires the emission of additional XML and also the setting of the XML name-space to "http://libvirt.org/schemas/domain/qemu/1.0" 2. "graphics" block: A "graphics" block can be specified in a domain definition. We've added this because we've found that for some builds of qemu the default "spice" emulator doesn't work and results in failure to boot the VMs. 3. "console" block: One or more "console" blocks can be specified in a domain definition. Note the description in domain.html.markdown, and the description in https://libvirt.org/formatdomain.html#elementsConsole
Diffstat (limited to 'libvirt/domain_def.go')
-rw-r--r--libvirt/domain_def.go24
1 files changed, 23 insertions, 1 deletions
diff --git a/libvirt/domain_def.go b/libvirt/domain_def.go
index 953fcdb7..e6952d79 100644
--- a/libvirt/domain_def.go
+++ b/libvirt/domain_def.go
@@ -8,6 +8,7 @@ type defDomain struct {
XMLName xml.Name `xml:"domain"`
Name string `xml:"name"`
Type string `xml:"type,attr"`
+ Xmlns string `xml:"xmlns:qemu,attr"`
Os defOs `xml:"os"`
Memory defMemory `xml:"memory"`
VCpu defVCpu `xml:"vcpu"`
@@ -23,7 +24,8 @@ type defDomain struct {
Devices struct {
Disks []defDisk `xml:"disk"`
NetworkInterfaces []defNetworkInterface `xml:"interface"`
- Graphics struct {
+ Console []defConsole `xml:"console"`
+ Graphics struct {
Type string `xml:"type,attr"`
Autoport string `xml:"autoport,attr"`
Listen struct {
@@ -48,6 +50,10 @@ type defDomain struct {
} `xml:"backend"`
} `xml:"rng"`
} `xml:"devices"`
+ CmdLine struct {
+ XMLName xml.Name `xml:"qemu:commandline"`
+ Cmd []defCmd `xml:"qemu:arg"`
+ }
}
type defMetadata struct {
@@ -77,6 +83,10 @@ type defVCpu struct {
Amount int `xml:",chardata"`
}
+type defCmd struct {
+ Value string `xml:"value,attr"`
+}
+
type defLoader struct {
ReadOnly string `xml:"readonly,attr,omitempty"`
Type string `xml:"type,attr,omitempty"`
@@ -88,12 +98,24 @@ type defNvRam struct {
File string `xml:",chardata"`
}
+type defConsole struct {
+ Type string `xml:"type,attr"`
+ Source struct {
+ Path string `xml:"path,attr,omitempty"`
+ } `xml:"source"`
+ Target struct {
+ Type string `xml:"type,attr,omitempty"`
+ Port string `xml:"port,attr"`
+ } `xml:"target"`
+}
+
// Creates a domain definition with the defaults
// the provider uses
func newDomainDef() defDomain {
// libvirt domain definition
domainDef := defDomain{}
domainDef.Type = "kvm"
+ domainDef.Xmlns = ""
domainDef.Os = defOs{}
domainDef.Os.Type = defOsType{}