Remove 'on_shared_storage' parameter from nova evacuate

Starting since version 2.14, Nova automatically detects whether the
server data is on shared storage or not.

Removed 'on_shared_storage' parameter from nova evacuate call and
bumped nova api version from 2.9 to 2.14 so that shared storage
deployment can be detected by nova. Also added a related note in
README.rst to point out. Operators should configure shared storage
to use maskari otherwise instance data will be lost after evacuation.

Change-Id: I0b0581a5c84143fc91c9fc6e2c440096013c7438
This commit is contained in:
Dinesh Bhor 2017-07-11 12:57:31 +05:30
parent b26ba43f72
commit 212d254da1
4 changed files with 13 additions and 7 deletions

View File

@ -11,6 +11,14 @@ provisioning process down, and nova-compute host failure.
It also provides API service for manage and control the automated
rescue mechanism.
NOTE:
Use masakari only if instance path is configured on shared storage system
i.e, 'instances_path' config option of nova has a path of shared directory
otherwise instance data will be lost after the evacuation of instance from
failed host if,
* instance is booted from image
* flavor using ephemeral disks is used
Original version of Masakari: https://github.com/ntt-sic/masakari
Tokyo Summit Session: https://www.youtube.com/watch?v=BmjNKceW_9A

View File

@ -39,7 +39,7 @@ CONF.import_group('keystone_authtoken', 'keystonemiddleware.auth_token')
LOG = logging.getLogger(__name__)
NOVA_API_VERSION = "2.9"
NOVA_API_VERSION = "2.14"
nova_extensions = [ext for ext in
nova_client.discover_extensions(NOVA_API_VERSION)
@ -163,15 +163,13 @@ class API(object):
return service.status == 'disabled'
@translate_nova_exception
def evacuate_instance(self, context, uuid, target=None,
on_shared_storage=True):
def evacuate_instance(self, context, uuid, target=None):
"""Evacuate an instance from failed host to specified host."""
msg = ('Call evacuate command for instance %(uuid)s on host '
'%(target)s')
LOG.info(msg, {'uuid': uuid, 'target': target})
nova = novaclient(context)
nova.servers.evacuate(uuid, host=target,
on_shared_storage=on_shared_storage)
nova.servers.evacuate(uuid, host=target)
@translate_nova_exception
def reset_instance_state(self, context, uuid, status='error'):

View File

@ -217,7 +217,7 @@ class NovaApiTestCase(test.TestCase):
mock_novaclient.assert_called_once_with(self.ctx)
mock_servers.evacuate.assert_called_once_with(
uuidsentinel.fake_server, host=None, on_shared_storage=True)
uuidsentinel.fake_server, host=None)
@mock.patch('masakari.compute.nova.novaclient')
def test_stop_server(self, mock_novaclient):

View File

@ -65,7 +65,7 @@ class FakeNovaClient(object):
server = self.get(uuid)
setattr(server, 'OS-EXT-STS:vm_state', status)
def evacuate(self, uuid, host=None, on_shared_storage=False):
def evacuate(self, uuid, host=None):
if not host:
host = 'fake-host-1'
server = self.get(uuid)