diff --git a/start.go b/start.go index 0672b38..d71b5ed 100644 --- a/start.go +++ b/start.go @@ -14,7 +14,7 @@ import ( ) // generate the XML for 'virsh create' -func StartDropletXml(d *pb.Droplet, domcfg *libvirtxml.Domain, hostname string) { +func StartDropletXml(cluster *pb.Cluster, d *pb.Droplet, domcfg *libvirtxml.Domain, hostname string) { /* if d == nil { log.Info("droplet is nil") @@ -70,8 +70,14 @@ func StartDropletXml(d *pb.Droplet, domcfg *libvirtxml.Domain, hostname string) // add a check here to make these unique // setRandomMacs(domcfg) + if len(cluster.Dirs) == 0 { + log.Info("ERROR: cluster dirs was empty. adding default location.") + log.Info("add paths to search for in ~/.config/virtigo/cluster.text") + cluster.Dirs = append(cluster.Dirs, "/var/libvirt/images") + } + log.Info("Should look in cluster dirs:", cluster.Dirs) for _, disk := range d.Disks { - fullname := findDisk([]string{"/home/nfs2", "/var/lib/libvirt/images"}, disk.Filename) + fullname := findDisk(cluster.Dirs, disk.Filename) if fullname == "" { log.Info("can not find disk", d.Hostname, "dir", disk.Filepath, "filename", disk.Filename) os.Exit(-1) diff --git a/validate.go b/validate.go index bfac46a..f64df1b 100644 --- a/validate.go +++ b/validate.go @@ -167,6 +167,7 @@ func CheckDiskFilenames(cluster *pb.Cluster) []*pb.Event { return alle } +// this doesn't run often func CheckDroplets(cluster *pb.Cluster, dump bool) bool { // uuid map to check for duplicates var umap map[string]string