]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Minor change
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 24 Oct 2018 12:58:59 +0000 (14:58 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 24 Oct 2018 12:58:59 +0000 (14:58 +0200)
lib/cr_vmware_tpl/handler.py

index a3c03380abf379a1b8c0a273d6202ed01cfef2da..0ed037d157497dfbe525b212a4bc22e6d36ca1cd 100644 (file)
@@ -42,7 +42,7 @@ from fb_tools.vsphere.server import VsphereServer
 
 from .config import CrTplConfiguration
 
-__version__ = '0.10.4'
+__version__ = '0.10.5'
 
 LOG = logging.getLogger(__name__)
 TZ = pytz.timezone('Europe/Berlin')
@@ -475,9 +475,19 @@ class CrTplHandler(BaseHandler):
             msg = "Did not found an usable datastore."
             raise ExpectedHandlerError(msg)
 
-        self.tpl_data_store = random.choice(usable_ds)
-        LOG.info("Using datastore {!r} for volume of temporary VM to create.".format(
-            self.tpl_data_store.name))
+        for st_type in ('SATA', 'SAS', 'SSD'):
+
+            ds_list = []
+            for ds in usable_ds:
+                if ds.storage_type == st_type:
+                    ds_list.append(ds)
+            if not len(ds_list):
+                continue
+
+            self.tpl_data_store = random.choice(ds_list)
+            LOG.info("Using datastore {!r} for volume of temporary VM to create.".format(
+                self.tpl_data_store.name))
+            break
 
     # -------------------------------------------------------------------------
     def create_vm(self):