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
|
||||
}
|
||||
|
||||
/* 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
|
||||
func updateDisk(d *DropletT, domcfg *libvirtxml.Domain) bool {
|
||||
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
|
||||
if domcfg.OnPoweroff == "destroy" {
|
||||
// ignore all these for now
|
||||
if domcfg.OnPoweroff != "" { // normally "destroy"
|
||||
domcfg.OnPoweroff = ""
|
||||
}
|
||||
if domcfg.OnCrash == "destroy" {
|
||||
if domcfg.OnCrash != "" { // normally "restart", often "destroy"
|
||||
domcfg.OnCrash = ""
|
||||
}
|
||||
if domcfg.OnReboot == "restart" {
|
||||
if domcfg.OnReboot != "" { // normally "restart"
|
||||
domcfg.OnReboot = ""
|
||||
}
|
||||
// same with PM. move to protobuf
|
||||
|
@ -480,32 +481,47 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
|
|||
var normalSpice bool = true
|
||||
if domcfg.Devices.Graphics != nil {
|
||||
for i, g := range domcfg.Devices.Graphics {
|
||||
if g.Spice == nil {
|
||||
// figure out what to do with non-spice stuff
|
||||
fmt.Printf("Graphics: %d %+v\n", i, g)
|
||||
normalSpice = false
|
||||
if g.VNC != nil {
|
||||
// ignore vnc settings
|
||||
// fmt.Printf("Ignore Graphics VNC settings: %d %+v\n", i, g)
|
||||
continue
|
||||
}
|
||||
// this is all moved to updateDroplet()
|
||||
// this is a spice definition, just ignore it
|
||||
// because port mappings and network access will be handled
|
||||
// somewhere else someday
|
||||
// fmt.Printf("Graphics: %d %+v\n", i, g)
|
||||
var s *libvirtxml.DomainGraphicSpice
|
||||
s = g.Spice
|
||||
// fmt.Printf("Spice: %d %+v %s\n", i, s, s.AutoPort)
|
||||
if s.AutoPort == "yes" {
|
||||
// should ignore either way
|
||||
} else {
|
||||
// print out, but ignore the port number
|
||||
// fmt.Printf("Spice Port = %d\n", s.Port)
|
||||
if g.Spice != nil {
|
||||
// this is all moved to updateDroplet()
|
||||
// this is a spice definition, just ignore it
|
||||
// because port mappings and network access will be handled
|
||||
// somewhere else someday
|
||||
// fmt.Printf("Graphics: %d %+v\n", i, g)
|
||||
var s *libvirtxml.DomainGraphicSpice
|
||||
s = g.Spice
|
||||
// fmt.Printf("Spice: %d %+v %s\n", i, s, s.AutoPort)
|
||||
if s.AutoPort == "yes" {
|
||||
// should ignore either way
|
||||
} else {
|
||||
// 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 {
|
||||
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
|
||||
normalSpice = true
|
||||
if domcfg.Devices.Channels != nil {
|
||||
|
|
Loading…
Reference in New Issue