]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Extendig configuration for storage cluster
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 25 Aug 2020 15:33:19 +0000 (17:33 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 25 Aug 2020 15:33:19 +0000 (17:33 +0200)
etc/create-vmware-template.ini.default
lib/cr_vmware_tpl/config.py

index 9237131def435e25f72562ca30ba6eee413c6319..05aa5c3bf7825ef7dcb9536a094c5603e6005ea0 100644 (file)
@@ -14,6 +14,8 @@
 
 ;folder = templates
 
+;storage_cluster = ds-cluster-hdd-vmcc-l105-01
+
 [Template]
 
 ;vm_id = centos8
 
 ;mac_address = 00:16:3e:54:ab:2b
 
-;storage_cluster =
-
-;storage_cluster_prod = 'ds-cluster-hdd-vmcc-l105-01'
-
-;storage_cluster_test = 'Daten-Cluster-Gold_01'
-
 [Timeouts]
 
 ; General timeout in seconds for create_vm, poweron_vm and shutdown_vm
index db34fe28c490d02fe18fab8b0b04c3b51c7ace74..754ba24b3e68af81b8ded596dee0d850e1dcc88e 100644 (file)
@@ -22,7 +22,7 @@ from fb_tools.config import ConfigError, BaseConfiguration
 
 from .xlate import XLATOR
 
-__version__ = '1.5.8'
+__version__ = '1.6.0'
 LOG = logging.getLogger(__name__)
 
 _ = XLATOR.gettext
@@ -54,6 +54,7 @@ class CrTplConfiguration(BaseConfiguration):
     default_folder = 'templates'
     default_template_name = default_os_id + '-template'
     default_data_size_gb = 32.0
+    default_storage_cluster = 'ds-cluster-hdd-vmcc-l105-01'
     default_num_cpus = 2
     default_ram_mb = 4 * 1024
     default_network = '192.168.88.0_23'
@@ -140,6 +141,8 @@ class CrTplConfiguration(BaseConfiguration):
         self.vmware_cfg_version = self.default_vmware_cfg_version
         self.os_version = self.default_os_version
 
+        self.storage_cluster = self.default_storage_cluster
+
         self.tpl_vm_domain = self.default_tpl_vm_domain
 
         self.cobbler_profile_given = False
@@ -313,6 +316,7 @@ class CrTplConfiguration(BaseConfiguration):
 
         re_excl_ds = re.compile(r'^\s*excluded?[-_]datastores?\s*$', re.IGNORECASE)
         re_split_ds = re.compile(r'[,;\s]+')
+        re_storage_cluster = re.compile(r'^\s*storage[-_]?cluster\s*$', re.IGNORECASE)
 
         for (key, value) in config.items(section_name):
 
@@ -355,6 +359,9 @@ class CrTplConfiguration(BaseConfiguration):
                 datastores = re_split_ds.split(value.strip())
                 self.excluded_datastores = datastores
 
+            elif re_storage_cluster.search(key) and value.strip():
+                self.storage_cluster = value.strip()
+
         return
 
     # -------------------------------------------------------------------------