 
     $scope.hosts = xoApi.getView('hosts')
 
+    srsByContainer = xoApi.getIndex('srsByContainer')
+
     $scope.$watch(
       -> get $stateParams.id, 'VM'
       (VM) ->

          message: err
        }

    $scope.deleteDisk = (UUID) ->
      modal.confirm({
        title: 'Disk deletion'
        message: 'Are you sure you want to delete this disk? This operation is irreversible'
      }).then ->
        xoApi.call 'vdi.delete', {id: UUID}
        return
      return



        $scope.networks = get pool.networks

        # Computes the list of srs.
        SRs = $scope.SRs = []
        forEach(srsByContainer[host.id], (template) =>
          SRs.push(template)
          return
        )
        forEach(srsByContainer[pool.id], (template) =>
          SRs.push(template)
          return
        )
        # compute writable accessible SR from this VM
        $scope.writable_SRs = (SR for SR in SRs when SR.content_type isnt 'iso')

