2013-01-18 17:34:08 +02:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class CloudSigma
|
|
|
|
class Real
|
2016-08-12 17:26:17 +04:00
|
|
|
def stop_server(server_id, graceful_acpi = false)
|
|
|
|
action = graceful_acpi ? :shutdown : :stop
|
2013-01-18 17:34:08 +02:00
|
|
|
request(:path => "servers/#{server_id}/action/",
|
|
|
|
:method => 'POST',
|
2016-08-12 17:26:17 +04:00
|
|
|
:query => {:do => action},
|
2013-01-18 17:34:08 +02:00
|
|
|
:expects => [200, 202])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Mock
|
2016-08-12 17:26:17 +04:00
|
|
|
def stop_server(server_id, graceful_acpi = false)
|
2013-01-18 17:34:08 +02:00
|
|
|
server = self.data[:servers][server_id]
|
|
|
|
server['status'] = 'stopped'
|
|
|
|
|
|
|
|
response = Excon::Response.new
|
|
|
|
response.status = 200
|
|
|
|
response.body = {
|
2016-08-12 17:26:17 +04:00
|
|
|
'action' => graceful_acpi ? 'shutdown' : 'stop',
|
2013-01-18 17:34:08 +02:00
|
|
|
'result' => 'success',
|
|
|
|
'uuid' => server_id
|
|
|
|
}
|
|
|
|
|
|
|
|
response
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|