mirror of https://github.com/apache/cloudstack.git
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:
parent
8c344cb567
commit
191d689912
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue