func (c context) createInstance() { if os.Getenv(envDSType) == "" { c.test.Fatalf("%s must be set as an environment var", envDSType) } opts := instances.CreateOpts{ FlavorRef: "2", Size: 5, Name: tools.RandomString("gopher_db", 5), Datastore: &instances.DatastoreOpts{Type: os.Getenv(envDSType)}, } instance, err := instances.Create(c.client, opts).Extract() th.AssertNoErr(c.test, err) c.Logf("Restarting %s. Waiting...", instance.ID) c.WaitUntilActive(instance.ID) c.Logf("Created Instance %s", instance.ID) c.instanceID = instance.ID }
// Create asynchronously provisions a new database instance. It requires the // user to specify a flavor and a volume size. The API service then provisions // the instance with the requested flavor and sets up a volume of the specified // size, which is the storage for the database instance. // // Although this call only allows the creation of 1 instance per request, you // can create an instance with multiple databases and users. The default // binding for a MySQL instance is port 3306. func Create(client *gophercloud.ServiceClient, opts os.CreateOptsBuilder) CreateResult { return CreateResult{os.Create(client, opts)} }