Ejemplo n.º 1
0
func (c *context) createInstance() {
	opts := instances.CreateOpts{
		FlavorRef: "1",
		Size:      1,
		Name:      tools.RandomString("gopher_db", 5),
	}

	instance, err := instances.Create(c.client, opts).Extract()
	th.AssertNoErr(c.test, err)

	c.Logf("Creating %s. Waiting...", instance.ID)
	c.WaitUntilActive(instance.ID)
	c.Logf("Created instance %s", instance.ID)

	c.instanceID = instance.ID
}
Ejemplo n.º 2
0
func (c *context) createReplica() {
	opts := instances.CreateOpts{
		FlavorRef: "2",
		Size:      1,
		Name:      tools.RandomString("gopher_db", 5),
		ReplicaOf: c.instanceID,
	}

	repl, err := instances.Create(c.client, opts).Extract()
	th.AssertNoErr(c.test, err)

	c.Logf("Creating replica of %s. Waiting...", c.instanceID)
	c.WaitUntilActive(repl.ID)
	c.Logf("Created replica %#v", repl)

	c.replicaID = repl.ID
}