Ejemplo n.º 1
0
func (command *commandResize) Execute(resource *handler.Resource) {
	params := resource.Params.(*paramsResize)
	err := servers.Resize(command.Ctx.ServiceClient, params.serverID, params.opts).ExtractErr()
	if err != nil {
		resource.Err = err
		return
	}
	resource.Result = fmt.Sprintf("Successfully resized instance [%s] to flavor [%s]\n", params.serverID, params.opts.FlavorRef)
}
Ejemplo n.º 2
0
func (command *commandResize) Execute(resource *handler.Resource) {
	params := resource.Params.(*paramsResize)
	err := servers.Resize(command.Ctx.ServiceClient, params.serverID, params.opts).ExtractErr()
	if err != nil {
		resource.Err = err
		return
	}

	if params.wait {
		err = osServers.WaitForStatus(command.Ctx.ServiceClient, params.serverID, "VERIFY_RESIZE", 600)
		if err != nil {
			resource.Err = err
			return
		}

		resource.Result = fmt.Sprintf("Instance [%s] awaiting confirmation of to be resized to flavor [%s]\n", params.serverID, params.opts.FlavorRef)
	} else {
		resource.Result = fmt.Sprintf("Transitioning instance [%s] to a status of VERIFY_RESIZE\n", params.serverID)
	}
}