func initVms() error { iaas := os.Getenv("IAAS") if len(iaas) == 0 { return errors.New("No iaas provided") } m := make(map[string]string, 0) switch iaas { case "vmwarefusion": m["PLAZA_LOCATION"] = os.Getenv("PLAZA_LOCATION") m["STORAGE_DIR"] = os.Getenv("STORAGE_DIR") case "qemu": m["ad"] = utils.Env("PLAZA_ADDRESS", "iaas-module") case "manual": /* env variables are now used in migration. The following variables must be set: - EXECUTION_SERVERS */ } vm, err := vms.Open(iaas, m) if err != nil { return err } vmsConn.SetVM(vm) return nil }
func TestOpen(t *testing.T) { v, err := vms.Open("test", nil) if err != nil { t.Fatal(err) } types, err := (*v).Types() if err != nil { t.Fatal(err) } if len(types) < 1 { t.Fatalf("empty type list retured") } connector.SetVM(v) }
func initVms() error { iaas := os.Getenv("IAAS") if len(iaas) == 0 { return errors.New("No iaas provided") } m := make(map[string]string, 0) m["servers"] = os.Getenv("EXECUTION_SERVERS") m["ad"] = os.Getenv("WIN_SERVER") m["sshport"] = os.Getenv("SSH_PORT") m["password"] = os.Getenv("WIN_PASSWORD") m["user"] = os.Getenv("WIN_USER") vm, err := vms.Open(iaas, m) if err != nil { return err } vmsConn.SetVM(vm) return nil }