1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[openstack|compute] Add "Reset Server State" request

This commit is contained in:
Nelvin Driz 2012-11-26 17:30:40 +08:00
parent 41b7e330af
commit 1b522a54ce
4 changed files with 31 additions and 1 deletions

View file

@ -69,6 +69,7 @@ module Fog
request :remove_fixed_ip
request :server_diagnostics
request :boot_from_snapshot
request :reset_server_state
# Server Extenstions
request :get_console_output

View file

@ -17,7 +17,7 @@ module Fog
def save
requires :name, :description
data = connection.create_security_group(name, description)
merge_attributes(data.body['security_groups'])
merge_attributes(data.body['security_group'])
true
end

View file

@ -195,6 +195,11 @@ module Fog
connection.disassociate_address id, floating_ip
end
def reset_vm_state(vm_state)
requires :id
connection.reset_server_state id, vm_state
end
def min_count=(new_min_count)
@min_count = new_min_count
end

View file

@ -0,0 +1,24 @@
module Fog
module Compute
class OpenStack
class Real
def reset_server_state(server_id, status)
body = { 'os-resetState' => { 'state' => status } }
server_action(server_id, body, 202)
end
end
class Mock
def reset_server_state(server_id, status)
response = get_server_details(server_id)
response.body['server']['status'] = status.upcase
response
end
end
end
end
end