From 264e394db05beb89cc295caf9a6e9876f31a5faa Mon Sep 17 00:00:00 2001 From: Belmiro Moreira Date: Fri, 20 May 2016 23:14:03 +0200 Subject: [PATCH] No disable reason defined for new services Services can be disabled by several reasons and admins can use the API to specify a reason. However, currently if new services are added and "enable_new_services=False" there is no disable reason specified. Having services disabled with no reason specified creates additional checks on the operators side that increases with the deployment size. This patch specifies the disable reason: "New service disabled due to config option" when a new service is added and "enable_new_services=False". Closes-Bug: #1417027 Change-Id: I52dd763cf1b58ba3ff56fe97f37eca18c915681d --- nova/db/sqlalchemy/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 416fad8b1..5b7962b73 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -533,7 +533,9 @@ def service_create(context, values): service_ref = models.Service() service_ref.update(values) if not CONF.enable_new_services: + msg = _("New service disabled due to config option.") service_ref.disabled = True + service_ref.disabled_reason = msg try: service_ref.save(context.session) except db_exc.DBDuplicateEntry as e: