From: Frank Brehm Date: Tue, 25 Aug 2020 16:05:30 +0000 (+0200) Subject: Continue refactoring lib/cr_vmware_tpl/handler.py for using datastore clusters. X-Git-Tag: 2.2.1~1^2~1^2~7^2~3 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=6e84b38615d502e3bd422339522a5c801be795ff;p=pixelpark%2Fcreate-vmware-tpl.git Continue refactoring lib/cr_vmware_tpl/handler.py for using datastore clusters. --- diff --git a/lib/cr_vmware_tpl/handler.py b/lib/cr_vmware_tpl/handler.py index 5997cdb..3f64c05 100644 --- a/lib/cr_vmware_tpl/handler.py +++ b/lib/cr_vmware_tpl/handler.py @@ -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):