def get_instance_vdis_for_sr(session, vm_ref, sr_ref):
 for vbd_ref in session.call_xenapi('VM.get_VBDs', vm_ref):
  try:
   vdi_ref = session.call_xenapi('VBD.get_VDI', vbd_ref)
   if (sr_ref == session.call_xenapi('VDI.get_SR', vdi_ref)):
    (yield vdi_ref)
  except session.XenAPI.Failure:
   continue

def get_instance_vdis_for_sr ( session , vm_ref , sr_ref ) : for vbd_ref in session . call_xenapi ( 'VM.get_VBDs' , vm_ref ) : try : vdi_ref = session . call_xenapi ( 'VBD.get_VDI' , vbd_ref ) if ( sr_ref == session . call_xenapi ( 'VDI.get_SR' , vdi_ref ) ) : ( yield vdi_ref ) except session . XenAPI . Failure : continue
return opaqueref for all the vdis which live on sr .