]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Continue refactoring lib/cr_vmware_tpl/handler.py for using datastore clusters.
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 25 Aug 2020 16:05:30 +0000 (18:05 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 25 Aug 2020 16:05:30 +0000 (18:05 +0200)
lib/cr_vmware_tpl/handler.py

index 5997cdb2ad8d702a8705ec517ca72341f2204829..3f64c055902335a5a331acb4fa12698863f7d438 100644 (file)
@@ -408,6 +408,36 @@ class CrTplHandler(BaseHandler):
             ds_to_use.name))
         return
 
+    # -------------------------------------------------------------------------
+    def select_data_store_from_cluster(self):
+
+        ###################################
+        # TODO
+        ###################################
+        # Continue here ...
+
+        podsel = vim.storageDrs.PodSelectionSpec()
+        pod = get_obj(content, [vim.StoragePod], datastorecluster_name)
+        podsel.storagePod = pod
+
+        storagespec = vim.storageDrs.StoragePlacementSpec()
+        storagespec.podSelectionSpec = podsel
+        storagespec.type = 'create'
+        storagespec.folder = destfolder
+        storagespec.resourcePool = resource_pool
+        storagespec.configSpec = vmconf
+
+        try:
+            rec = content.storageResourceManager.RecommendDatastores(
+                storageSpec=storagespec)
+            rec_action = rec.recommendations[0].action[0]
+            real_datastore_name = rec_action.destination.name
+        except:
+            real_datastore_name = template.datastore[0].info.name
+
+        datastore = get_obj(content, [vim.Datastore], real_datastore_name)
+
+
     # -------------------------------------------------------------------------
     def select_simple_data_store(self):