maybe adds new droplets from libvirt xml
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
583fa15779
commit
e807365ee9
|
@ -20,9 +20,25 @@ func addDomainDroplet(domcfg *libvirtxml.Domain) (*DropletT, error) {
|
|||
if d != nil {
|
||||
return d, errors.New(d.pb.Hostname + " droplet exists. need to update instead")
|
||||
}
|
||||
// this is a new unknown droplet (not in the config file)
|
||||
d = new(DropletT)
|
||||
|
||||
log.Info("ADD FAILED", domcfg.Name, domcfg.UUID)
|
||||
return nil, errors.New("not found")
|
||||
d.pb = me.cluster.AddDroplet(domcfg.UUID, domcfg.Name, 2, 2*1024*1024)
|
||||
me.droplets = append(me.droplets, d)
|
||||
me.changed = true
|
||||
|
||||
if updateDroplet(d, domcfg) {
|
||||
if me.changed {
|
||||
log.Info("updateDroplet() worked. droplet changed")
|
||||
} else {
|
||||
log.Info("updateDroplet() worked. nothing changed")
|
||||
}
|
||||
} else {
|
||||
log.Info("updateDroplet() failed for", d.pb.Hostname)
|
||||
return d, errors.New("update failed for " + domcfg.Name)
|
||||
}
|
||||
log.Info("added new droplet", domcfg.Name, domcfg.UUID)
|
||||
return d, nil
|
||||
}
|
||||
|
||||
func findDomain(domcfg *libvirtxml.Domain) (*DropletT, error) {
|
||||
|
@ -192,7 +208,7 @@ func updateDisk(d *DropletT, domcfg *libvirtxml.Domain) bool {
|
|||
t = disk.Source.File
|
||||
filename := t.File
|
||||
if filename == "" {
|
||||
fmt.Println("No disk source file found.")
|
||||
fmt.Println("No disk source file found.")
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue