Пример #1
0
func (command *commandRebuild) Execute(resource *handler.Resource) {
	opts := resource.Params.(*paramsRebuild).opts
	serverID := resource.Params.(*paramsRebuild).serverID
	server, err := servers.Rebuild(command.Ctx.ServiceClient, serverID, opts).Extract()
	if err != nil {
		resource.Err = err
		return
	}
	resource.Result = serverSingle(server)
}
Пример #2
0
func rebuildServer(t *testing.T, client *gophercloud.ServiceClient, server *os.Server) {
	t.Logf("> servers.Rebuild")

	options, err := optionsFromEnv()
	th.AssertNoErr(t, err)

	opts := servers.RebuildOpts{
		Name:       tools.RandomString("RenamedGopher", 16),
		AdminPass:  tools.MakeNewPassword(server.AdminPass),
		ImageID:    options.imageID,
		DiskConfig: diskconfig.Manual,
	}
	after, err := servers.Rebuild(client, server.ID, opts).Extract()
	th.AssertNoErr(t, err)
	th.CheckEquals(t, after.ID, server.ID)

	err = servers.WaitForStatus(client, after.ID, "ACTIVE", 300)
	th.AssertNoErr(t, err)

	t.Logf("Server successfully rebuilt.")
	logServer(t, after, -1)
}