     }
   )
 
-  xapiExistingVdis = existingDisks and map(existingDisks, (vdi) =>
+  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)
 
-    # FIXME: handle existing VDIs when not resized.
-    if vdi.size
+    if vdi.size?
       size = parseSize(vdi.size)
-      limits.disk += size
+      diskSizesByDevice[device] = size
 
     objectIds.push(sr.id)
 

  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,


  if resourceSet
    @addAcl(user.id, vm.id, 'admin').catch(noop)
    yield xapi.xo.setData(xapiVm.$id, 'resourceSet', resourceSet).catch(noop)

  return vm.id

