Beispiel #1
0
func (c *context) createBackup() {
	opts := backups.CreateOpts{
		Name:       tools.RandomString("backup_", 5),
		InstanceID: c.instanceID,
	}

	backup, err := backups.Create(c.client, opts).Extract()

	c.Logf("Created backup %#v", backup)
	c.AssertNoErr(err)

	err = gophercloud.WaitFor(60, func() (bool, error) {
		b, err := backups.Get(c.client, backup.ID).Extract()
		if err != nil {
			return false, err
		}
		if b.Status == "COMPLETED" {
			return true, nil
		}
		return false, nil
	})
	c.AssertNoErr(err)

	c.backupID = backup.ID
}
Beispiel #2
0
func (c *context) getBackup() {
	backup, err := backups.Get(c.client, c.backupID).Extract()
	c.AssertNoErr(err)
	c.Logf("Getting backup %s", backup.ID)
}