]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Bugfixing and changes in debug output
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 26 Aug 2020 11:12:44 +0000 (13:12 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 26 Aug 2020 11:12:44 +0000 (13:12 +0200)
lib/cr_vmware_tpl/handler.py

index cd1bbf16627d9217d3410a8fcd2aa2723f4ad10c..ecc1fcec46e3247b4f899cdf64732e4684a1be9e 100644 (file)
@@ -44,7 +44,7 @@ from .cobbler import Cobbler
 
 from .xlate import XLATOR
 
-__version__ = '1.8.2'
+__version__ = '1.8.3'
 
 LOG = logging.getLogger(__name__)
 TZ = pytz.timezone('Europe/Berlin')
@@ -397,9 +397,15 @@ class CrTplHandler(BaseHandler):
         ds_to_use = None
         if self.config.storage_cluster:
             ds_to_use = self.select_data_store_from_cluster()
-            msg = MSG_NO_CLUSTER.format(
-                size=self.config.data_size_gb, c_name=self.config.storage_cluster)
-            LOG.warn(msg)
+            if ds_to_use:
+                msg = _(
+                    "Got datastore {n!r} as a member of datastore cluster {c!r}.").format(
+                    n=ds_to_use.name, c=self.config.storage_cluster)
+                LOG.info(msg)
+            else:
+                msg = MSG_NO_CLUSTER.format(
+                    size=self.config.data_size_gb, c_name=self.config.storage_cluster)
+                LOG.warn(msg)
         if not ds_to_use:
             ds_to_use = self.select_simple_data_store()
 
@@ -444,16 +450,21 @@ class CrTplHandler(BaseHandler):
         podsel = vim.storageDrs.PodSelectionSpec()
         podsel.storagePod = pod
 
+        folder_obj = self.vsphere.get_vm_folder(self.config.folder)
+
         storagespec = vim.storageDrs.StoragePlacementSpec()
         storagespec.podSelectionSpec = podsel
         storagespec.type = 'create'
-        storagespec.folder = self.config.folder
+        storagespec.folder = folder_obj
         storagespec.resourcePool = self.cluster.resource_pool
         storagespec.configSpec = vmconf
 
         LOG.debug(_(
             "Trying to get a recommendation for a datastore from "
             "VSphere storageResourceManager ..."))
+        if self.verbose > 2:
+            msg = "storagespec:\n" + pp(storagespec)
+            LOG.debug(msg)
         content = self.vsphere.service_instance.RetrieveContent()
         try:
             rec = content.storageResourceManager.RecommendDatastores(storageSpec=storagespec)
@@ -475,7 +486,7 @@ class CrTplHandler(BaseHandler):
     def _get_storage_pod_obj(self, used_c_name):
 
         content = self.vsphere.service_instance.RetrieveContent()
-        dc = self.config.get_obj(content, [vim.Datacenter], self.config.dc)
+        dc = self.vsphere.get_obj(content, [vim.Datacenter], self.config.dc)
         if not dc:
             raise VSphereDatacenterNotFoundError(self.config.dc)