<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Gary,</p>
    <p>I hope you are doing well. I was trying to understand the logic
      in this code when using datastore_regex. It seems even if  you set
      that parameter and it matches some N datastores, the "free
      capacity " being returned by nova-compute is only from a
      single/best datastore.</p>
    <p>def get_available_datastores(session, cluster=None,
      datastore_regex=None):<br>
          """Get the datastore list and choose the first local
      storage."""<br>
          ds = session._call_method(vutil,<br>
                                    "get_object_property",<br>
                                    cluster,<br>
                                    "datastore")</p>
    <p>...<br>
      ...<br>
    </p>
    <p>        if _is_datastore_valid(propdict, datastore_regex,
      allowed_ds_types):<br>
                  new_ds = ds_obj.Datastore(<br>
                          ref=obj_content.obj,<br>
                          name=propdict['summary.name'],<br>
                          capacity=propdict['summary.capacity'],<br>
                          freespace=propdict['summary.freeSpace'])<br>
                  # favor datastores with more free space<br>
                  if (best_match is None or<br>
                      new_ds.freespace > best_match.freespace):<br>
                      best_match = new_ds<br>
      <br>
          return best_match</p>
    <p>The issue we are seeing is a customer has for example 5 x 10 GB
      data stores (DS1,..DS5.)  For whatever reason , DS1 was filled
      more fully and once it hit close to 100% no new instances could
      launch as the were blocked by the Nova DiskFilter. I know we can
      use the disk_allocation to "fool" this but why is not using to
      total cumulative storage as opposed to the one with most free or
      first one. I am wondering if there is some configuration issue. If
      it is supposed to use best_match, should that dynamically change
      among the matched regex Datastore to the one with most free space?
      Could it be it is somehow skipping the "best_match" and always
      using " first local storage"</p>
    <p>I appreciate any suggestions or comments you have.</p>
    <p>Keith<br>
    </p>
    <div class="moz-signature">-- <br>
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <title></title>
      <p class="MsoNormal"><span
style="font-size:9.0pt;font-family:"Arial",sans-serif;background:white">Keith
          Berger</span></p>
      <p class="MsoNormal"><span
style="font-size:9.0pt;font-family:"Arial",sans-serif;background:white">Master
          Software Engineer</span><span
          style="font-size:9.0pt;font-family:"Arial",sans-serif"><br>
          <span style="background:white">SUSE</span></span></p>
      <span
style="font-size:9.0pt;font-family:"Arial",sans-serif;background:white">(P)+1
        470.237.2012<br>
        (M)+1 404.664.9610<br>
        <a class="moz-txt-link-abbreviated" href="mailto:keith.berger@suse.com">keith.berger@suse.com</a></span>
      <p><img src="cid:part1.47720283.B515954A@suse.com" alt=""></p>
    </div>
  </body>
</html>