mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 6309: Added event VM.UPDATE along with changed fields
status 6309: resolved fixed
This commit is contained in:
parent
19dcbb8d8e
commit
f70071dc98
@ -25,8 +25,7 @@ public class EventTypes {
|
||||
public static final String EVENT_VM_START = "VM.START";
|
||||
public static final String EVENT_VM_STOP = "VM.STOP";
|
||||
public static final String EVENT_VM_REBOOT = "VM.REBOOT";
|
||||
public static final String EVENT_VM_DISABLE_HA = "VM.DISABLEHA";
|
||||
public static final String EVENT_VM_ENABLE_HA = "VM.ENABLEHA";
|
||||
public static final String EVENT_VM_UPDATE = "VM.UPDATE";
|
||||
public static final String EVENT_VM_UPGRADE = "VM.UPGRADE";
|
||||
public static final String EVENT_VM_RESETPASSWORD = "VM.RESETPASSWORD";
|
||||
|
||||
|
||||
@ -3125,7 +3125,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualM
|
||||
}
|
||||
|
||||
userId = accountAndUserValidation(id, account, userId,vmInstance);
|
||||
|
||||
|
||||
if (displayName == null) {
|
||||
displayName = vmInstance.getDisplayName();
|
||||
}
|
||||
@ -3140,25 +3140,31 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, VirtualM
|
||||
throw new CloudRuntimeException("Unable to find virual machine with id " + id);
|
||||
}
|
||||
|
||||
if (group != null) {
|
||||
addInstanceToGroup(id, group);
|
||||
String description = "";
|
||||
|
||||
if(displayName != vmInstance.getDisplayName()){
|
||||
description += "New display name: "+displayName+". ";
|
||||
}
|
||||
|
||||
if(ha != vmInstance.isHaEnabled()){
|
||||
if(ha){
|
||||
description += "Enabled HA. ";
|
||||
} else {
|
||||
description += "Disabled HA. ";
|
||||
}
|
||||
}
|
||||
|
||||
boolean haEnabled = vm.isHaEnabled();
|
||||
_vmDao.updateVM(id, displayName, ha);
|
||||
if (haEnabled != ha) {
|
||||
String description = null;
|
||||
String type = null;
|
||||
if (ha) {
|
||||
description = "Successfully enabled HA for virtual machine " + vm.getHostName();
|
||||
type = EventTypes.EVENT_VM_ENABLE_HA;
|
||||
} else {
|
||||
description = "Successfully disabled HA for virtual machine " + vm.getHostName();
|
||||
type = EventTypes.EVENT_VM_DISABLE_HA;
|
||||
|
||||
if (group != null) {
|
||||
if(addInstanceToGroup(id, group)){
|
||||
description += "Added to group: "+group+".";
|
||||
}
|
||||
// create a event for the change in HA Enabled flag
|
||||
EventUtils.saveEvent(userId, accountId, EventVO.LEVEL_INFO, type, description, null);
|
||||
}
|
||||
|
||||
_vmDao.updateVM(id, displayName, ha);
|
||||
|
||||
// create a event for the change in HA Enabled flag
|
||||
EventUtils.saveEvent(userId, accountId, EventVO.LEVEL_INFO, EventTypes.EVENT_VM_UPDATE, "Successfully updated virtual machine: "+vm.getHostName()+". "+description, null);
|
||||
return _vmDao.findById(id);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user