From: Balint Tobik Date: Tue, 3 Dec 2019 15:55:12 +0000 (+0100) Subject: add localstorage label handling X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=ta%2Fconfig-manager.git;a=commitdiff_plain;h=87d5aa1e6151010af819612a0a953ee90431607e add localstorage label handling Signed-off-by: Balint Tobik Change-Id: I61dfedb8bea91cb072dd50217b3f3b844c6b0c2f --- diff --git a/cmdatahandlers/src/cmdatahandlers/hosts/config.py b/cmdatahandlers/src/cmdatahandlers/hosts/config.py index df31dc1..7547dbe 100644 --- a/cmdatahandlers/src/cmdatahandlers/hosts/config.py +++ b/cmdatahandlers/src/cmdatahandlers/hosts/config.py @@ -178,6 +178,9 @@ class Config(config.Config): if self.is_sriov_enabled(hostname): labels.update({"sriov": "enabled"}) + if self.is_localstorage_used(hostname): + labels.update({"localstorage": "enabled"}) + black_list = ['name'] return {name: attributes for name, attributes in labels.iteritems() @@ -237,6 +240,16 @@ class Config(config.Config): return True return False + def is_localstorage_used(self, hostname): + storageprofs = self.get_storage_profiles(hostname) + storageprofconf = self.confman.get_storage_profiles_config_handler() + for profile in storageprofs: + if "shared" in self.config[storageprofconf.ROOT][profile]: + for volume in self.config[storageprofconf.ROOT][profile]["shared"]["volumes"]: + if volume["name"] == 'caas_app': + return True + return False + def get_enabled_hosts(self): """ get the list of enabled hosts in the cloud