From: Frank Brehm Date: Wed, 24 Oct 2018 12:58:59 +0000 (+0200) Subject: Minor change X-Git-Tag: 0.3.2^2~29 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=683d2eef3d55031e10500870f05ffe969b0d795e;p=pixelpark%2Fcreate-vmware-tpl.git Minor change --- 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):