Commit d07fddd9 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Implement a resize_server @ clients.compute

Refs: #4153
parent 6325d148
......@@ -349,3 +349,13 @@ class ComputeClient(ComputeRestClient):
"""
r = self.floating_ips_delete(tenant_id, fip_id)
return r.headers
def resize_server(self, server_id, flavor_id):
"""
:param server_id: (str)
:param flavor_id: (int)
"""
req = {'resize': {'flavorRef': flavor_id}}
r = self.servers_post(server_id, 'action', json_data=req)
return r.headers
......@@ -375,6 +375,13 @@ class ComputeClient(TestCase):
vm_id, 'action',
json_data=dict(reboot=dict(type='HARD' if hard else 'SOFT'))))
@patch('%s.servers_post' % compute_pkg, return_value=FR())
def test_resize_server(self, SP):
vm_id, flavor = vm_recv['server']['id'], flavor_list['flavors'][1]
self.client.resize_server(vm_id, flavor['id'])
exp = dict(resize=dict(flavorRef=flavor['id']))
SP.assert_called_once_with(vm_id, 'action', json_data=exp)
@patch('%s.servers_put' % compute_pkg, return_value=FR())
def test_create_server_metadata(self, SP):
vm_id = vm_recv['server']['id']
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment