summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDinesh Bhor <dinesh.bhor@nttdata.com>2017-07-11 12:57:31 +0530
committerDinesh Bhor <dinesh.bhor@nttdata.com>2017-07-21 05:44:49 +0000
commit212d254da1d9c08379be4454bd63c909cb3b6d6a (patch)
tree7bb917d348e0413400942cd0270ea4dd2febb8e3
parentb26ba43f72d2125de0866da835a59c2532504652 (diff)
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
Notes
Notes (review): Code-Review+2: Tushar Patil <tushar.vitthal.patil@gmail.com> Code-Review+2: Rikimaru Honjo <honjo.rikimaru@po.ntt-tx.co.jp> Workflow+1: Rikimaru Honjo <honjo.rikimaru@po.ntt-tx.co.jp> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 25 Jul 2017 09:54:20 +0000 Reviewed-on: https://review.openstack.org/483313 Project: openstack/masakari Branch: refs/heads/master
-rw-r--r--README.rst8
-rw-r--r--masakari/compute/nova.py8
-rw-r--r--masakari/tests/unit/compute/test_nova.py2
-rw-r--r--masakari/tests/unit/fakes.py2
4 files changed, 13 insertions, 7 deletions
diff --git a/README.rst b/README.rst
index 36189d9..41fa741 100644
--- a/README.rst
+++ b/README.rst
@@ -11,6 +11,14 @@ provisioning process down, and nova-compute host failure.
11It also provides API service for manage and control the automated 11It also provides API service for manage and control the automated
12rescue mechanism. 12rescue mechanism.
13 13
14NOTE:
15Use masakari only if instance path is configured on shared storage system
16i.e, 'instances_path' config option of nova has a path of shared directory
17otherwise instance data will be lost after the evacuation of instance from
18failed host if,
19* instance is booted from image
20* flavor using ephemeral disks is used
21
14Original version of Masakari: https://github.com/ntt-sic/masakari 22Original version of Masakari: https://github.com/ntt-sic/masakari
15 23
16Tokyo Summit Session: https://www.youtube.com/watch?v=BmjNKceW_9A 24Tokyo Summit Session: https://www.youtube.com/watch?v=BmjNKceW_9A
diff --git a/masakari/compute/nova.py b/masakari/compute/nova.py
index 56a12c6..493b7de 100644
--- a/masakari/compute/nova.py
+++ b/masakari/compute/nova.py
@@ -39,7 +39,7 @@ CONF.import_group('keystone_authtoken', 'keystonemiddleware.auth_token')
39 39
40LOG = logging.getLogger(__name__) 40LOG = logging.getLogger(__name__)
41 41
42NOVA_API_VERSION = "2.9" 42NOVA_API_VERSION = "2.14"
43 43
44nova_extensions = [ext for ext in 44nova_extensions = [ext for ext in
45 nova_client.discover_extensions(NOVA_API_VERSION) 45 nova_client.discover_extensions(NOVA_API_VERSION)
@@ -163,15 +163,13 @@ class API(object):
163 return service.status == 'disabled' 163 return service.status == 'disabled'
164 164
165 @translate_nova_exception 165 @translate_nova_exception
166 def evacuate_instance(self, context, uuid, target=None, 166 def evacuate_instance(self, context, uuid, target=None):
167 on_shared_storage=True):
168 """Evacuate an instance from failed host to specified host.""" 167 """Evacuate an instance from failed host to specified host."""
169 msg = ('Call evacuate command for instance %(uuid)s on host ' 168 msg = ('Call evacuate command for instance %(uuid)s on host '
170 '%(target)s') 169 '%(target)s')
171 LOG.info(msg, {'uuid': uuid, 'target': target}) 170 LOG.info(msg, {'uuid': uuid, 'target': target})
172 nova = novaclient(context) 171 nova = novaclient(context)
173 nova.servers.evacuate(uuid, host=target, 172 nova.servers.evacuate(uuid, host=target)
174 on_shared_storage=on_shared_storage)
175 173
176 @translate_nova_exception 174 @translate_nova_exception
177 def reset_instance_state(self, context, uuid, status='error'): 175 def reset_instance_state(self, context, uuid, status='error'):
diff --git a/masakari/tests/unit/compute/test_nova.py b/masakari/tests/unit/compute/test_nova.py
index 0c9f95b..3efa5be 100644
--- a/masakari/tests/unit/compute/test_nova.py
+++ b/masakari/tests/unit/compute/test_nova.py
@@ -217,7 +217,7 @@ class NovaApiTestCase(test.TestCase):
217 217
218 mock_novaclient.assert_called_once_with(self.ctx) 218 mock_novaclient.assert_called_once_with(self.ctx)
219 mock_servers.evacuate.assert_called_once_with( 219 mock_servers.evacuate.assert_called_once_with(
220 uuidsentinel.fake_server, host=None, on_shared_storage=True) 220 uuidsentinel.fake_server, host=None)
221 221
222 @mock.patch('masakari.compute.nova.novaclient') 222 @mock.patch('masakari.compute.nova.novaclient')
223 def test_stop_server(self, mock_novaclient): 223 def test_stop_server(self, mock_novaclient):
diff --git a/masakari/tests/unit/fakes.py b/masakari/tests/unit/fakes.py
index 9badced..4cc7897 100644
--- a/masakari/tests/unit/fakes.py
+++ b/masakari/tests/unit/fakes.py
@@ -65,7 +65,7 @@ class FakeNovaClient(object):
65 server = self.get(uuid) 65 server = self.get(uuid)
66 setattr(server, 'OS-EXT-STS:vm_state', status) 66 setattr(server, 'OS-EXT-STS:vm_state', status)
67 67
68 def evacuate(self, uuid, host=None, on_shared_storage=False): 68 def evacuate(self, uuid, host=None):
69 if not host: 69 if not host:
70 host = 'fake-host-1' 70 host = 'fake-host-1'
71 server = self.get(uuid) 71 server = self.get(uuid)