     }
   )
 
+  forEach(diskSizesByDevice, (size) => limits.disk += size)
+
   xapiVifs = VIFs and map(VIFs, (vif) =>
     network = @getObject(vif.network)
 

  else unless user.permission is 'admin'
    throw new Unauthorized()

  xapi = @getXapi(template)
  xapiVm = yield xapi.createVm(template._xapiId, {
    installRepository: installation && installation.repository,
    nameDescription: name_description,

    }
  )

  xapi = @getXapi(template)

  diskSizesByDevice = {}

  forEach(xapi.getObject(template._xapiId).$VBDs, (vbd) =>
    if (
      vbd.type is 'Disk' and
      (vdi = vbd.$VDI)
    )
      diskSizesByDevice[vbd.device] = +vdi.virtual_size

    return
  )

  xapiExistingVdis = existingDisks and map(existingDisks, (vdi, device) =>
    sr = @getObject(vdi.$SR)

    if vdi.size?
      size = parseSize(vdi.size)
      diskSizesByDevice[device] = size

    objectIds.push(sr.id)

