more xml importing
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
d13ac244ed
commit
2df36637bf
|
@ -250,6 +250,17 @@ func updateNetwork(d *DropletT, domcfg *libvirtxml.Domain) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* from vm3-with-nvme-1.5GB-sec.xml
|
||||||
|
<disk type='block' device='disk'>
|
||||||
|
<driver name='qemu' type='raw'/>
|
||||||
|
<source dev='/dev/nvme4n1'/>
|
||||||
|
<backingStore/>
|
||||||
|
<target dev='vdb' bus='virtio'/>
|
||||||
|
<alias name='virtio-disk1'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||||
|
</disk>
|
||||||
|
*/
|
||||||
|
|
||||||
// returns false if something went wrong
|
// returns false if something went wrong
|
||||||
func updateDisk(d *DropletT, domcfg *libvirtxml.Domain) bool {
|
func updateDisk(d *DropletT, domcfg *libvirtxml.Domain) bool {
|
||||||
if (d == nil) || (domcfg == nil) {
|
if (d == nil) || (domcfg == nil) {
|
||||||
|
|
56
xml.go
56
xml.go
|
@ -354,13 +354,14 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this will move elsewhere in the protobuf someday
|
// this will move elsewhere in the protobuf someday
|
||||||
if domcfg.OnPoweroff == "destroy" {
|
// ignore all these for now
|
||||||
|
if domcfg.OnPoweroff != "" { // normally "destroy"
|
||||||
domcfg.OnPoweroff = ""
|
domcfg.OnPoweroff = ""
|
||||||
}
|
}
|
||||||
if domcfg.OnCrash == "destroy" {
|
if domcfg.OnCrash != "" { // normally "restart", often "destroy"
|
||||||
domcfg.OnCrash = ""
|
domcfg.OnCrash = ""
|
||||||
}
|
}
|
||||||
if domcfg.OnReboot == "restart" {
|
if domcfg.OnReboot != "" { // normally "restart"
|
||||||
domcfg.OnReboot = ""
|
domcfg.OnReboot = ""
|
||||||
}
|
}
|
||||||
// same with PM. move to protobuf
|
// same with PM. move to protobuf
|
||||||
|
@ -480,32 +481,47 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
|
||||||
var normalSpice bool = true
|
var normalSpice bool = true
|
||||||
if domcfg.Devices.Graphics != nil {
|
if domcfg.Devices.Graphics != nil {
|
||||||
for i, g := range domcfg.Devices.Graphics {
|
for i, g := range domcfg.Devices.Graphics {
|
||||||
if g.Spice == nil {
|
if g.VNC != nil {
|
||||||
// figure out what to do with non-spice stuff
|
// ignore vnc settings
|
||||||
fmt.Printf("Graphics: %d %+v\n", i, g)
|
// fmt.Printf("Ignore Graphics VNC settings: %d %+v\n", i, g)
|
||||||
normalSpice = false
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// this is all moved to updateDroplet()
|
if g.Spice != nil {
|
||||||
// this is a spice definition, just ignore it
|
// this is all moved to updateDroplet()
|
||||||
// because port mappings and network access will be handled
|
// this is a spice definition, just ignore it
|
||||||
// somewhere else someday
|
// because port mappings and network access will be handled
|
||||||
// fmt.Printf("Graphics: %d %+v\n", i, g)
|
// somewhere else someday
|
||||||
var s *libvirtxml.DomainGraphicSpice
|
// fmt.Printf("Graphics: %d %+v\n", i, g)
|
||||||
s = g.Spice
|
var s *libvirtxml.DomainGraphicSpice
|
||||||
// fmt.Printf("Spice: %d %+v %s\n", i, s, s.AutoPort)
|
s = g.Spice
|
||||||
if s.AutoPort == "yes" {
|
// fmt.Printf("Spice: %d %+v %s\n", i, s, s.AutoPort)
|
||||||
// should ignore either way
|
if s.AutoPort == "yes" {
|
||||||
} else {
|
// should ignore either way
|
||||||
// print out, but ignore the port number
|
} else {
|
||||||
// fmt.Printf("Spice Port = %d\n", s.Port)
|
// print out, but ignore the port number
|
||||||
|
// fmt.Printf("Spice Port = %d\n", s.Port)
|
||||||
|
}
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
// figure out what to do with non-spice stuff
|
||||||
|
fmt.Printf("Unknown Graphics: %d %+v\n", i, g)
|
||||||
|
normalSpice = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if normalSpice {
|
if normalSpice {
|
||||||
domcfg.Devices.Graphics = nil
|
domcfg.Devices.Graphics = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// blank out emulator. should be in dom0
|
||||||
|
switch domcfg.Devices.Emulator {
|
||||||
|
case "":
|
||||||
|
domcfg.Devices.Emulator = ""
|
||||||
|
case "/usr/bin/kvm":
|
||||||
|
domcfg.Devices.Emulator = ""
|
||||||
|
default:
|
||||||
|
fmt.Printf("Unknown Emulator: %s\n", domcfg.Devices.Emulator)
|
||||||
|
}
|
||||||
|
|
||||||
// ignore Channels == SpiceVMC
|
// ignore Channels == SpiceVMC
|
||||||
normalSpice = true
|
normalSpice = true
|
||||||
if domcfg.Devices.Channels != nil {
|
if domcfg.Devices.Channels != nil {
|
||||||
|
|
Loading…
Reference in New Issue