diff options
| author | Jeff Carr <[email protected]> | 2024-10-23 20:40:08 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-23 20:40:08 -0500 |
| commit | 2df36637bf502f952ee0d2225459afbb9722949c (patch) | |
| tree | affddcb1e51afbc49cd667e2342123cd488b8104 | |
| parent | d13ac244ed0143006d9e0ac6f47fcb0543696325 (diff) | |
more xml importing
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | addDroplet.go | 11 | ||||
| -rw-r--r-- | xml.go | 56 |
2 files changed, 47 insertions, 20 deletions
diff --git a/addDroplet.go b/addDroplet.go index 898ebe5..1d95510 100644 --- a/addDroplet.go +++ b/addDroplet.go @@ -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) { @@ -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 { |
