Merge "Service Instance: Add instance reboot method"
This commit is contained in:
commit
2feafe5aa5
@ -637,6 +637,11 @@ class ServiceInstanceManager(object):
|
||||
timeout=timeout,
|
||||
instance_status=instance_status))
|
||||
|
||||
def reboot_server(self, server, soft_reboot=False):
|
||||
self.compute_api.server_reboot(self.admin_context,
|
||||
server['instance_id'],
|
||||
soft_reboot)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BaseNetworkhelper(object):
|
||||
|
@ -90,6 +90,9 @@ class API(object):
|
||||
def server_get_by_name_or_id(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def server_reboot(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def keypair_list(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
@ -1215,6 +1215,20 @@ class ServiceInstanceManagerTestCase(test.TestCase):
|
||||
expected_try_count=1,
|
||||
expected_ret_val=mock_instance)
|
||||
|
||||
def test_reboot_server(self):
|
||||
fake_server = {'instance_id': mock.sentinel.instance_id}
|
||||
soft_reboot = True
|
||||
|
||||
mock_reboot = mock.Mock()
|
||||
self.mock_object(self._manager.compute_api, 'server_reboot',
|
||||
mock_reboot)
|
||||
|
||||
self._manager.reboot_server(fake_server, soft_reboot)
|
||||
|
||||
mock_reboot.assert_called_once_with(self._manager.admin_context,
|
||||
fake_server['instance_id'],
|
||||
soft_reboot)
|
||||
|
||||
|
||||
class BaseNetworkHelperTestCase(test.TestCase):
|
||||
"""Tests Base network helper for service instance."""
|
||||
|
Loading…
Reference in New Issue
Block a user