From 683d2eef3d55031e10500870f05ffe969b0d795e Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 24 Oct 2018 14:58:59 +0200 Subject: [PATCH] Minor change --- lib/cr_vmware_tpl/handler.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/cr_vmware_tpl/handler.py b/lib/cr_vmware_tpl/handler.py index a3c0338..0ed037d 100644 --- a/lib/cr_vmware_tpl/handler.py +++ b/lib/cr_vmware_tpl/handler.py @@ -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): -- 2.39.5