diff options
author | Dinesh Bhor <dinesh.bhor@nttdata.com> | 2017-07-11 12:57:31 +0530 |
---|---|---|
committer | Dinesh Bhor <dinesh.bhor@nttdata.com> | 2017-07-21 05:44:49 +0000 |
commit | 212d254da1d9c08379be4454bd63c909cb3b6d6a (patch) | |
tree | 7bb917d348e0413400942cd0270ea4dd2febb8e3 | |
parent | b26ba43f72d2125de0866da835a59c2532504652 (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.rst | 8 | ||||
-rw-r--r-- | masakari/compute/nova.py | 8 | ||||
-rw-r--r-- | masakari/tests/unit/compute/test_nova.py | 2 | ||||
-rw-r--r-- | masakari/tests/unit/fakes.py | 2 |
4 files changed, 13 insertions, 7 deletions
@@ -11,6 +11,14 @@ provisioning process down, and nova-compute host failure. | |||
11 | It also provides API service for manage and control the automated | 11 | It also provides API service for manage and control the automated |
12 | rescue mechanism. | 12 | rescue mechanism. |
13 | 13 | ||
14 | NOTE: | ||
15 | Use masakari only if instance path is configured on shared storage system | ||
16 | i.e, 'instances_path' config option of nova has a path of shared directory | ||
17 | otherwise instance data will be lost after the evacuation of instance from | ||
18 | failed host if, | ||
19 | * instance is booted from image | ||
20 | * flavor using ephemeral disks is used | ||
21 | |||
14 | Original version of Masakari: https://github.com/ntt-sic/masakari | 22 | Original version of Masakari: https://github.com/ntt-sic/masakari |
15 | 23 | ||
16 | Tokyo Summit Session: https://www.youtube.com/watch?v=BmjNKceW_9A | 24 | Tokyo 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 | ||
40 | LOG = logging.getLogger(__name__) | 40 | LOG = logging.getLogger(__name__) |
41 | 41 | ||
42 | NOVA_API_VERSION = "2.9" | 42 | NOVA_API_VERSION = "2.14" |
43 | 43 | ||
44 | nova_extensions = [ext for ext in | 44 | nova_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) |