 
 #---------------------------------------------------------------------
 
-clone = ({vm, name, full_copy}) ->
+clone = $coroutine ({vm, name, full_copy}) ->
+  yield checkPermissionOnSrs.call(this, vm)
+
   return @getXAPI(vm).cloneVm(vm._xapiRef, {
     nameLabel: name,
     fast: not full_copy


#=====================================================================

checkPermissionsForSnapshot = (vm) -> (
  permissions = []
  forEach(vm.$VBDs, (vbdId) =>
    vbd = @getObject(vbdId, 'VBD')

# TODO: integrate in xapi.js
export_ = $coroutine ({vm, compress, onlyMetadata}) ->
  if vm.power_state is 'Running'
    yield checkPermissionOnSrs.call(this, vm)

  stream = yield @getXAPI(vm).exportVm(vm._xapiId, {
    compress: compress ? true,
