From ea96b6696d29713639d9f167e1d38616bcd5f753 Mon Sep 17 00:00:00 2001 From: Eamonn O'Toole Date: Fri, 20 Jan 2017 15:28:40 +0000 Subject: 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 --- libvirt/domain_def.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'libvirt/domain_def.go') 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{} -- cgit v1.2.3