def vm_diskstats(vm_=None):
 with _get_xapi_session() as xapi:
  def _info(vm_):
   ret = {}
   vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
   if (vm_uuid is False):
    return False
   for vbd in xapi.VM.get_VBDs(vm_uuid):
    vbd_rec = _get_record(xapi, 'VBD', vbd)
    ret[vbd_rec['device']] = _get_metrics_record(xapi, 'VBD', vbd_rec)
    del ret[vbd_rec['device']]['last_updated']
   return ret
  info = {}
  if vm_:
   info[vm_] = _info(vm_)
  else:
   for vm_ in list_domains():
    info[vm_] = _info(vm_)
  return info

def vm_diskstats ( vm_ = None ) : with _get_xapi_session ( ) as xapi : def _info ( vm_ ) : ret = { } vm_uuid = _get_label_uuid ( xapi , 'VM' , vm_ ) if ( vm_uuid is False ) : return False for vbd in xapi . VM . get_VBDs ( vm_uuid ) : vbd_rec = _get_record ( xapi , 'VBD' , vbd ) ret [ vbd_rec [ 'device' ] ] = _get_metrics_record ( xapi , 'VBD' , vbd_rec ) del ret [ vbd_rec [ 'device' ] ] [ 'last_updated' ] return ret info = { } if vm_ : info [ vm_ ] = _info ( vm_ ) else : for vm_ in list_domains ( ) : info [ vm_ ] = _info ( vm_ ) return info
return disk usage counters used by the vms on this hyper in a list of dicts: .