Browse Source

Merge "Clear out service disabled reason on enable"

Jenkins 5 years ago
parent
commit
77a66a248b

+ 4
- 1
nova/api/openstack/compute/contrib/services.py View File

@@ -166,7 +166,10 @@ class ServiceController(object):
166 166
                     'status': status,
167 167
                 },
168 168
             }
169
-            status_detail = {'disabled': disabled}
169
+            status_detail = {
170
+                'disabled': disabled,
171
+                'disabled_reason': None,
172
+            }
170 173
             if id == "disable-log-reason":
171 174
                 reason = body['disabled_reason']
172 175
                 if not self._is_valid_as_reason(reason):

+ 6
- 1
nova/tests/api/openstack/compute/contrib/test_services.py View File

@@ -320,10 +320,15 @@ class ServicesTest(test.TestCase):
320 320
         self.assertEqual(res_dict, response)
321 321
 
322 322
     def test_services_enable(self):
323
+        def _service_update(context, service_id, values):
324
+            self.assertEqual(values['disabled_reason'], None)
325
+
326
+        self.stubs.Set(db, "service_update", _service_update)
327
+
323 328
         body = {'host': 'host1', 'binary': 'nova-compute'}
324 329
         req = fakes.HTTPRequest.blank('/v2/fake/os-services/enable')
325
-        res_dict = self.controller.update(req, "enable", body)
326 330
 
331
+        res_dict = self.controller.update(req, "enable", body)
327 332
         self.assertEqual(res_dict['service']['status'], 'enabled')
328 333
         self.assertFalse('disabled_reason' in res_dict['service'])
329 334
 

Loading…
Cancel
Save