diff --git a/api/src/com/cloud/api/commands/MigrateVMCmd.java b/api/src/com/cloud/api/commands/MigrateVMCmd.java index c3a5cd4b415..df3d3a8cb1f 100644 --- a/api/src/com/cloud/api/commands/MigrateVMCmd.java +++ b/api/src/com/cloud/api/commands/MigrateVMCmd.java @@ -34,6 +34,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.exception.VirtualMachineMigrationException; import com.cloud.host.Host; import com.cloud.user.Account; +import com.cloud.user.UserContext; import com.cloud.uservm.UserVm; @Implementation(description="Attempts Migration of a virtual machine to the host specified.", responseObject=UserVmResponse.class) @@ -92,7 +93,7 @@ public class MigrateVMCmd extends BaseAsyncCmd { @Override public String getEventDescription() { - return "Attempting to migrate VM: " + getVirtualMachineId() + " to host: "+ getHostId(); + return "Attempting to migrate VM Id: " + getVirtualMachineId() + " to host Id: "+ getHostId(); } @Override @@ -107,6 +108,7 @@ public class MigrateVMCmd extends BaseAsyncCmd { throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id=" + getHostId()); } try{ + UserContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to host Id: "+ getHostId()); UserVm migratedVm = _userVmService.migrateVirtualMachine(userVm, destinationHost); if (migratedVm != null) { UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", migratedVm).get(0); diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index b2285ebcfe2..7f9e098e02f 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -2910,7 +2910,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager return _vmDao.findById(vmId); } - @Override + @Override @ActionEvent (eventType=EventTypes.EVENT_VM_MIGRATE, eventDescription="migrating VM", async=true) public UserVm migrateVirtualMachine(UserVm vm, Host destinationHost) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException{ //access check - only root admin can migrate VM Account caller = UserContext.current().getCaller();