Service Instance: Add instance reboot method

This patch adds a method in the Service Instance manager class,
responsible of rebooting service instances.

This will be used by the soon to be introduced Windows Driver.

Change-Id: Id82803339f5ddfef64eaf30a72d2c1632c4c6a9b
Partially-implements: blueprint windows-smb-support
This commit is contained in:
Lucian Petrut 2015-07-29 01:46:14 +03:00
parent 39cb200cbf
commit 8d9ef0b7c8
3 changed files with 22 additions and 0 deletions

View File

@ -629,6 +629,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):

View File

@ -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

View File

@ -1210,6 +1210,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."""