add localstorage label handling
[ta/config-manager.git] / cmdatahandlers / src / cmdatahandlers / hosts / config.py
index 6f3deb8..7547dbe 100644 (file)
@@ -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()
@@ -194,6 +197,11 @@ class Config(config.Config):
 
         return service_profiles[0]
 
+    def set_noderole(self):
+        hosts = self.get_hosts()
+        for host in hosts:
+            self.config[self.ROOT][host]['noderole'] = self.get_noderole(host)
+
     def set_nodeindex(self):
         hostsconf = self.confman.get_hosts_config_handler()
         install_host = utils.get_installation_host_name(hostsconf)
@@ -232,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