diff options
author | Ramesh Nachimuthu <rnachimu@redhat.com> | 2014-05-13 13:59:37 +0530 |
---|---|---|
committer | Sahina Bose <sabose@redhat.com> | 2014-05-23 01:39:19 -0700 |
commit | 7f05b72eb56f2f012c426c988ec426740c5d1e1a (patch) | |
tree | cbbce9fed788804e7c4dbe39dd8fd00b7e3aaee5 | |
parent | 2a33c90c72959a8ed0889effb6ef99190c4d2e0d (diff) |
autoconfig: delete only auto generated configs in auto-config
Currently auto-config removes all the custom services and hosts
defined by user. So with this issue, user can't add any extra
services on top of services generated by auto-config.
Adding a custom filed '__GENERATED_BY_AUTOCONFIG' as part of
all the services added by auto-config. Only services with the
above custom field will be deleted by auto-config when
respective volume/brick/ is removed in gluster.
Change-Id: I85d3d971d3b99f52ff603044f7f974746e247737
Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
Reviewed-on: http://review.gluster.org/7750
Reviewed-by: Sahina Bose <sabose@redhat.com>
-rw-r--r-- | plugins/config_generator.py | 2 | ||||
-rwxr-xr-x | plugins/discovery.py | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/plugins/config_generator.py b/plugins/config_generator.py index ed32912..8466c83 100644 --- a/plugins/config_generator.py +++ b/plugins/config_generator.py @@ -33,6 +33,7 @@ are added or removed to the entity. CHANGE_MODE_ADD = "ADD" CHANGE_MODE_REMOVE = "REMOVE" CHANGE_MODE_UPDATE = "UPDATE" +GENERATED_BY_AUTOCONFIG = "__GENERATED_BY_AUTOCONFIG" class GlusterNagiosConfManager: @@ -287,6 +288,7 @@ class GlusterNagiosConfManager: serviceModel = Model.Service() serviceModel = self.fillModel(serviceModel, service) serviceModel.set_filename(self.getCfgFileName(hostname)) + serviceModel[GENERATED_BY_AUTOCONFIG] = 1 serviceModel.save() elif service['changeMode'] == CHANGE_MODE_REMOVE: serviceModel = Model.Service.objects.filter( diff --git a/plugins/discovery.py b/plugins/discovery.py index 78f666e..5f29225 100755 --- a/plugins/discovery.py +++ b/plugins/discovery.py @@ -33,6 +33,7 @@ from constants import DEFAULT_AUTO_CONFIG_DIR from config_generator import CHANGE_MODE_ADD from config_generator import CHANGE_MODE_REMOVE from config_generator import CHANGE_MODE_UPDATE +from config_generator import GENERATED_BY_AUTOCONFIG #Discovers volumes info one by one. @@ -162,6 +163,9 @@ def findDeletedServices(host): deletedService = [] serviceConfigs = server_utils.getServiceConfigByHost(host['host_name']) for serviceConfig in serviceConfigs: + #Consider only the service generated by autoconfig + if not serviceConfig[GENERATED_BY_AUTOCONFIG]: + continue service = findServiceInList(host.get('host_services', []), serviceConfig['service_description']) if service is None: |