import sys
import os
import logging
+import re
# Third party modules
import six
self.mac_address = self.default_mac_address
self.max_wait_for_finish_install = self.default_max_wait_for_finish_install
+ self.excluded_datastores = []
+
self.encoding = 'utf-8'
super(CrTplConfiguration, self).__init__(
def eval_config(self, config):
"""Evaluating of all found configuration options."""
+ re_excl_ds = re.compile(r'^\s*excluded?[-_]datastores?\s*$', re_IGNORECASE)
+ re_split_ds = re.compile(r'[,;\s]+')
+
for section in config.sections():
if self.verbose > 2:
if key.lower() == 'dc':
self.dc = value
+ if re_excl_ds.search(key):
+ datastores = re_split_ds.split(value.strip())
+ self.excluded_datastores = datastores
+
continue
if section.lower() == 'template':
if self.verbose > 2:
LOG.debug("Datastore {!r} seems to be local.".format(child.summary.name))
return
+ if child.summary.name in self.config.excluded_datastores:
+ LOG.debug("Datastore {!r} is excluded.".format(child.summary.name))
+ return
free_bytes = child.summary.freeSpace
free_gbytes = float(free_bytes) / 1024.0 / 1024.0 / 1024.0
if free_bytes >= self.config.data_size: