From 6e84b38615d502e3bd422339522a5c801be795ff Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 25 Aug 2020 18:05:30 +0200 Subject: [PATCH] Continue refactoring lib/cr_vmware_tpl/handler.py for using datastore clusters. --- lib/cr_vmware_tpl/handler.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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): -- 2.39.5