// aSuitableFlavor finds the minimum flavor capable of running the test image // chosen by aSuitableImage. If none can be found, this function will panic. func aSuitableFlavor(api gophercloud.CloudServersProvider) string { flavors, err := api.ListFlavors() if err != nil { panic(err) } // TODO(sfalvo): // Works for Rackspace, might not work for your provider! // Need to figure out why ListFlavors() provides 0 values for // Ram and Disk fields. // // Until then, just return Ubuntu 12.04 LTS. for i := 0; i < len(flavors); i++ { if flavors[i].Id == "2" { return flavors[i].Id } } panic("Flavor 2 (512MB 1-core 20GB machine) not found.") }