mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #3799 from Ladas/openstack_add_server_evacuate_action
OpenStack add server evacuate action
This commit is contained in:
commit
5ab679756e
3 changed files with 32 additions and 0 deletions
|
@ -106,6 +106,7 @@ module Fog
|
|||
request :get_vnc_console
|
||||
request :live_migrate_server
|
||||
request :migrate_server
|
||||
request :evacuate_server
|
||||
|
||||
# Service CRUD
|
||||
request :list_services
|
||||
|
|
|
@ -292,6 +292,11 @@ module Fog
|
|||
service.live_migrate_server(id, host, block_migration, disk_over_commit)
|
||||
end
|
||||
|
||||
def evacuate(host, on_shared_storage, admin_password = nil)
|
||||
requires :id
|
||||
service.evacuate_server(id, host, on_shared_storage, admin_password)
|
||||
end
|
||||
|
||||
def associate_address(floating_ip)
|
||||
requires :id
|
||||
service.associate_address id, floating_ip
|
||||
|
|
26
lib/fog/openstack/requests/compute/evacuate_server.rb
Normal file
26
lib/fog/openstack/requests/compute/evacuate_server.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class OpenStack
|
||||
class Real
|
||||
def evacuate_server(server_id, host, on_shared_storage, admin_password = nil)
|
||||
body = {
|
||||
'evacuate' => {
|
||||
'host' => host,
|
||||
'onSharedStorage' => on_shared_storage,
|
||||
'admin_password' => admin_password,
|
||||
}
|
||||
}
|
||||
server_action(server_id, body)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def evacuate_server(server_id, host, on_shared_storage, admin_password = nil)
|
||||
response = Excon::Response.new
|
||||
response.status = 202
|
||||
response
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue