summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--addDroplet.go4
-rw-r--r--xml.go42
3 files changed, 32 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index b24ceee..6f12125 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ REDOMOD = $(shell if [ -e go.sum ]; then echo go.sum exists; else GO111MODULE=
all:
GO111MODULE=off go build -v -ldflags "-X main.Version=${VERSION} -X gui.GUIVERSION=${VERSION}"
./virtigo --version
- ./virtigo
+ ./virtigo --help
xml-add:
./virtigo --add-xml /home/nfs3/xml/*.xml
diff --git a/addDroplet.go b/addDroplet.go
index 8c805cb..898ebe5 100644
--- a/addDroplet.go
+++ b/addDroplet.go
@@ -258,6 +258,10 @@ func updateDisk(d *DropletT, domcfg *libvirtxml.Domain) bool {
for _, disk := range domcfg.Devices.Disks {
var t *libvirtxml.DomainDiskSourceFile
t = disk.Source.File
+ if t == nil {
+ fmt.Println("disk.Source.File == nil")
+ continue
+ }
filename := t.File
if filename == "" {
fmt.Println("No disk source file found.")
diff --git a/xml.go b/xml.go
index 4035a85..182fcc3 100644
--- a/xml.go
+++ b/xml.go
@@ -289,8 +289,10 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
featurematch = false
}
// what is VMPort anyway?
- if domcfg.Features.VMPort.State == "off" {
- domcfg.Features.VMPort = nil
+ if domcfg.Features.VMPort != nil {
+ if domcfg.Features.VMPort.State == "off" {
+ domcfg.Features.VMPort = nil
+ }
} else {
featurematch = false
}
@@ -318,13 +320,17 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
domcfg.Memory = nil
domcfg.CurrentMemory = nil
domcfg.VCPU = nil
- switch domcfg.CPU.Mode {
- case "host-passthrough":
- domcfg.CPU = nil
- case "host-model":
- domcfg.CPU = nil
- default:
- fmt.Printf("? CPU Mode: %+v\n", domcfg.CPU.Mode)
+ // is this always "host-passthrough" and "host-model"?
+ // only Fabrice knows :)
+ if domcfg.CPU != nil {
+ switch domcfg.CPU.Mode {
+ case "host-passthrough":
+ domcfg.CPU = nil
+ case "host-model":
+ domcfg.CPU = nil
+ default:
+ fmt.Printf("? CPU Mode: %+v\n", domcfg.CPU.Mode)
+ }
}
// this goes away if SecLabel is zero'd out?
@@ -388,6 +394,7 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
case "usb":
switch controller.Model {
case "ich9-ehci1":
+ case "piix3-uhci":
case "qemu-xhci":
// fmt.Printf("OK USB: %s, %d\n", controller.Model, *controller.Index)
case "ich9-uhci1":
@@ -420,18 +427,21 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
normalPCI = false
}
case "pci":
+ // these are the strings I've found so far
switch controller.Model {
+ case "pci-root":
case "pcie-root":
- // pcie-root
case "pcie-root-port":
- // pcie-root
case "pcie-to-pci-bridge":
- // pcie-root
default:
fmt.Printf("PCI: %s, %d\n", controller.Model, *controller.Index)
// Domain:0xc0002d2760 Bus:0xc0002d2768 Slot:0xc0002d2770 Function:0xc0002d2778 MultiFunction:
- pci := controller.Address.PCI
- fmt.Printf("PCI: Domain: %+v Slot %d Function %d\n", *pci.Domain, *pci.Slot, *pci.Function)
+ if controller.Address == nil {
+ fmt.Printf("PCI: controller.Address = nil\n")
+ } else {
+ pci := controller.Address.PCI
+ fmt.Printf("PCI: Domain: %+v Slot %d Function %d\n", *pci.Domain, *pci.Slot, *pci.Function)
+ }
normalPCI = false
keepPCI = append(keepPCI, controller)
}
@@ -558,7 +568,8 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
domcfg.Devices.RNGs = nil
}
- // this is probably for spice to have keyboard and mouse input
+ // don't copy this over here yet.
+ // probably most domU's don't really use/need it set to what is in the XML
var normalVideo bool = true
if domcfg.Devices.Videos != nil {
for _, v := range domcfg.Devices.Videos {
@@ -571,6 +582,7 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
fmt.Printf("? Video Model: %+v\n", v.Model)
normalVideo = false
}
+ case "cirrus":
case "virtio":
// this should always be standard
//fmt.Printf("? Video: %+v\n", v)