Bug 9045: No 'Starting job for VM.MIGRATE' & 'Successfully completed VM.MIGRATE' events shown for VM manual migration

Changes:
- Added the required 'ActionEvent' annotation to the API, so that the events get added.
This commit is contained in:
prachi 2011-04-05 16:26:04 -07:00
parent 8c344cb567
commit 191d689912
2 changed files with 4 additions and 2 deletions

View File

@ -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);

View File

@ -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();