From b28eccba628b084cbc8701f9f914f6f53be28be0 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Tue, 28 May 2024 18:37:51 +1000 Subject: [PATCH 01/13] Fix grammar, spelling, word casing, whitespace --- .../internallb/StartInternalLBVMCmd.java | 2 +- .../admin/internallb/StopInternalLBVMCmd.java | 2 +- .../admin/systemvm/DestroySystemVmCmd.java | 2 +- .../admin/systemvm/RebootSystemVmCmd.java | 2 +- .../admin/systemvm/ScaleSystemVMCmd.java | 2 +- .../admin/systemvm/StartSystemVMCmd.java | 2 +- .../admin/systemvm/StopSystemVmCmd.java | 2 +- .../admin/systemvm/UpgradeSystemVMCmd.java | 2 +- .../api/command/admin/vm/ExpungeVMCmd.java | 2 +- .../api/command/user/iso/AttachIsoCmd.java | 2 +- .../api/command/user/vm/AddNicToVMCmd.java | 2 +- .../api/command/user/vm/DeployVMCmd.java | 6 +- .../api/command/user/vm/DestroyVMCmd.java | 2 +- .../api/command/user/vm/RebootVMCmd.java | 2 +- .../command/user/vm/RemoveNicFromVMCmd.java | 2 +- .../command/user/vm/ResetVMPasswordCmd.java | 2 +- .../api/command/user/vm/ResetVMSSHKeyCmd.java | 2 +- .../command/user/vm/ResetVMUserDataCmd.java | 2 +- .../api/command/user/vm/RestoreVMCmd.java | 2 +- .../api/command/user/vm/StartVMCmd.java | 2 +- .../api/command/user/vm/StopVMCmd.java | 2 +- .../user/vm/UpdateDefaultNicForVMCmd.java | 2 +- .../api/command/user/vm/UpdateVMCmd.java | 2 +- .../api/command/user/vm/UpgradeVMCmd.java | 2 +- .../orchestration/VolumeOrchestrator.java | 4 +- .../main/java/com/cloud/utils/db/EcInfo.java | 2 +- .../management/ServiceManagerImpl.java | 2 +- .../api/commands/StopNetScalerVMCmd.java | 2 +- .../network/element/SspElementTest.java | 8 +- .../com/cloud/network/NetworkServiceImpl.java | 2 +- .../network/as/AutoScaleManagerImpl.java | 2 +- .../cloud/template/TemplateManagerImpl.java | 2 +- .../java/com/cloud/vm/UserVmManagerImpl.java | 594 +++++++++--------- .../java/com/cloud/vm/UserVmManagerTest.java | 4 +- systemvm/debian/opt/cloud/bin/setup/common.sh | 6 +- .../maint/test_host_high_availability.py | 40 +- .../component/test_netscaler_lb.py | 72 +-- tools/git/git-pr | 2 +- 38 files changed, 397 insertions(+), 397 deletions(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java index 3dd7d2adf378..53ae0aed1149 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java @@ -103,7 +103,7 @@ public Long getApiResourceId() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { - CallContext.current().setEventDetails("Internal Lb Vm Id: " + getId()); + CallContext.current().setEventDetails("Internal Lb VM Id: " + getId()); VirtualRouter result = null; VirtualRouter router = _routerService.findRouter(getId()); if (router == null || router.getRole() != Role.INTERNAL_LB_VM) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java index a746e5d906d6..9ea6ed0f2860 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StopInternalLBVMCmd.java @@ -105,7 +105,7 @@ public boolean isForced() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException { - CallContext.current().setEventDetails("Internal lb vm Id: " + getId()); + CallContext.current().setEventDetails("Internal lb VM Id: " + getId()); VirtualRouter result = null; VirtualRouter vm = _routerService.findRouter(getId()); if (vm == null || vm.getRole() != Role.INTERNAL_LB_VM) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java index 7e0faab2fb50..3ed06a044f41 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java @@ -91,7 +91,7 @@ public Long getApiResourceId() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); VirtualMachine instance = _mgr.destroySystemVM(this); if (instance != null) { SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java index 30bd51184ac3..38df7560a973 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java @@ -105,7 +105,7 @@ public boolean isForced() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); VirtualMachine result = _mgr.rebootSystemVM(this); if (result != null) { SystemVmResponse response = _responseGenerator.createSystemVmResponse(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java index 06e57674c537..161e37a55bb3 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java @@ -98,7 +98,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("SystemVm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("SystemVM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId); if (serviceOffering == null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java index eac3d64ab59e..64eddba849c0 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java @@ -102,7 +102,7 @@ public Long getApiResourceId() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); VirtualMachine instance = _mgr.startSystemVM(getId()); if (instance != null) { SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java index 1d84382f5d22..4d4bb68e8e82 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java @@ -108,7 +108,7 @@ public boolean isForced() { @Override public void execute() throws ResourceUnavailableException, ConcurrentOperationException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); VirtualMachine result = _mgr.stopSystemVM(this); if (result != null) { SystemVmResponse response = _responseGenerator.createSystemVmResponse(result); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java index 5abe90e3f589..a3eb68e2afe2 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java @@ -87,7 +87,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId); if (serviceOffering == null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java index a964e873bad1..393e85a4ae0b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ExpungeVMCmd.java @@ -96,7 +96,7 @@ public Long getApiResourceId() { @Override public void execute() throws ResourceUnavailableException, ConcurrentOperationException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); try { UserVm result = _userVmService.expungeVm(this.getId()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java index d795fbabb528..ea485a15b86f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java @@ -114,7 +114,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + getVirtualMachineId() + " ISO ID: " + getId()); + CallContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " ISO ID: " + getId()); boolean result = _templateService.attachIso(id, virtualMachineId, isForced()); if (result) { UserVm userVm = _responseGenerator.findUserVmById(virtualMachineId); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java index ecd066d98cd5..2141126d54e9 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java @@ -167,7 +167,7 @@ public ApiCommandResourceType getApiResourceType() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Network Id: " + this._uuidMgr.getUuid(Network.class, getNetworkId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Network Id: " + this._uuidMgr.getUuid(Network.class, getNetworkId())); UserVm result = _userVmService.addNicToVirtualMachine(this); ArrayList dc = new ArrayList(); dc.add(VMDetails.valueOf("nics")); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java index 446bdf30f07a..f6ffd4dbf3bc 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java @@ -756,9 +756,9 @@ public String getCreateEventDescription() { @Override public String getEventDescription() { if(getStartVm()) { - return "starting Vm. Vm Id: " + getEntityUuid(); + return "starting Vm. VM Id: " + getEntityUuid(); } - return "deploying Vm. Vm Id: " + getEntityUuid(); + return "deploying Vm. VM Id: " + getEntityUuid(); } @Override @@ -770,7 +770,7 @@ public ApiCommandResourceType getApiResourceType() { public void execute() { UserVm result; - CallContext.current().setEventDetails("Vm Id: " + getEntityUuid()); + CallContext.current().setEventDetails("VM Id: " + getEntityUuid()); if (getStartVm()) { try { result = _userVmService.startVirtualMachine(this); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java index aa121162cb4e..4edfee6f29a6 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java @@ -131,7 +131,7 @@ public Long getApiResourceId() { @Override public void execute() throws ResourceUnavailableException, ConcurrentOperationException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); UserVm result = _userVmService.destroyVm(this); UserVmResponse response = new UserVmResponse(); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java index 153f5ea65636..145cd1774a6b 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java @@ -115,7 +115,7 @@ public Long getApiResourceId() { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); UserVm result; result = _userVmService.rebootVirtualMachine(this); if (result !=null){ diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java index d9024f340228..0cbf9f173d5a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java @@ -103,7 +103,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId())); UserVm result = _userVmService.removeNicFromVirtualMachine(this); ArrayList dc = new ArrayList(); dc.add(VMDetails.valueOf("nics")); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java index 7270004aeed8..622d35857e6f 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java @@ -124,7 +124,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE } else { logger.debug(String.format("Resetting VM [%s] password to password defined by user.", vm.getUuid())); } - CallContext.current().setEventDetails("Vm Id: " + getId()); + CallContext.current().setEventDetails("VM Id: " + getId()); UserVm result = _userVmService.resetVMPassword(this, password); if (result != null){ UserVmResponse response = _responseGenerator.createUserVmResponse(getResponseView(), "virtualmachine", result).get(0); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java index a4019411e1d2..e311de71ef0e 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java @@ -152,7 +152,7 @@ public Long getApiResourceId() { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException { - CallContext.current().setEventDetails("Vm Id: " + getId()); + CallContext.current().setEventDetails("VM Id: " + getId()); UserVm result = _userVmService.resetVMSSHKey(this); if (result != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMUserDataCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMUserDataCmd.java index 089dfaecf946..a121ee5eb70d 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMUserDataCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMUserDataCmd.java @@ -143,7 +143,7 @@ public Long getApiResourceId() { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException { - CallContext.current().setEventDetails("Vm Id: " + getId()); + CallContext.current().setEventDetails("VM Id: " + getId()); UserVm result = _userVmService.resetVMUserData(this); if (result != null) { diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java index 3839049eee5e..014651158f02 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java @@ -97,7 +97,7 @@ public String getEventDescription() { public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { UserVm result; - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId())); result = _userVmService.restoreVM(this); if (result != null) { UserVmResponse response = _responseGenerator.createUserVmResponse(getResponseView(), "virtualmachine", result).get(0); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java index 8bc4f0ff3b15..28d51407874a 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java @@ -173,7 +173,7 @@ public Long getApiResourceId() { @Override public void execute() { try { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); UserVm result; result = _userVmService.startVirtualMachine(this); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java index bfd5d8d07f61..6bfa3cf05b25 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java @@ -115,7 +115,7 @@ public boolean isForced() { @Override public void execute() throws ServerApiException, ConcurrentOperationException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); UserVm result; result = _userVmService.stopVirtualMachine(getId(), isForced()); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java index 837bde06a6ca..ed0f6514e869 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java @@ -104,7 +104,7 @@ public long getEntityOwnerId() { @Override public void execute() { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getVmId()) + " Nic Id: " + this._uuidMgr.getUuid(Nic.class, getNicId())); UserVm result = _userVmService.updateDefaultNicForVirtualMachine(this); ArrayList dc = new ArrayList(); dc.add(VMDetails.valueOf("nics")); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java index 9f72ac17c8f4..c304e0ce54d8 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java @@ -277,7 +277,7 @@ public long getEntityOwnerId() { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); UserVm result = null; try { result = _userVmService.updateVirtualMachine(this); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java index 6a7422e70bbb..5e8840adcc30 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java @@ -139,7 +139,7 @@ public long getEntityOwnerId() { @Override public void execute() throws ResourceAllocationException { - CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); + CallContext.current().setEventDetails("VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId); if (serviceOffering == null) { diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index a2921452e284..6c6c4d3e208d 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -1050,7 +1050,7 @@ private void updateRootDiskVolumeEventDetails(Type type, VirtualMachine vm, List callContext.setEventResourceId(volumeIds.get(0)); } String volumeUuids = volumeIds.stream().map(volumeId -> this._uuidMgr.getUuid(Volume.class, volumeId)).collect(Collectors.joining(", ")); - callContext.setEventDetails("Volume Type: " + type + "Volume Id: " + volumeUuids + " Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, vm.getId())); + callContext.setEventDetails("Volume Type: " + type + "Volume Id: " + volumeUuids + " VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, vm.getId())); } } @@ -1289,7 +1289,7 @@ private void destroyVolumeInContext(Volume volume) { // Create new context and inject correct event resource type, id and details, // otherwise VOLUME.DESTROY event will be associated with VirtualMachine and contain VM id and other information. CallContext volumeContext = CallContext.register(CallContext.current(), ApiCommandResourceType.Volume); - volumeContext.setEventDetails("Volume Type: " + volume.getVolumeType() + " Volume Id: " + volume.getUuid() + " Vm Id: " + _uuidMgr.getUuid(VirtualMachine.class, volume.getInstanceId())); + volumeContext.setEventDetails("Volume Type: " + volume.getVolumeType() + " Volume Id: " + volume.getUuid() + " VM Id: " + _uuidMgr.getUuid(VirtualMachine.class, volume.getInstanceId())); volumeContext.setEventResourceType(ApiCommandResourceType.Volume); volumeContext.setEventResourceId(volume.getId()); try { diff --git a/framework/db/src/main/java/com/cloud/utils/db/EcInfo.java b/framework/db/src/main/java/com/cloud/utils/db/EcInfo.java index dcda5bc33d55..08993c4de7e5 100644 --- a/framework/db/src/main/java/com/cloud/utils/db/EcInfo.java +++ b/framework/db/src/main/java/com/cloud/utils/db/EcInfo.java @@ -68,7 +68,7 @@ public EcInfo(Attribute attr, Attribute idAttr) { } CollectionTable ct = attr.field.getAnnotation(CollectionTable.class); - assert (ct.name().length() > 0) : "Please sepcify the table for " + attr.field.getName(); + assert (ct.name().length() > 0) : "Please specify the table for " + attr.field.getName(); StringBuilder selectBuf = new StringBuilder("SELECT "); StringBuilder insertBuf = new StringBuilder("INSERT INTO "); StringBuilder clearBuf = new StringBuilder("DELETE FROM "); diff --git a/plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/ServiceManagerImpl.java b/plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/ServiceManagerImpl.java index 08941c56e3c5..98ad70bbe0d0 100644 --- a/plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/ServiceManagerImpl.java +++ b/plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/ServiceManagerImpl.java @@ -134,7 +134,7 @@ private ServiceVirtualMachine createServiceVM(DataCenter zone, Account owner, Vi } catch (InsufficientCapacityException ex) { throw new CloudRuntimeException("Insufficient capacity", ex); } - CallContext.current().setEventDetails("Vm Id: " + svm.getId()); + CallContext.current().setEventDetails("VM Id: " + svm.getId()); return svm; } diff --git a/plugins/network-elements/netscaler/src/main/java/com/cloud/api/commands/StopNetScalerVMCmd.java b/plugins/network-elements/netscaler/src/main/java/com/cloud/api/commands/StopNetScalerVMCmd.java index b4771b57b508..9e8d90eb9f0a 100644 --- a/plugins/network-elements/netscaler/src/main/java/com/cloud/api/commands/StopNetScalerVMCmd.java +++ b/plugins/network-elements/netscaler/src/main/java/com/cloud/api/commands/StopNetScalerVMCmd.java @@ -110,7 +110,7 @@ public boolean isForced() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException { - CallContext.current().setEventDetails("NetScaler vm Id: " + getId()); + CallContext.current().setEventDetails("NetScaler VM Id: " + getId()); VirtualRouter result = null; VirtualRouter vm = _routerService.findRouter(getId()); if (vm == null || vm.getRole() != Role.NETSCALER_VM) { diff --git a/plugins/network-elements/stratosphere-ssp/src/test/java/org/apache/cloudstack/network/element/SspElementTest.java b/plugins/network-elements/stratosphere-ssp/src/test/java/org/apache/cloudstack/network/element/SspElementTest.java index d0aaffada7f0..6c3477f1199c 100644 --- a/plugins/network-elements/stratosphere-ssp/src/test/java/org/apache/cloudstack/network/element/SspElementTest.java +++ b/plugins/network-elements/stratosphere-ssp/src/test/java/org/apache/cloudstack/network/element/SspElementTest.java @@ -90,7 +90,7 @@ public void fullyConfigured() { when(_element._physicalNetworkServiceProviderDao.findByServiceProvider(physicalNetworkId, "StratosphereSsp")).thenReturn(nspvo); - // and zone api server, credentail is configured + // and zone API server, credential is configured when(credential.getUsername()).thenReturn("foo"); when(credential.getPassword()).thenReturn("bar"); @@ -120,7 +120,7 @@ public void isReadyTest() { // ssp is ready assertTrue(_element.isReady(nspvo)); - // If you don't call addstratospheressp api, ssp won't be ready + // If you don't call addstratospheressp API, ssp won't be ready when(_element._sspCredentialDao.findByZone(dataCenterId.longValue())).thenReturn(null); when(_element._resourceMgr.listAllHostsInOneZoneByType(Host.Type.L2Networking, dataCenterId)).thenReturn(Arrays. asList()); assertFalse(_element.isReady(nspvo)); @@ -133,7 +133,7 @@ public void canHandleTest() { // ssp is active assertTrue(_element.canHandle(psvo)); - // You can disable ssp temporary by truning the state disabled + // You can disable ssp temporary by turning the state disabled when(nspvo.getState()).thenReturn(PhysicalNetworkServiceProvider.State.Disabled); assertFalse(_element.canHandle(psvo)); @@ -146,7 +146,7 @@ public void canHandleTest() { when(nspvo.getState()).thenReturn(PhysicalNetworkServiceProvider.State.Enabled); when(_element._physicalNetworkServiceProviderDao.findByServiceProvider(physicalNetworkId, "StratosphereSsp")).thenReturn(nspvo); - // If you don't call addstratospheressp api, ssp won't be active + // If you don't call addstratospheressp API, ssp won't be active when(_element._sspCredentialDao.findByZone(dataCenterId.longValue())).thenReturn(null); when(_element._resourceMgr.listAllHostsInOneZoneByType(Host.Type.L2Networking, dataCenterId)).thenReturn(Arrays. asList()); assertFalse(_element.canHandle(psvo)); diff --git a/server/src/main/java/com/cloud/network/NetworkServiceImpl.java b/server/src/main/java/com/cloud/network/NetworkServiceImpl.java index e618c17d3cf8..0c3e59c5ec42 100644 --- a/server/src/main/java/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/main/java/com/cloud/network/NetworkServiceImpl.java @@ -3390,7 +3390,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { long vmId = nic.getInstanceId(); VMInstanceVO vm = _vmDao.findById(vmId); if (vm == null) { - logger.error("Vm for nic " + nic.getId() + " not found with Vm Id:" + vmId); + logger.error("Vm for nic " + nic.getId() + " not found with VM Id:" + vmId); continue; } long isDefault = (nic.isDefaultNic()) ? 1 : 0; diff --git a/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java b/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java index 5881619791e7..fecbe37c6a2e 100644 --- a/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java +++ b/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java @@ -1968,7 +1968,7 @@ public void checkAutoScaleVmGroupName(String groupName) { private boolean startNewVM(long vmId) { try { - CallContext.current().setEventDetails("Vm Id: " + vmId); + CallContext.current().setEventDetails("VM Id: " + vmId); userVmMgr.startVirtualMachine(vmId, null, new HashMap<>(), null); } catch (final ResourceUnavailableException ex) { logger.warn("Exception: ", ex); diff --git a/server/src/main/java/com/cloud/template/TemplateManagerImpl.java b/server/src/main/java/com/cloud/template/TemplateManagerImpl.java index c4692ce62d61..bf02945cd729 100755 --- a/server/src/main/java/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/main/java/com/cloud/template/TemplateManagerImpl.java @@ -1162,7 +1162,7 @@ public boolean detachIso(long vmId, boolean forced) { if (isoId == null) { throw new InvalidParameterValueException("The specified VM has no ISO attached to it."); } - CallContext.current().setEventDetails("Vm Id: " + userVM.getUuid() + " ISO Id: " + isoId); + CallContext.current().setEventDetails("VM Id: " + userVM.getUuid() + " ISO Id: " + isoId); State vmState = userVM.getState(); if (vmState != State.Running && vmState != State.Stopped) { diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java index a03aeac9967f..5a6a9f41f24a 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java @@ -646,22 +646,22 @@ public void setKubernetesClusterHelpers(final List kube VnfTemplateManager vnfTemplateManager; private static final ConfigKey VmIpFetchWaitInterval = new ConfigKey("Advanced", Integer.class, "externaldhcp.vmip.retrieval.interval", "180", - "Wait Interval (in seconds) for shared network vm dhcp ip addr fetch for next iteration ", true); + "Wait Interval (in seconds) for shared network VM DHCP IP addr fetch for next iteration", true); private static final ConfigKey VmIpFetchTrialMax = new ConfigKey("Advanced", Integer.class, "externaldhcp.vmip.max.retry", "10", - "The max number of retrieval times for shared entwork vm dhcp ip fetch, in case of failures", true); + "The max number of retrieval times for shared network VM DHCP IP fetch, in case of failures", true); private static final ConfigKey VmIpFetchThreadPoolMax = new ConfigKey("Advanced", Integer.class, "externaldhcp.vmipFetch.threadPool.max", "10", - "number of threads for fetching vms ip address", true); + "number of threads for fetching VMs IP address", true); private static final ConfigKey VmIpFetchTaskWorkers = new ConfigKey("Advanced", Integer.class, "externaldhcp.vmipfetchtask.workers", "10", - "number of worker threads for vm ip fetch task ", true); + "number of worker threads for VM IP fetch task", true); private static final ConfigKey AllowDeployVmIfGivenHostFails = new ConfigKey("Advanced", Boolean.class, "allow.deploy.vm.if.deploy.on.given.host.fails", "false", - "allow vm to deploy on different host if vm fails to deploy on the given host ", true); + "allow VM to deploy on different host if VM fails to deploy on the given host", true); private static final ConfigKey EnableAdditionalVmConfig = new ConfigKey<>("Advanced", Boolean.class, - "enable.additional.vm.configuration", "false", "allow additional arbitrary configuration to vm", true, ConfigKey.Scope.Account); + "enable.additional.vm.configuration", "false", "allow additional arbitrary configuration to VM", true, ConfigKey.Scope.Account); private static final ConfigKey KvmAdditionalConfigAllowList = new ConfigKey<>(String.class, "allow.additional.vm.configuration.list.kvm", "Advanced", "", "Comma separated list of allowed additional configuration options.", true, ConfigKey.Scope.Account, null, null, EnableAdditionalVmConfig.key(), null, null, ConfigKey.Kind.CSV, null); @@ -778,34 +778,34 @@ protected void runInContext() { boolean decrementCount = true; try { - logger.debug("Trying for vm "+ vmId +" nic Id "+nicId +" ip retrieval ..."); + logger.debug("Trying for VM "+ vmId +" NIC Id "+nicId +" IP retrieval ..."); Answer answer = _agentMgr.send(hostId, cmd); NicVO nic = _nicDao.findById(nicId); if (answer.getResult()) { String vmIp = answer.getDetails(); if (NetUtils.isValidIp4(vmIp)) { - // set this vm ip addr in vm nic. + // set this VM IP addr in VM NIC. if (nic != null) { nic.setIPv4Address(vmIp); _nicDao.update(nicId, nic); - logger.debug("Vm "+ vmId +" IP "+vmIp +" got retrieved successfully"); + logger.debug("VM "+ vmId +" IP "+vmIp +" got retrieved successfully"); vmIdCountMap.remove(nicId); decrementCount = false; ActionEventUtils.onActionEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, Domain.ROOT_DOMAIN, EventTypes.EVENT_NETWORK_EXTERNAL_DHCP_VM_IPFETCH, - "VM " + vmId + " nic id " + nicId + " ip address " + vmIp + " got fetched successfully", vmId, ApiCommandResourceType.VirtualMachine.toString()); + "VM " + vmId + " NIC id " + nicId + " IP address " + vmIp + " got fetched successfully", vmId, ApiCommandResourceType.VirtualMachine.toString()); } } } else { - //previously vm has ip and nic table has ip address. After vm restart or stop/start - //if vm doesnot get the ip then set the ip in nic table to null + //previously VM has IP and NIC table has IP address. After VM restart or stop/start + //if VM does not get the IP then set the IP in NIC table to null if (nic.getIPv4Address() != null) { nic.setIPv4Address(null); _nicDao.update(nicId, nic); } if (answer.getDetails() != null) { - logger.debug("Failed to get vm ip for Vm "+ vmId + answer.getDetails()); + logger.debug("Failed to get VM IP for VM "+ vmId + answer.getDetails()); } } } catch (OperationTimedoutException e) { @@ -816,7 +816,7 @@ protected void runInContext() { if (decrementCount) { VmAndCountDetails vmAndCount = vmIdCountMap.get(nicId); vmAndCount.decrementCount(); - logger.debug("Ip is not retrieved for VM " + vmId +" nic "+nicId + " ... decremented count to "+vmAndCount.getRetrievalCount()); + logger.debug("IP is not retrieved for VM " + vmId +" NIC "+nicId + " ... decremented count to "+vmAndCount.getRetrievalCount()); vmIdCountMap.put(nicId, vmAndCount); } } @@ -838,7 +838,7 @@ private void addVmUefiBootOptionsToParams(Map vmNetworks = _vmNetworkMapDao.getNetworks(vmId); List routers = new ArrayList(); //List the stopped routers @@ -1154,11 +1154,11 @@ private UserVm rebootVirtualMachine(long userId, long vmId, boolean enterSetup, List router = _routerDao.listStopped(vmNetworkId); routers.addAll(router); } - //A vm may not have many nics attached and even fewer routers might be stopped (only in exceptional cases) - //Safe to start the stopped router serially, this is consistent with the way how multiple networks are added to vm during deploy - //and routers are started serially ,may revisit to make this process parallel + //A VM may not have many NICs attached and even fewer routers might be stopped (only in exceptional cases) + //Safe to start the stopped router serially, this is consistent with the way how multiple networks are added to VM during deploy + //and routers are started serially, may revisit to make this process parallel for(DomainRouterVO routerToStart : routers) { - logger.warn("Trying to start router " + routerToStart.getInstanceName() + " as part of vm: " + vm.getInstanceName() + " reboot"); + logger.warn("Trying to start router " + routerToStart.getInstanceName() + " as part of VM: " + vm.getInstanceName() + " reboot"); _virtualNetAppliance.startRouter(routerToStart.getId(),true); } } @@ -1168,7 +1168,7 @@ private UserVm rebootVirtualMachine(long userId, long vmId, boolean enterSetup, throw new CloudRuntimeException("Router start failed due to" + ex); } finally { if (logger.isInfoEnabled()) { - logger.info(String.format("Rebooting vm %s%s.", vm.getInstanceName(), enterSetup? " entering hardware setup menu" : " as is")); + logger.info(String.format("Rebooting VM %s%s.", vm.getInstanceName(), enterSetup? " entering hardware setup menu" : " as is")); } Map params = null; if (enterSetup) { @@ -1182,7 +1182,7 @@ private UserVm rebootVirtualMachine(long userId, long vmId, boolean enterSetup, } return _vmDao.findById(vmId); } else { - logger.error("Vm id=" + vmId + " is not in Running state, failed to reboot"); + logger.error("VM id=" + vmId + " is not in Running state, failed to reboot"); return null; } } @@ -1359,7 +1359,7 @@ private UserVm upgradeStoppedVirtualMachine(Long vmId, Long svcOffId, Map 0) { throw new InvalidParameterValueException("NIC cannot be added to VM with VM Snapshots"); } @@ -1471,11 +1471,11 @@ public UserVm addNicToVirtualMachine(AddNicToVMCmd cmd) throws InvalidParameterV if(_networkModel.getNicInNetwork(vmInstance.getId(),network.getId()) != null){ logger.debug("VM " + vmInstance.getHostName() + " already in network " + network.getName() + " going to add another NIC"); } else { - //* get all vms hostNames in the network + //* get all VMs hostNames in the network List hostNames = _vmInstanceDao.listDistinctHostNames(network.getId()); //* verify that there are no duplicates if (hostNames.contains(vmInstance.getHostName())) { - throw new CloudRuntimeException("Network " + network.getName() + " already has a vm with host name: " + vmInstance.getHostName()); + throw new CloudRuntimeException("Network " + network.getName() + " already has a VM with host name: " + vmInstance.getHostName()); } } @@ -1558,7 +1558,7 @@ private void saveExtraDhcpOptions(long nicId, Map dhcpOptions) } @Override - @ActionEvent(eventType = EventTypes.EVENT_NIC_DELETE, eventDescription = "Removing Nic", async = true) + @ActionEvent(eventType = EventTypes.EVENT_NIC_DELETE, eventDescription = "Removing NIC", async = true) public UserVm removeNicFromVirtualMachine(RemoveNicFromVMCmd cmd) throws InvalidParameterValueException, PermissionDeniedException, CloudRuntimeException { Long vmId = cmd.getVmId(); Long nicId = cmd.getNicId(); @@ -1576,7 +1576,7 @@ public UserVm removeNicFromVirtualMachine(RemoveNicFromVMCmd cmd) throws Invalid NicVO nic = _nicDao.findById(nicId); if (nic == null) { - throw new InvalidParameterValueException("Unable to find a nic with id " + nicId); + throw new InvalidParameterValueException("Unable to find a NIC with id " + nicId); } NetworkVO network = _networkDao.findById(nic.getNetworkId()); @@ -1593,19 +1593,19 @@ public UserVm removeNicFromVirtualMachine(RemoveNicFromVMCmd cmd) throws Invalid throw new InvalidParameterValueException("Zone " + vmInstance.getDataCenterId() + ", has a NetworkType of Basic. Can't remove a NIC from a VM on a Basic Network"); } - // check to see if nic is attached to VM + // check to see if NIC is attached to VM if (nic.getInstanceId() != vmId) { - throw new InvalidParameterValueException(nic + " is not a nic on " + vmInstance); + throw new InvalidParameterValueException(nic + " is not a NIC on " + vmInstance); } // don't delete default NIC on a user VM if (nic.isDefaultNic() && vmInstance.getType() == VirtualMachine.Type.User) { - throw new InvalidParameterValueException("Unable to remove nic from " + vmInstance + " in " + network + ", nic is default."); + throw new InvalidParameterValueException("Unable to remove NIC from " + vmInstance + " in " + network + ", NIC is default."); } - // if specified nic is associated with PF/LB/Static NAT + // if specified NIC is associated with PF/LB/Static NAT if (_rulesMgr.listAssociatedRulesForGuestNic(nic).size() > 0) { - throw new InvalidParameterValueException("Unable to remove nic from " + vmInstance + " in " + network + ", nic has associated Port forwarding or Load balancer or Static NAT rules."); + throw new InvalidParameterValueException("Unable to remove NIC from " + vmInstance + " in " + network + ", NIC has associated Port forwarding or Load balancer or Static NAT rules."); } boolean nicremoved = false; @@ -1627,7 +1627,7 @@ public UserVm removeNicFromVirtualMachine(RemoveNicFromVMCmd cmd) throws Invalid } @Override - @ActionEvent(eventType = EventTypes.EVENT_NIC_UPDATE, eventDescription = "Creating Nic", async = true) + @ActionEvent(eventType = EventTypes.EVENT_NIC_UPDATE, eventDescription = "Creating NIC", async = true) public UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) throws InvalidParameterValueException, CloudRuntimeException { Long vmId = cmd.getVmId(); Long nicId = cmd.getNicId(); @@ -1645,7 +1645,7 @@ public UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th NicVO nic = _nicDao.findById(nicId); if (nic == null) { - throw new InvalidParameterValueException("unable to find a nic with id " + nicId); + throw new InvalidParameterValueException("unable to find a NIC with id " + nicId); } NetworkVO network = _networkDao.findById(nic.getNetworkId()); if (network == null) { @@ -1664,11 +1664,11 @@ public UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th // no need to check permissions for network, we'll enumerate the ones they already have access to Network existingdefaultnet = _networkModel.getDefaultNetworkForVm(vmId); - //check to see if nic is attached to VM + //check to see if NIC is attached to VM if (nic.getInstanceId() != vmId) { throw new InvalidParameterValueException(nic + " is not a nic on " + vmInstance); } - // if current default equals chosen new default, Throw an exception + // if current default equals chosen new default, throw an exception if (nic.isDefaultNic()) { throw new CloudRuntimeException("refusing to set default nic because chosen nic is already the default"); } @@ -1687,8 +1687,8 @@ public UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th } if (existing == null) { - logger.warn("Failed to update default nic, no nic profile found for existing default network"); - throw new CloudRuntimeException("Failed to find a nic profile for the existing default network. This is bad and probably means some sort of configuration corruption"); + logger.warn("Failed to update default NIC, no NIC profile found for existing default network"); + throw new CloudRuntimeException("Failed to find a NIC profile for the existing default network. This is bad and probably means some sort of configuration corruption"); } Network oldDefaultNetwork = null; @@ -1719,9 +1719,9 @@ public UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th newdefault = _networkModel.getDefaultNetworkForVm(vmId); if (newdefault.getId() == existingdefaultnet.getId()) { - throw new CloudRuntimeException("Setting a default nic failed, and we had no default nic, but we were able to set it back to the original"); + throw new CloudRuntimeException("Setting a default NIC failed, and we had no default NIC, but we were able to set it back to the original"); } - throw new CloudRuntimeException("Failed to change default nic to " + nic + " and now we have no default"); + throw new CloudRuntimeException("Failed to change default NIC to " + nic + " and now we have no default"); } else if (newdefault.getId() == nic.getNetworkId()) { logger.debug("successfully set default network to " + network + " for " + vmInstance); String nicIdString = Long.toString(nic.getId()); @@ -1751,7 +1751,7 @@ public UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th } throw new CloudRuntimeException("something strange happened, new default network(" + newdefault.getId() + ") is not null, and is not equal to the network(" - + nic.getNetworkId() + ") of the chosen nic"); + + nic.getNetworkId() + ") of the chosen NIC"); } @Override @@ -1760,28 +1760,28 @@ public UserVm updateNicIpForVirtualMachine(UpdateVmNicIpCmd cmd) { String ipaddr = cmd.getIpaddress(); Account caller = CallContext.current().getCallingAccount(); - //check whether the nic belongs to user vm. + //check whether the NIC belongs to user VM. NicVO nicVO = _nicDao.findById(nicId); if (nicVO == null) { - throw new InvalidParameterValueException("There is no nic for the " + nicId); + throw new InvalidParameterValueException("There is no NIC for the " + nicId); } if (nicVO.getVmType() != VirtualMachine.Type.User) { - throw new InvalidParameterValueException("The nic is not belongs to user vm"); + throw new InvalidParameterValueException("The NIC is not belongs to user VM"); } UserVm vm = _vmDao.findById(nicVO.getInstanceId()); if (vm == null) { - throw new InvalidParameterValueException("There is no vm with the nic"); + throw new InvalidParameterValueException("There is no VM with the NIC"); } Network network = _networkDao.findById(nicVO.getNetworkId()); if (network == null) { - throw new InvalidParameterValueException("There is no network with the nic"); + throw new InvalidParameterValueException("There is no network with the NIC"); } - // Don't allow to update vm nic ip if network is not in Implemented/Setup/Allocated state + // Don't allow to update VM NIC IP if network is not in Implemented/Setup/Allocated state if (!(network.getState() == Network.State.Allocated || network.getState() == Network.State.Implemented || network.getState() == Network.State.Setup)) { - throw new InvalidParameterValueException("Network is not in the right state to update vm nic ip. Correct states are: " + Network.State.Allocated + ", " + Network.State.Implemented + ", " + throw new InvalidParameterValueException("Network is not in the right state to update VM NIC IP. Correct states are: " + Network.State.Allocated + ", " + Network.State.Implemented + ", " + Network.State.Setup); } @@ -1791,7 +1791,7 @@ public UserVm updateNicIpForVirtualMachine(UpdateVmNicIpCmd cmd) { } if (!_networkModel.listNetworkOfferingServices(offering.getId()).isEmpty() && vm.getState() != State.Stopped) { InvalidParameterValueException ex = new InvalidParameterValueException( - "VM is not Stopped, unable to update the vm nic having the specified id"); + "VM is not Stopped, unable to update the VM NIC having the specified id"); ex.addProxyObject(vm.getUuid(), "vmId"); throw ex; } @@ -1800,20 +1800,20 @@ public UserVm updateNicIpForVirtualMachine(UpdateVmNicIpCmd cmd) { _accountMgr.checkAccess(caller, null, true, vm); Account ipOwner = _accountDao.findByIdIncludingRemoved(vm.getAccountId()); - // verify ip address - logger.debug("Calling the ip allocation ..."); + // verify IP address + logger.debug("Calling the IP allocation ..."); DataCenter dc = _dcDao.findById(network.getDataCenterId()); if (dc == null) { - throw new InvalidParameterValueException("There is no dc with the nic"); + throw new InvalidParameterValueException("There is no dc with the NIC"); } if (dc.getNetworkType() == NetworkType.Advanced && network.getGuestType() == Network.GuestType.Isolated) { try { ipaddr = _ipAddrMgr.allocateGuestIP(network, ipaddr); } catch (InsufficientAddressCapacityException e) { - throw new InvalidParameterValueException("Allocating ip to guest nic " + nicVO.getUuid() + " failed, for insufficient address capacity"); + throw new InvalidParameterValueException("Allocating IP to guest NIC " + nicVO.getUuid() + " failed, for insufficient address capacity"); } if (ipaddr == null) { - throw new InvalidParameterValueException("Allocating ip to guest nic " + nicVO.getUuid() + " failed, please choose another ip"); + throw new InvalidParameterValueException("Allocating IP to guest NIC " + nicVO.getUuid() + " failed, please choose another ip"); } if (nicVO.getIPv4Address() != null) { @@ -1824,19 +1824,19 @@ public UserVm updateNicIpForVirtualMachine(UpdateVmNicIpCmd cmd) { } else if (dc.getNetworkType() == NetworkType.Basic || network.getGuestType() == Network.GuestType.Shared) { //handle the basic networks here - //for basic zone, need to provide the podId to ensure proper ip alloation + //for basic zone, need to provide the podId to ensure proper ip allocation Long podId = null; if (dc.getNetworkType() == NetworkType.Basic) { podId = vm.getPodIdToDeployIn(); if (podId == null) { - throw new InvalidParameterValueException("vm pod id is null in Basic zone; can't decide the range for ip allocation"); + throw new InvalidParameterValueException("VM pod id is null in Basic zone; can't decide the range for IP allocation"); } } try { ipaddr = _ipAddrMgr.allocatePublicIpForGuestNic(network, podId, ipOwner, ipaddr); if (ipaddr == null) { - throw new InvalidParameterValueException("Allocating ip to guest nic " + nicVO.getUuid() + " failed, please choose another ip"); + throw new InvalidParameterValueException("Allocating IP to guest NIC " + nicVO.getUuid() + " failed, please choose another IP"); } final IPAddressVO newIp = _ipAddressDao.findByIpAndSourceNetworkId(network.getId(), ipaddr); @@ -1855,7 +1855,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { }); } } catch (InsufficientAddressCapacityException e) { - logger.error("Allocating ip to guest nic " + nicVO.getUuid() + " failed, for insufficient address capacity"); + logger.error("Allocating IP to guest NIC " + nicVO.getUuid() + " failed, for insufficient address capacity"); return null; } } else { @@ -1922,7 +1922,7 @@ public UserVm upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableEx if (vm == null) { throw new InvalidParameterValueException("Unable to find VM's UUID"); } - CallContext.current().setEventDetails("Vm Id: " + vm.getUuid()); + CallContext.current().setEventDetails("VM Id: " + vm.getUuid()); Map cmdDetails = cmd.getDetails(); @@ -1996,7 +1996,7 @@ private boolean upgradeRunningVirtualMachine(Long vmId, Long newServiceOfferingI _accountMgr.checkAccess(caller, null, true, vmInstance); - //Check if its a scale "up" + //Check if it's a scale "up" ServiceOfferingVO newServiceOffering = serviceOfferingDao.findById(newServiceOfferingId); if (newServiceOffering.isDynamic()) { newServiceOffering.setDynamicFlag(true); @@ -2025,7 +2025,7 @@ private boolean upgradeRunningVirtualMachine(Long vmId, Long newServiceOfferingI // Don't allow to scale when (Any of the new values less than current values) OR (All current and new values are same) if ((newSpeed < currentSpeed || newMemory < currentMemory || newCpu < currentCpu) || (newSpeed == currentSpeed && newMemory == currentMemory && newCpu == currentCpu)) { - String message = String.format("While the VM is running, only scalling up it is supported. New service offering {\"memory\": %s, \"speed\": %s, \"cpu\": %s} should" + String message = String.format("While the VM is running, only scaling up it is supported. New service offering {\"memory\": %s, \"speed\": %s, \"cpu\": %s} should" + " have at least one value (ram, speed or cpu) greater than the current values {\"memory\": %s, \"speed\": %s, \"cpu\": %s}.", newMemory, newSpeed, newCpu, currentMemory, currentSpeed, currentCpu); @@ -2056,7 +2056,7 @@ private boolean upgradeRunningVirtualMachine(Long vmId, Long newServiceOfferingI _resourceLimitMgr.checkVmResourceLimitsForServiceOfferingChange(owner, vmInstance.isDisplay(), (long) currentCpu, (long) newCpu, (long) currentMemory, (long) newMemory, currentServiceOffering, newServiceOffering, template); - // Dynamically upgrade the running vms + // Dynamically upgrade the running VMs boolean success = false; if (vmInstance.getState().equals(State.Running)) { int retry = _scaleRetry; @@ -2096,7 +2096,7 @@ private boolean upgradeRunningVirtualMachine(Long vmId, Long newServiceOfferingI excludes.addHost(vmInstance.getHostId()); } - // #2 migrate the vm if host doesn't have capacity or is in avoid set + // #2 migrate the VM if host doesn't have capacity or is in avoid set if (!existingHostHasCapacity) { _itMgr.findHostAndMigrate(vmInstance.getUuid(), newServiceOfferingId, customParameters, excludes); } @@ -2105,7 +2105,7 @@ private boolean upgradeRunningVirtualMachine(Long vmId, Long newServiceOfferingI DiskOfferingVO newDiskOffering = _diskOfferingDao.findById(newServiceOffering.getDiskOfferingId()); changeDiskOfferingForRootVolume(vmId, newDiskOffering, customParameters, vmInstance.getDataCenterId()); - // #4 scale the vm now + // #4 scale the VM now vmInstance = _vmInstanceDao.findById(vmId); _itMgr.reConfigureVm(vmInstance.getUuid(), currentServiceOffering, newServiceOffering, customParameters, existingHostHasCapacity); success = true; @@ -2275,25 +2275,25 @@ public UserVm recoverVirtualMachine(RecoverVMCmd cmd) throws ResourceAllocationE // When trying to expunge, permission is denied when the caller is not an admin and the AllowUserExpungeRecoverVm is false for the caller. if (!_accountMgr.isAdmin(userId) && !AllowUserExpungeRecoverVm.valueIn(userId)) { - throw new PermissionDeniedException("Recovering a vm can only be done by an Admin. Or when the allow.user.expunge.recover.vm key is set."); + throw new PermissionDeniedException("Recovering a VM can only be done by an Admin. Or when the allow.user.expunge.recover.vm key is set."); } if (vm.getRemoved() != null) { if (logger.isDebugEnabled()) { - logger.debug("Unable to find vm or vm is removed: " + vmId); + logger.debug("Unable to find VM or VM is removed: " + vmId); } - throw new InvalidParameterValueException("Unable to find vm by id " + vmId); + throw new InvalidParameterValueException("Unable to find VM by id " + vmId); } if (vm.getState() != State.Destroyed) { if (logger.isDebugEnabled()) { - logger.debug("vm is not in the right state: " + vmId); + logger.debug("VM is not in the right state: " + vmId); } - throw new InvalidParameterValueException("Vm with id " + vmId + " is not in the right state"); + throw new InvalidParameterValueException("VM with id " + vmId + " is not in the right state"); } if (logger.isDebugEnabled()) { - logger.debug("Recovering vm " + vmId); + logger.debug("Recovering VM " + vmId); } Transaction.execute(new TransactionCallbackWithExceptionNoReturn() { @@ -2320,11 +2320,11 @@ public UserVm recoverVirtualMachine(RecoverVMCmd cmd) throws ResourceAllocationE try { if (!_itMgr.stateTransitTo(vm, VirtualMachine.Event.RecoveryRequested, null)) { - logger.debug("Unable to recover the vm because it is not in the correct state: " + vmId); - throw new InvalidParameterValueException("Unable to recover the vm because it is not in the correct state: " + vmId); + logger.debug("Unable to recover the VM because it is not in the correct state: " + vmId); + throw new InvalidParameterValueException("Unable to recover the VM because it is not in the correct state: " + vmId); } } catch (NoTransitionException e) { - throw new InvalidParameterValueException("Unable to recover the vm because it is not in the correct state: " + vmId); + throw new InvalidParameterValueException("Unable to recover the VM because it is not in the correct state: " + vmId); } // Recover the VM's disks @@ -2439,7 +2439,7 @@ private void loadVmDetailsInMapForExternalDhcpIp() { long vmId = nic.getInstanceId(); VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId); - // only load running vms. For stopped vms get loaded on starting + // only load running VMs. For stopped VMs get loaded on starting if (vmInstance != null && vmInstance.getState() == State.Running) { VmAndCountDetails vmAndCount = new VmAndCountDetails(vmId, VmIpFetchTrialMax.value()); vmIdCountMap.put(nicId, vmAndCount); @@ -2486,18 +2486,18 @@ public boolean expunge(UserVmVO vm) { releaseNetworkResourcesOnExpunge(vm.getId()); List rootVol = _volsDao.findByInstanceAndType(vm.getId(), Volume.Type.ROOT); - // expunge the vm + // expunge the VM _itMgr.advanceExpunge(vm.getUuid()); - // Only if vm is not expunged already, cleanup it's resources + // Only if VM is not expunged already, cleanup it's resources if (vm.getRemoved() == null) { - // Cleanup vm resources - all the PF/LB/StaticNat rules - // associated with vm - logger.debug("Starting cleaning up vm " + vm + " resources..."); + // Cleanup VM resources - all the PF/LB/StaticNat rules + // associated with VM + logger.debug("Starting cleaning up VM " + vm + " resources..."); if (cleanupVmResources(vm.getId())) { - logger.debug("Successfully cleaned up vm " + vm + " resources as a part of expunge process"); + logger.debug("Successfully cleaned up VM " + vm + " resources as a part of expunge process"); } else { - logger.warn("Failed to cleanup resources as a part of vm " + vm + " expunge"); + logger.warn("Failed to cleanup resources as a part of VM " + vm + " expunge"); return false; } @@ -2526,8 +2526,8 @@ public boolean expunge(UserVmVO vm) { } /** - * Release network resources, it was done on vm stop previously. - * @param id vm id + * Release network resources, it was done on VM stop previously. + * @param id VM id * @throws ConcurrentOperationException * @throws ResourceUnavailableException */ @@ -2538,24 +2538,24 @@ private void releaseNetworkResourcesOnExpunge(long id) throws ConcurrentOperatio _networkMgr.release(profile, false); } else { - logger.error("Couldn't find vm with id = " + id + ", unable to release network resources"); + logger.error("Couldn't find VM with id = " + id + ", unable to release network resources"); } } private boolean cleanupVmResources(long vmId) { boolean success = true; - // Remove vm from security groups + // Remove VM from security groups _securityGroupMgr.removeInstanceFromGroups(vmId); - // Remove vm from instance group + // Remove VM from instance group removeInstanceFromInstanceGroup(vmId); // cleanup firewall rules if (_firewallMgr.revokeFirewallRulesForVm(vmId)) { - logger.debug("Firewall rules are removed successfully as a part of vm id=" + vmId + " expunge"); + logger.debug("Firewall rules are removed successfully as a part of VM id=" + vmId + " expunge"); } else { success = false; - logger.warn("Fail to remove firewall rules as a part of vm id=" + vmId + " expunge"); + logger.warn("Fail to remove firewall rules as a part of VM id=" + vmId + " expunge"); } // cleanup port forwarding rules @@ -2563,36 +2563,36 @@ private boolean cleanupVmResources(long vmId) { NsxProviderVO nsx = nsxProviderDao.findByZoneId(vmInstanceVO.getDataCenterId()); if (Objects.isNull(nsx) || Objects.isNull(kubernetesClusterHelpers.get(0).findByVmId(vmId))) { if (_rulesMgr.revokePortForwardingRulesForVm(vmId)) { - logger.debug("Port forwarding rules are removed successfully as a part of vm id=" + vmId + " expunge"); + logger.debug("Port forwarding rules are removed successfully as a part of VM id=" + vmId + " expunge"); } else { success = false; - logger.warn("Fail to remove port forwarding rules as a part of vm id=" + vmId + " expunge"); + logger.warn("Fail to remove port forwarding rules as a part of VM id=" + vmId + " expunge"); } } // cleanup load balancer rules if (_lbMgr.removeVmFromLoadBalancers(vmId)) { - logger.debug("Removed vm id=" + vmId + " from all load balancers as a part of expunge process"); + logger.debug("Removed VM id=" + vmId + " from all load balancers as a part of expunge process"); } else { success = false; - logger.warn("Fail to remove vm id=" + vmId + " from load balancers as a part of expunge process"); + logger.warn("Fail to remove VM id=" + vmId + " from load balancers as a part of expunge process"); } - // If vm is assigned to static nat, disable static nat for the ip + // If VM is assigned to static nat, disable static nat for the IP // address and disassociate ip if elasticIP is enabled List ips = _ipAddressDao.findAllByAssociatedVmId(vmId); for (IPAddressVO ip : ips) { try { if (_rulesMgr.disableStaticNat(ip.getId(), _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM), User.UID_SYSTEM, true)) { - logger.debug("Disabled 1-1 nat for ip address " + ip + " as a part of vm id=" + vmId + " expunge"); + logger.debug("Disabled 1-1 nat for IP address " + ip + " as a part of VM id=" + vmId + " expunge"); } else { - logger.warn("Failed to disable static nat for ip address " + ip + " as a part of vm id=" + vmId + " expunge"); + logger.warn("Failed to disable static nat for IP address " + ip + " as a part of VM id=" + vmId + " expunge"); success = false; } } catch (ResourceUnavailableException e) { success = false; - logger.warn("Failed to disable static nat for ip address " + ip + " as a part of vm id=" + vmId + " expunge because resource is unavailable", e); + logger.warn("Failed to disable static nat for IP address " + ip + " as a part of VM id=" + vmId + " expunge because resource is unavailable", e); } } @@ -2606,20 +2606,20 @@ public void deletePrivateTemplateRecord(Long templateId) { } } - // used for vm transitioning to error state + // used for VM transitioning to error state private void updateVmStateForFailedVmCreation(Long vmId, Long hostId) { UserVmVO vm = _vmDao.findById(vmId); if (vm != null) { if (vm.getState().equals(State.Stopped)) { - logger.debug("Destroying vm " + vm + " as it failed to create on Host with Id:" + hostId); + logger.debug("Destroying VM " + vm + " as it failed to create on Host with Id:" + hostId); try { _itMgr.stateTransitTo(vm, VirtualMachine.Event.OperationFailedToError, null); } catch (NoTransitionException e1) { logger.warn(e1.getMessage()); } - // destroy associated volumes for vm in error state + // destroy associated volumes for VM in error state // get all volumes in non destroyed state List volumesForThisVm = _volsDao.findUsableVolumesForInstance(vm.getId()); for (VolumeVO volume : volumesForThisVm) { @@ -2627,7 +2627,7 @@ private void updateVmStateForFailedVmCreation(Long vmId, Long hostId) { volumeMgr.destroyVolume(volume); } } - String msg = "Failed to deploy Vm with Id: " + vmId + ", on Host with Id: " + hostId; + String msg = "Failed to deploy VM with Id: " + vmId + ", on Host with Id: " + hostId; _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_USERVM, vm.getDataCenterId(), vm.getPodIdToDeployIn(), msg, msg); // Get serviceOffering and template for Virtual Machine @@ -2658,11 +2658,11 @@ protected void runInContext() { if (vmIdAndCount.getRetrievalCount() <= 0) { vmIdCountMap.remove(nicId); - logger.debug("Vm " + vmId +" nic "+nicId + " count is zero .. removing vm nic from map "); + logger.debug("VM " + vmId +" NIC "+nicId + " count is zero .. removing VM NIC from map "); ActionEventUtils.onActionEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, Domain.ROOT_DOMAIN, EventTypes.EVENT_NETWORK_EXTERNAL_DHCP_VM_IPFETCH, - "VM " + vmId + " nic id "+ nicId + " ip addr fetch failed ", vmId, ApiCommandResourceType.VirtualMachine.toString()); + "VM " + vmId + " NIC id "+ nicId + " IP addr fetch failed ", vmId, ApiCommandResourceType.VirtualMachine.toString()); continue; } @@ -2708,9 +2708,9 @@ protected void runInContext() { List vms = _vmDao.findDestroyedVms(new Date(System.currentTimeMillis() - ((long)_expungeDelay << 10))); if (logger.isInfoEnabled()) { if (vms.size() == 0) { - logger.trace("Found " + vms.size() + " vms to expunge."); + logger.trace("Found " + vms.size() + " VMs to expunge."); } else { - logger.info("Found " + vms.size() + " vms to expunge."); + logger.info("Found " + vms.size() + " VMs to expunge."); } } for (UserVmVO vm : vms) { @@ -2783,7 +2783,7 @@ private void verifyVmLimits(UserVmVO vmInstance, Map details) { } @Override - @ActionEvent(eventType = EventTypes.EVENT_VM_UPDATE, eventDescription = "updating Vm") + @ActionEvent(eventType = EventTypes.EVENT_VM_UPDATE, eventDescription = "updating VM") public UserVm updateVirtualMachine(UpdateVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException { validateInputsAndPermissionForUpdateVirtualMachineCommand(cmd); @@ -2886,7 +2886,7 @@ public UserVm updateVirtualMachine(UpdateVMCmd cmd) throws ResourceUnavailableEx } if (StringUtils.isNotBlank(extraConfig)) { if (EnableAdditionalVmConfig.valueIn(accountId)) { - logger.info("Adding extra configuration to user vm: " + vmInstance.getUuid()); + logger.info("Adding extra configuration to user VM: " + vmInstance.getUuid()); addExtraConfig(vmInstance, extraConfig); } else { throw new InvalidParameterValueException("attempted setting extraconfig but enable.additional.vm.configuration is disabled"); @@ -2951,7 +2951,7 @@ protected void validateGuestOsIdForUpdateVirtualMachineCommand(UpdateVMCmd cmd) private void saveUsageEvent(UserVmVO vm) { - // If vm not destroyed + // If VM not destroyed if( vm.getState() != State.Destroyed && vm.getState() != State.Expunging && vm.getState() != State.Error){ if(vm.isDisplayVm()){ @@ -3011,8 +3011,8 @@ public UserVm updateVirtualMachine(long id, String displayName, String group, Bo } if (vm.getState() == State.Error || vm.getState() == State.Expunging) { - logger.error("vm is not in the right state: " + id); - throw new InvalidParameterValueException("Vm with id " + id + " is not in the right state"); + logger.error("VM is not in the right state: " + id); + throw new InvalidParameterValueException("VM with id " + id + " is not in the right state"); } if (displayName == null) { @@ -3025,7 +3025,7 @@ public UserVm updateVirtualMachine(long id, String displayName, String group, Bo ServiceOffering offering = serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId()); if (!offering.isOfferHA() && ha) { - throw new InvalidParameterValueException("Can't enable ha for the vm as it's created from the Service offering having HA disabled"); + throw new InvalidParameterValueException("Can't enable ha for the VM as it's created from the Service offering having HA disabled"); } if (isDisplayVmEnabled == null) { @@ -3124,7 +3124,7 @@ public UserVm updateVirtualMachine(long id, String displayName, String group, Bo hostName = null; } - // Verify that vm's hostName is unique + // Verify that VM's hostName is unique List vmNtwks = new ArrayList(nics.size()); for (Nic nic : nics) { @@ -3162,7 +3162,7 @@ public UserVm updateVirtualMachine(long id, String displayName, String group, Bo protected void updateUserData(UserVm vm) throws ResourceUnavailableException, InsufficientCapacityException { boolean result = updateUserDataInternal(vm); if (result) { - logger.debug(String.format("User data successfully updated for vm id: %s", vm.getId())); + logger.debug(String.format("User data successfully updated for VM id: %s", vm.getId())); } else { throw new CloudRuntimeException("Failed to reset userdata for the virtual machine "); } @@ -3203,7 +3203,7 @@ private boolean updateUserDataInternal(UserVm vm) throws ResourceUnavailableExce List nics = _nicDao.listByVmId(vm.getId()); if (nics == null || nics.isEmpty()) { - logger.error("unable to find any nics for vm " + vm.getUuid()); + logger.error("unable to find any NICs for VM " + vm.getUuid()); return false; } @@ -3227,18 +3227,18 @@ protected boolean applyUserData(HypervisorType hyperVisorType, UserVm vm, Nic ni } boolean result = element.saveUserData(network, nicProfile, vmProfile); if (!result) { - logger.error("Failed to update userdata for vm " + vm + " and nic " + nic); + logger.error("Failed to update userdata for VM " + vm + " and NIC " + nic); } else { return true; } } else { - logger.debug("Not applying userdata for nic id=" + nic.getId() + " in vm id=" + vmProfile.getId() + " because it is not supported in network id=" + network.getId()); + logger.debug("Not applying userdata for NIC id=" + nic.getId() + " in VM id=" + vmProfile.getId() + " because it is not supported in network id=" + network.getId()); } return false; } @Override - @ActionEvent(eventType = EventTypes.EVENT_VM_START, eventDescription = "starting Vm", async = true) + @ActionEvent(eventType = EventTypes.EVENT_VM_START, eventDescription = "starting VM", async = true) public UserVm startVirtualMachine(StartVMCmd cmd) throws ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException { Map additonalParams = new HashMap<>(); if (cmd.getBootIntoSetup() != null) { @@ -3259,7 +3259,7 @@ public UserVm startVirtualMachine(StartVMCmd cmd) throws ExecutionException, Con } @Override - @ActionEvent(eventType = EventTypes.EVENT_VM_REBOOT, eventDescription = "rebooting Vm", async = true) + @ActionEvent(eventType = EventTypes.EVENT_VM_REBOOT, eventDescription = "rebooting VM", async = true) public UserVm rebootVirtualMachine(RebootVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ResourceAllocationException { Account caller = CallContext.current().getCallingAccount(); Long vmId = cmd.getId(); @@ -3287,7 +3287,7 @@ public UserVm rebootVirtualMachine(RebootVMCmd cmd) throws InsufficientCapacityE return restoreVMInternal(caller, vmInstance); } } else { - throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId + " corresponding to the vm"); + throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId + " corresponding to the VM"); } Boolean enterSetup = cmd.getBootIntoSetup(); @@ -3297,13 +3297,13 @@ public UserVm rebootVirtualMachine(RebootVMCmd cmd) throws InsufficientCapacityE UserVm userVm = rebootVirtualMachine(CallContext.current().getCallingUserId(), vmId, enterSetup == null ? false : cmd.getBootIntoSetup(), cmd.isForced()); if (userVm != null ) { - // update the vmIdCountMap if the vm is in advanced shared network with out services + // update the vmIdCountMap if the VM is in advanced shared network without services final List nics = _nicDao.listByVmId(vmId); for (NicVO nic : nics) { Network network = _networkModel.getNetwork(nic.getNetworkId()); if (_networkModel.isSharedNetworkWithoutServices(network.getId())) { - logger.debug("Adding vm " +vmId +" nic id "+ nic.getId() +" into vmIdCountMap as part of vm " + - "reboot for vm ip fetch "); + logger.debug("Adding VM " +vmId +" NIC id "+ nic.getId() +" into vmIdCountMap as part of VM " + + "reboot for VM IP fetch "); vmIdCountMap.put(nic.getId(), new VmAndCountDetails(nic.getInstanceId(), VmIpFetchTrialMax.value())); } } @@ -3313,7 +3313,7 @@ public UserVm rebootVirtualMachine(RebootVMCmd cmd) throws InsufficientCapacityE } @Override - @ActionEvent(eventType = EventTypes.EVENT_VM_DESTROY, eventDescription = "destroying Vm", async = true) + @ActionEvent(eventType = EventTypes.EVENT_VM_DESTROY, eventDescription = "destroying VM", async = true) public UserVm destroyVm(DestroyVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException { CallContext ctx = CallContext.current(); long vmId = cmd.getId(); @@ -3331,19 +3331,19 @@ public UserVm destroyVm(DestroyVMCmd cmd) throws ResourceUnavailableException, C } if (Arrays.asList(State.Destroyed, State.Expunging).contains(vm.getState()) && !expunge) { - logger.debug("Vm id=" + vmId + " is already destroyed"); + logger.debug("VM id=" + vmId + " is already destroyed"); return vm; } - // check if vm belongs to AutoScale vm group in Disabled state + // check if VM belongs to AutoScale VM group in Disabled state autoScaleManager.checkIfVmActionAllowed(vmId); // check if there are active volume snapshots tasks logger.debug("Checking if there are any ongoing snapshots on the ROOT volumes associated with VM with ID " + vmId); if (checkStatusOfVolumeSnapshots(vmId, Volume.Type.ROOT)) { - throw new CloudRuntimeException("There is/are unbacked up snapshot(s) on ROOT volume, vm destroy is not permitted, please try again later."); + throw new CloudRuntimeException("There is/are unbacked up snapshot(s) on ROOT volume, VM destroy is not permitted, please try again later."); } - logger.debug("Found no ongoing snapshots on volume of type ROOT, for the vm with id " + vmId); + logger.debug("Found no ongoing snapshots on volume of type ROOT, for the VM with id " + vmId); List volumesToBeDeleted = getVolumesFromIds(cmd); @@ -3361,7 +3361,7 @@ public UserVm destroyVm(DestroyVMCmd cmd) throws ResourceUnavailableException, C UserVm destroyedVm = destroyVm(vmId, expunge); if (expunge && !expunge(vm)) { - throw new CloudRuntimeException("Failed to expunge vm " + destroyedVm); + throw new CloudRuntimeException("Failed to expunge VM " + destroyedVm); } autoScaleManager.removeVmFromVmGroup(vmId); @@ -3411,7 +3411,7 @@ public InstanceGroupVO createVmGroup(CreateVMGroupCmd cmd) { boolean isNameInUse = _vmGroupDao.isNameInUse(accountId, groupName); if (isNameInUse) { - throw new InvalidParameterValueException("Unable to create vm group, a group with name " + groupName + " already exists for account " + accountId); + throw new InvalidParameterValueException("Unable to create VM group, a group with name " + groupName + " already exists for account " + accountId); } return createVmGroup(groupName, accountId); @@ -3423,7 +3423,7 @@ private InstanceGroupVO createVmGroup(String groupName, long accountId) { try { account = _accountDao.acquireInLockTable(accountId); // to ensure // duplicate - // vm group + // VM group // names are // not // created. @@ -3452,7 +3452,7 @@ public boolean deleteVmGroup(DeleteVMGroupCmd cmd) { // Verify input parameters InstanceGroupVO group = _vmGroupDao.findById(groupId); if ((group == null) || (group.getRemoved() != null)) { - throw new InvalidParameterValueException("unable to find a vm group with id " + groupId); + throw new InvalidParameterValueException("unable to find a VM group with id " + groupId); } _accountMgr.checkAccess(caller, null, true, group); @@ -3485,7 +3485,7 @@ public boolean addInstanceToGroup(final long userVmId, String groupName) { UserVmVO vm = _vmDao.findById(userVmId); InstanceGroupVO group = _vmGroupDao.findByAccountAndName(vm.getAccountId(), groupName); - // Create vm group if the group doesn't exist for this account + // Create VM group if the group doesn't exist for this account if (group == null) { group = createVmGroup(groupName, vm.getAccountId()); } @@ -3493,22 +3493,22 @@ public boolean addInstanceToGroup(final long userVmId, String groupName) { if (group != null) { UserVm userVm = _vmDao.acquireInLockTable(userVmId); if (userVm == null) { - logger.warn("Failed to acquire lock on user vm id=" + userVmId); + logger.warn("Failed to acquire lock on user VM id=" + userVmId); } try { final InstanceGroupVO groupFinal = group; Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(TransactionStatus status) { - // don't let the group be deleted when we are assigning vm to + // don't let the group be deleted when we are assigning VM to // it. InstanceGroupVO ngrpLock = _vmGroupDao.lockRow(groupFinal.getId(), false); if (ngrpLock == null) { - logger.warn("Failed to acquire lock on vm group id=" + groupFinal.getId() + " name=" + groupFinal.getName()); - throw new CloudRuntimeException("Failed to acquire lock on vm group id=" + groupFinal.getId() + " name=" + groupFinal.getName()); + logger.warn("Failed to acquire lock on VM group id=" + groupFinal.getId() + " name=" + groupFinal.getName()); + throw new CloudRuntimeException("Failed to acquire lock on VM group id=" + groupFinal.getId() + " name=" + groupFinal.getName()); } - // Currently don't allow to assign a vm to more than one group + // Currently don't allow to assign a VM to more than one group if (_groupVMMapDao.listByInstanceId(userVmId) != null) { // Delete all mappings from group_vm_map table List groupVmMaps = _groupVMMapDao.listByInstanceId(userVmId); @@ -3536,8 +3536,8 @@ public void doInTransactionWithoutResult(TransactionStatus status) { @Override public InstanceGroupVO getGroupForVm(long vmId) { - // TODO - in future releases vm can be assigned to multiple groups; but - // currently return just one group per vm + // TODO - in future releases VM can be assigned to multiple groups; but + // currently return just one group per VM try { List groupsToVmMap = _groupVMMapDao.listByInstanceId(vmId); @@ -3548,7 +3548,7 @@ public InstanceGroupVO getGroupForVm(long vmId) { return null; } } catch (Exception e) { - logger.warn("Error trying to get group for a vm: ", e); + logger.warn("Error trying to get group for a VM: ", e); return null; } } @@ -3563,7 +3563,7 @@ public void removeInstanceFromInstanceGroup(long vmId) { _groupVMMapDao.expunge(sc); } } catch (Exception e) { - logger.warn("Error trying to remove vm from group: ", e); + logger.warn("Error trying to remove VM from group: ", e); } } @@ -3580,7 +3580,7 @@ private boolean validPassword(String password) { } @Override - @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying Vm", create = true) + @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying VM", create = true) public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List sshKeyPairs, Map requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List affinityGroupIdList, @@ -3591,7 +3591,7 @@ public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOff Account caller = CallContext.current().getCallingAccount(); List networkList = new ArrayList(); - // Verify that caller can perform actions in behalf of vm owner + // Verify that caller can perform actions in behalf of VM owner _accountMgr.checkAccess(caller, null, true, owner); // Verify that owner can use the service offering @@ -3602,7 +3602,7 @@ public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOff Network defaultNetwork = _networkModel.getExclusiveGuestNetwork(zone.getId()); if (defaultNetwork == null) { - throw new InvalidParameterValueException("Unable to find a default network to start a vm"); + throw new InvalidParameterValueException("Unable to find a default network to start a VM"); } else { networkList.add(_networkDao.findById(defaultNetwork.getId())); } @@ -3639,7 +3639,7 @@ public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOff } @Override - @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying Vm", create = true) + @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying VM", create = true) public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List networkIdList, List securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List sshKeyPairs, Map requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, @@ -3651,7 +3651,7 @@ public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, Service boolean isSecurityGroupEnabledNetworkUsed = false; boolean isVmWare = (template.getHypervisorType() == HypervisorType.VMware || (hypervisor != null && hypervisor == HypervisorType.VMware)); - // Verify that caller can perform actions in behalf of vm owner + // Verify that caller can perform actions in behalf of VM owner _accountMgr.checkAccess(caller, null, true, owner); // Verify that owner can use the service offering @@ -3751,7 +3751,7 @@ public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, Service } @Override - @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying Vm", create = true) + @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying VM", create = true) public UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List networkIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List sshKeyPairs, Map requestedIps, IpAddresses defaultIps, Boolean displayvm, String keyboard, List affinityGroupIdList, @@ -3762,7 +3762,7 @@ public UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serv Account caller = CallContext.current().getCallingAccount(); List networkList = new ArrayList(); - // Verify that caller can perform actions in behalf of vm owner + // Verify that caller can perform actions in behalf of VM owner _accountMgr.checkAccess(caller, null, true, owner); // Verify that owner can use the service offering @@ -3785,11 +3785,11 @@ public UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serv // Only ISOs, XenServer, KVM, and VmWare template types are // supported for vpc networks if (template.getFormat() != ImageFormat.ISO && !vpcSupportedHTypes.contains(template.getHypervisorType())) { - throw new InvalidParameterValueException("Can't create vm from template with hypervisor " + template.getHypervisorType() + " in vpc network " + network); + throw new InvalidParameterValueException("Can't create VM from template with hypervisor " + template.getHypervisorType() + " in vpc network " + network); } else if (template.getFormat() == ImageFormat.ISO && !vpcSupportedHTypes.contains(hypervisor)) { // Only XenServer, KVM, and VMware hypervisors are supported // for vpc networks - throw new InvalidParameterValueException("Can't create vm of hypervisor type " + hypervisor + " in vpc network"); + throw new InvalidParameterValueException("Can't create VM of hypervisor type " + hypervisor + " in vpc network"); } } @@ -3811,7 +3811,7 @@ public UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serv } @Override - @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying Vm") + @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying VM") public UserVm finalizeCreateVirtualMachine(long vmId) { logger.info("Loading UserVm " + vmId + " from DB"); UserVm userVm = getUserVm(vmId); @@ -3833,11 +3833,11 @@ private NetworkVO getNetworkToAddToNetworkList(VirtualMachineTemplate template, // Only ISOs, XenServer, KVM, and VmWare template types are // supported for vpc networks if (template.getFormat() != ImageFormat.ISO && !vpcSupportedHTypes.contains(template.getHypervisorType())) { - throw new InvalidParameterValueException("Can't create vm from template with hypervisor " + template.getHypervisorType() + " in vpc network " + network); + throw new InvalidParameterValueException("Can't create VM from template with hypervisor " + template.getHypervisorType() + " in vpc network " + network); } else if (template.getFormat() == ImageFormat.ISO && !vpcSupportedHTypes.contains(hypervisor)) { // Only XenServer, KVM, and VMware hypervisors are supported // for vpc networks - throw new InvalidParameterValueException("Can't create vm of hypervisor type " + hypervisor + " in vpc network"); + throw new InvalidParameterValueException("Can't create VM of hypervisor type " + hypervisor + " in vpc network"); } } @@ -3846,7 +3846,7 @@ private NetworkVO getNetworkToAddToNetworkList(VirtualMachineTemplate template, // don't allow to use system networks NetworkOffering networkOffering = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId()); if (networkOffering.isSystemOnly()) { - throw new InvalidParameterValueException("Network id=" + networkId + " is system only and can't be used for vm deployment"); + throw new InvalidParameterValueException("Network id=" + networkId + " is system only and can't be used for VM deployment"); } return network; } @@ -3865,7 +3865,7 @@ private NetworkVO getDefaultNetwork(DataCenter zone, Account owner, boolean sele List requiredOfferings = _networkOfferingDao.listByAvailability(Availability.Required, false); if (requiredOfferings.size() < 1) { throw new InvalidParameterValueException("Unable to find network offering with availability=" + Availability.Required - + " to automatically create the network as a part of vm creation"); + + " to automatically create the network as a part of VM creation"); } if (requiredOfferings.get(0).getState() == NetworkOffering.State.Enabled) { @@ -3920,7 +3920,7 @@ private void verifyExtraDhcpOptionsNetwork(Map> dhc } if (!networkFound) { - throw new InvalidParameterValueException("VM does not has a nic in the Network (" + networkUuid + ") that is specified in the extra dhcp options."); + throw new InvalidParameterValueException("VM does not have a NIC in the Network (" + networkUuid + ") that is specified in the extra DHCP options."); } } } @@ -3928,7 +3928,7 @@ private void verifyExtraDhcpOptionsNetwork(Map> dhc public void checkNameForRFCCompliance(String name) { if (!NetUtils.verifyDomainNameLabel(name, true)) { - throw new InvalidParameterValueException("Invalid name. Vm name can contain ASCII letters 'a' through 'z', the digits '0' through '9', " + throw new InvalidParameterValueException("Invalid name. VM name can contain ASCII letters 'a' through 'z', the digits '0' through '9', " + "and the hyphen ('-'), must be between 1 and 63 characters long, and can't start or end with \"-\" and can't start with digit"); } } @@ -3945,7 +3945,7 @@ private UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffe _accountMgr.checkAccess(caller, null, true, owner); if (owner.getState() == Account.State.DISABLED) { - throw new PermissionDeniedException("The owner of vm to deploy is disabled: " + owner); + throw new PermissionDeniedException("The owner of VM to deploy is disabled: " + owner); } VMTemplateVO template = _templateDao.findById(tmplt.getId()); if (template != null) { @@ -3985,7 +3985,7 @@ private UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffe } // check that caller can operate with domain _configMgr.checkZoneAccess(caller, zone); - // check that vm owner can create vm in the domain + // check that VM owner can create VM in the domain _configMgr.checkZoneAccess(owner, zone); } @@ -3998,7 +3998,7 @@ private UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffe } else { validateOfferingMaxResource(offering); } - // check if account/domain is with in resource limits to create a new vm + // check if account/domain is with in resource limits to create a new VM boolean isIso = Storage.ImageFormat.ISO == template.getFormat(); Long rootDiskOfferingId = offering.getDiskOfferingId(); @@ -4177,15 +4177,15 @@ private UserVm getUncheckedUserVmResource(DataCenter zone, String hostName, Stri } if (hypervisorType != HypervisorType.BareMetal) { - // check if we have available pools for vm deployment + // check if we have available pools for VM deployment long availablePools = _storagePoolDao.countPoolsByStatus(StoragePoolStatus.Up); if (availablePools < 1) { - throw new StorageUnavailableException("There are no available pools in the UP state for vm deployment", -1); + throw new StorageUnavailableException("There are no available pools in the UP state for VM deployment", -1); } } if (template.getTemplateType().equals(TemplateType.SYSTEM) && !CKS_NODE.equals(vmType)) { - throw new InvalidParameterValueException("Unable to use system template " + template.getId() + " to deploy a user vm"); + throw new InvalidParameterValueException("Unable to use system template " + template.getId() + " to deploy a user VM"); } List listZoneTemplate = _templateZoneDao.listByZoneTemplate(zone.getId(), template.getId()); if (listZoneTemplate == null || listZoneTemplate.isEmpty()) { @@ -4292,18 +4292,18 @@ private UserVm getUncheckedUserVmResource(DataCenter zone, String hostName, Stri } if (securityGroupIdList != null && !securityGroupIdList.isEmpty() && !securityGroupEnabled) { - throw new InvalidParameterValueException("Unable to deploy vm with security groups as SecurityGroup service is not enabled for the vm's network"); + throw new InvalidParameterValueException("Unable to deploy VM with security groups as SecurityGroup service is not enabled for the VM's network"); } // Verify network information - network default network has to be set; - // and vm can't have more than one default network + // and VM can't have more than one default network // This is a part of business logic because default network is required // by Agent Manager in order to configure default - // gateway for the vm + // gateway for the VM if (defaultNetworkNumber == 0) { - throw new InvalidParameterValueException("At least 1 default network has to be specified for the vm"); + throw new InvalidParameterValueException("At least 1 default network has to be specified for the VM"); } else if (defaultNetworkNumber > 1) { - throw new InvalidParameterValueException("Only 1 default network per vm is supported"); + throw new InvalidParameterValueException("Only 1 default network per VM is supported"); } long id = _vmDao.getNextInSequence(Long.class, "id"); @@ -4387,11 +4387,11 @@ private void assignInstanceToGroup(String group, long id) { if (group != null) { boolean addToGroup = addInstanceToGroup(Long.valueOf(id), group); if (!addToGroup) { - throw new CloudRuntimeException("Unable to assign Vm to the group " + group); + throw new CloudRuntimeException("Unable to assign VM to the group " + group); } } } catch (Exception ex) { - throw new CloudRuntimeException("Unable to assign Vm to the group " + group); + throw new CloudRuntimeException("Unable to assign VM to the group " + group); } } @@ -4490,7 +4490,7 @@ private void checkIfHostNameUniqueInNtwkDomain(String hostName, List hostNames = _vmInstanceDao.listDistinctHostNames(ntwkId); // * verify that there are no duplicates if (hostNames.contains(hostName)) { - throw new InvalidParameterValueException("The vm with hostName " + hostName + " already exists in the network domain: " + ntwkDomain.getKey() + "; network=" + throw new InvalidParameterValueException("The VM with hostName " + hostName + " already exists in the network domain: " + ntwkDomain.getKey() + "; network=" + ((_networkModel.getNetwork(ntwkId) != null) ? _networkModel.getNetwork(ntwkId).getName() : "")); } } @@ -4612,7 +4612,7 @@ private UserVmVO commitUserVm(final boolean isImport, final DataCenter zone, fin } _vmDao.saveDetails(vm, hiddenDetails); if (!isImport) { - logger.debug("Allocating in the DB for vm"); + logger.debug("Allocating in the DB for VM"); DataCenterDeployment plan = new DataCenterDeployment(zone.getId()); List computeTags = new ArrayList(); @@ -4627,7 +4627,7 @@ private UserVmVO commitUserVm(final boolean isImport, final DataCenter zone, fin rootDiskOfferingId); } - CallContext.current().setEventDetails("Vm Id: " + vm.getUuid()); + CallContext.current().setEventDetails("VM Id: " + vm.getUuid()); if (!isImport) { if (!offering.isDynamic()) { @@ -4742,7 +4742,7 @@ private void updateVMDiskController(UserVmVO vm, Map customParam } /** - * take the properties and set them on the vm. + * take the properties and set them on the VM. * consider should we be complete, and make sure all default values are copied as well if known? * I.E. iterate over the template details as well to copy any that are not defined yet. */ @@ -4839,7 +4839,7 @@ public void collectVmNetworkStatistics (final UserVm userVm) { if (!userVm.getHypervisorType().equals(HypervisorType.KVM)) { return; } - logger.debug("Collect vm network statistics from host before stopping Vm"); + logger.debug("Collect VM network statistics from host before stopping VM"); long hostId = userVm.getHostId(); List vmNames = new ArrayList(); vmNames.add(userVm.getInstanceName()); @@ -4849,12 +4849,12 @@ public void collectVmNetworkStatistics (final UserVm userVm) { try { networkStatsAnswer = (GetVmNetworkStatsAnswer) _agentMgr.easySend(hostId, new GetVmNetworkStatsCommand(vmNames, host.getGuid(), host.getName())); } catch (Exception e) { - logger.warn("Error while collecting network stats for vm: " + userVm.getHostName() + " from host: " + host.getName(), e); + logger.warn("Error while collecting network stats for VM: " + userVm.getHostName() + " from host: " + host.getName(), e); return; } if (networkStatsAnswer != null) { if (!networkStatsAnswer.getResult()) { - logger.warn("Error while collecting network stats vm: " + userVm.getHostName() + " from host: " + host.getName() + "; details: " + networkStatsAnswer.getDetails()); + logger.warn("Error while collecting network stats VM: " + userVm.getHostName() + " from host: " + host.getName() + "; details: " + networkStatsAnswer.getDetails()); return; } try { @@ -4893,14 +4893,14 @@ public void doInTransactionWithoutResult(TransactionStatus status) { } if (vmNetworkStat_lock == null) { - logger.warn("unable to find vm network stats from host for account: " + userVm.getAccountId() + " with vmId: " + userVm.getId()+ " and nicId:" + nic.getId()); + logger.warn("unable to find VM network stats from host for account: " + userVm.getAccountId() + " with vmId: " + userVm.getId()+ " and nicId:" + nic.getId()); continue; } if (previousvmNetworkStats != null && ((previousvmNetworkStats.getCurrentBytesSent() != vmNetworkStat_lock.getCurrentBytesSent()) || (previousvmNetworkStats.getCurrentBytesReceived() != vmNetworkStat_lock.getCurrentBytesReceived()))) { - logger.debug("vm network stats changed from the time GetNmNetworkStatsCommand was sent. " + + logger.debug("VM network stats changed from the time GetNmNetworkStatsCommand was sent. " + "Ignoring current answer. Host: " + host.getName() + " . VM: " + vmNetworkStat.getVmName() + " Sent(Bytes): " + toHumanReadableSize(vmNetworkStat.getBytesSent()) + " Received(Bytes): " + toHumanReadableSize(vmNetworkStat.getBytesReceived())); continue; @@ -4937,7 +4937,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { } }); } catch (Exception e) { - logger.warn("Unable to update vm network statistics for vm: " + userVm.getId() + " from host: " + hostId, e); + logger.warn("Unable to update VM network statistics for VM: " + userVm.getId() + " from host: " + hostId, e); } } } @@ -4951,7 +4951,7 @@ public String validateUserData(String userData, HTTPMethod httpmethod) { try { userData = URLDecoder.decode(userData, "UTF-8"); } catch (UnsupportedEncodingException e) { - throw new InvalidParameterValueException("Url decoding of userdata failed."); + throw new InvalidParameterValueException("URL decoding of userdata failed."); } } @@ -4961,7 +4961,7 @@ public String validateUserData(String userData, HTTPMethod httpmethod) { // If GET, use 4K. If POST, support up to 1M. if (httpmethod.equals(HTTPMethod.GET)) { if (userData.length() >= MAX_HTTP_GET_LENGTH) { - throw new InvalidParameterValueException("User data is too long for an http GET request"); + throw new InvalidParameterValueException("User data is too long for an HTTP GET request"); } if (userData.length() > VM_USERDATA_MAX_LENGTH.value()) { throw new InvalidParameterValueException("User data has exceeded configurable max length : " + VM_USERDATA_MAX_LENGTH.value()); @@ -4972,7 +4972,7 @@ public String validateUserData(String userData, HTTPMethod httpmethod) { } } else if (httpmethod.equals(HTTPMethod.POST)) { if (userData.length() >= MAX_HTTP_POST_LENGTH) { - throw new InvalidParameterValueException("User data is too long for an http POST request"); + throw new InvalidParameterValueException("User data is too long for an HTTP POST request"); } if (userData.length() > VM_USERDATA_MAX_LENGTH.value()) { throw new InvalidParameterValueException("User data has exceeded configurable max length : " + VM_USERDATA_MAX_LENGTH.value()); @@ -4993,7 +4993,7 @@ public String validateUserData(String userData, HTTPMethod httpmethod) { } @Override - @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying Vm", async = true) + @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "deploying VM", async = true) public UserVm startVirtualMachine(DeployVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException { long vmId = cmd.getEntityId(); if (!cmd.getStartVm()) { @@ -5055,7 +5055,7 @@ private UserVm startVirtualMachine(long vmId, Long podId, Long clusterId, Long h } } catch (Exception e) { - logger.fatal("Unable to resize the data disk for vm " + vm.getDisplayName() + " due to " + e.getMessage(), e); + logger.fatal("Unable to resize the data disk for VM " + vm.getDisplayName() + " due to " + e.getMessage(), e); } } finally { @@ -5065,7 +5065,7 @@ private UserVm startVirtualMachine(long vmId, Long podId, Long clusterId, Long h // Check that the password was passed in and is valid VMTemplateVO template = _templateDao.findByIdIncludingRemoved(vm.getTemplateId()); if (template.isEnablePassword()) { - // this value is not being sent to the backend; need only for api + // this value is not being sent to the backend; need only for API // display purposes vm.setPassword((String)vmParamPair.second().get(VirtualMachineProfile.Param.VmPassword)); } @@ -5121,7 +5121,7 @@ public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, Depl if (CKS_NODE.equals(vm.getUserVmType())) { addUserVMCmdlineArgs(vm.getId(), profile, dest, buf); } - // add userdata info into vm profile + // add userdata info into VM profile Nic defaultNic = _networkModel.getDefaultNic(vm.getId()); if(defaultNic != null) { Network network = _networkModel.getNetwork(defaultNic.getNetworkId()); @@ -5152,7 +5152,7 @@ public boolean setupVmForPvlan(boolean add, Long hostId, NicProfile nic) { } String op = "add"; if (!add) { - // "delete" would remove all the rules(if using ovs) related to this vm + // "delete" would remove all the rules(if using ovs) related to this VM op = "delete"; } Network network = _networkDao.findById(nic.getNetworkId()); @@ -5287,17 +5287,17 @@ public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Command userVm.setPrivateIpAddress(guestNic.getIPv4Address()); _vmDao.update(userVm.getId(), userVm); - logger.info("Detected that ip changed in the answer, updated nic in the db with new ip " + returnedIp); + logger.info("Detected that IP changed in the answer, updated NIC in the db with new IP " + returnedIp); } } updateVncPasswordIfItHasChanged(originalVncPassword, returnedVncPassword, profile); - // get system ip and create static nat rule for the vm + // get system IP and create static nat rule for the VM try { _rulesMgr.getSystemIpAndEnableStaticNatForVm(profile.getVirtualMachine(), false); } catch (Exception ex) { - logger.warn("Failed to get system ip and enable static nat for the vm " + profile.getVirtualMachine() + " due to exception ", ex); + logger.warn("Failed to get system IP and enable static nat for the VM " + profile.getVirtualMachine() + " due to exception ", ex); return false; } @@ -5305,7 +5305,7 @@ public boolean finalizeStart(VirtualMachineProfile profile, long hostId, Command if (answer != null && answer instanceof RestoreVMSnapshotAnswer) { RestoreVMSnapshotAnswer restoreVMSnapshotAnswer = (RestoreVMSnapshotAnswer) answer; if (restoreVMSnapshotAnswer == null || !restoreVMSnapshotAnswer.getResult()) { - logger.warn("Unable to restore the vm snapshot from image file to the VM: " + restoreVMSnapshotAnswer.getDetails()); + logger.warn("Unable to restore the VM snapshot from image file to the VM: " + restoreVMSnapshotAnswer.getDetails()); } } @@ -5340,7 +5340,7 @@ public void finalizeExpunge(VirtualMachine vm) { } @Override - @ActionEvent(eventType = EventTypes.EVENT_VM_STOP, eventDescription = "stopping Vm", async = true) + @ActionEvent(eventType = EventTypes.EVENT_VM_STOP, eventDescription = "stopping VM", async = true) public UserVm stopVirtualMachine(long vmId, boolean forced) throws ConcurrentOperationException { // Input validation Account caller = CallContext.current().getCallingAccount(); @@ -5356,7 +5356,7 @@ public UserVm stopVirtualMachine(long vmId, boolean forced) throws ConcurrentOpe throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId); } - // check if vm belongs to AutoScale vm group in Disabled state + // check if VM belongs to AutoScale VM group in Disabled state autoScaleManager.checkIfVmActionAllowed(vmId); boolean status = false; @@ -5394,7 +5394,7 @@ public void finalizeStop(VirtualMachineProfile profile, Answer answer) { assert (offering.isAssociatePublicIP() == true) : "User VM should not have system owned public IP associated with it when offering configured not to associate public IP."; _rulesMgr.disableStaticNat(ip.getId(), ctx.getCallingAccount(), ctx.getCallingUserId(), true); } catch (Exception ex) { - logger.warn("Failed to disable static nat and release system ip " + ip + " as a part of vm " + profile.getVirtualMachine() + " stop due to exception ", ex); + logger.warn("Failed to disable static nat and release system IP " + ip + " as a part of VM " + profile.getVirtualMachine() + " stop due to exception ", ex); } } @@ -5459,16 +5459,16 @@ public Pair> startVirtualMach } VMTemplateVO template = _templateDao.findByIdIncludingRemoved(vm.getTemplateId()); if (VirtualMachineManager.ResourceCountRunningVMsonly.value()) { - // check if account/domain is with in resource limits to start a new vm + // check if account/domain is with in resource limits to start a new VM ServiceOfferingVO offering = serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId()); resourceLimitService.checkVmResourceLimit(owner, vm.isDisplayVm(), offering, template); } - // check if vm is security group enabled + // check if VM is security group enabled if (_securityGroupMgr.isVmSecurityGroupEnabled(vmId) && _securityGroupMgr.getSecurityGroupsForVm(vmId).isEmpty() && !_securityGroupMgr.isVmMappedToDefaultSecurityGroup(vmId) && _networkModel.canAddDefaultSecurityGroup()) { - // if vm is not mapped to security group, create a mapping + // if VM is not mapped to security group, create a mapping if (logger.isDebugEnabled()) { - logger.debug("Vm " + vm + " is security group enabled, but not mapped to default security group; creating the mapping automatically"); + logger.debug("VM " + vm + " is security group enabled, but not mapped to default security group; creating the mapping automatically"); } SecurityGroup defaultSecurityGroup = _securityGroupMgr.getDefaultSecurityGroup(vm.getAccountId()); @@ -5529,7 +5529,7 @@ public Pair> startVirtualMach } // Check if an SSH key pair was selected for the instance and if so - // use it to encrypt & save the vm password + // use it to encrypt & save the VM password encryptAndStorePassword(vm, password); params = createParameterInParameterMap(params, additionalParams, VirtualMachineProfile.Param.VmPassword, password); @@ -5564,7 +5564,7 @@ public Pair> startVirtualMach Pair> vmParamPair = new Pair(vm, params); if (vm != null && vm.isUpdateParameters()) { - // this value is not being sent to the backend; need only for api + // this value is not being sent to the backend; need only for API // display purposes if (template.isEnablePassword()) { if (vm.getDetail(VmDetailConstants.PASSWORD) != null) { @@ -5686,7 +5686,7 @@ public UserVm destroyVm(long vmId, boolean expunge) throws ResourceUnavailableEx } if (vm.getState() == State.Destroyed || vm.getState() == State.Expunging) { - logger.trace("Vm id=" + vmId + " is already destroyed"); + logger.trace("VM id=" + vmId + " is already destroyed"); return vm; } @@ -5730,12 +5730,12 @@ public UserVm destroyVm(long vmId, boolean expunge) throws ResourceUnavailableEx } return _vmDao.findById(vmId); } else { - CloudRuntimeException ex = new CloudRuntimeException("Failed to destroy vm with specified vmId"); + CloudRuntimeException ex = new CloudRuntimeException("Failed to destroy VM with specified vmId"); ex.addProxyObject(vm.getUuid(), "vmId"); throw ex; } } catch (Exception e) { - throw new CloudRuntimeException("Failed to destroy vm with specified vmId", e); + throw new CloudRuntimeException("Failed to destroy VM with specified vmId", e); } } @@ -5746,9 +5746,9 @@ public void collectVmDiskStatistics(final UserVm userVm) { if (!(userVm.getHypervisorType().equals(HypervisorType.KVM) || userVm.getHypervisorType().equals(HypervisorType.VMware))) { return; } - logger.debug("Collect vm disk statistics from host before stopping VM"); + logger.debug("Collect VM disk statistics from host before stopping VM"); if (userVm.getHostId() == null) { - logger.error("Unable to collect vm disk statistics for VM as the host is null, skipping VM disk statistics collection"); + logger.error("Unable to collect VM disk statistics for VM as the host is null, skipping VM disk statistics collection"); return; } long hostId = userVm.getHostId(); @@ -5760,12 +5760,12 @@ public void collectVmDiskStatistics(final UserVm userVm) { try { diskStatsAnswer = (GetVmDiskStatsAnswer)_agentMgr.easySend(hostId, new GetVmDiskStatsCommand(vmNames, host.getGuid(), host.getName())); } catch (Exception e) { - logger.warn("Error while collecting disk stats for vm: " + userVm.getInstanceName() + " from host: " + host.getName(), e); + logger.warn("Error while collecting disk stats for VM: " + userVm.getInstanceName() + " from host: " + host.getName(), e); return; } if (diskStatsAnswer != null) { if (!diskStatsAnswer.getResult()) { - logger.warn("Error while collecting disk stats vm: " + userVm.getInstanceName() + " from host: " + host.getName() + "; details: " + diskStatsAnswer.getDetails()); + logger.warn("Error while collecting disk stats VM: " + userVm.getInstanceName() + " from host: " + host.getName() + "; details: " + diskStatsAnswer.getDetails()); return; } try { @@ -5809,7 +5809,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { .getCurrentIOWrite()) || (previousVmDiskStats.getCurrentBytesRead() != vmDiskStat_lock.getCurrentBytesRead()) || (previousVmDiskStats .getCurrentBytesWrite() != vmDiskStat_lock.getCurrentBytesWrite())))) { - logger.debug("vm disk stats changed from the time GetVmDiskStatsCommand was sent. " + "Ignoring current answer. Host: " + host.getName() + logger.debug("VM disk stats changed from the time GetVmDiskStatsCommand was sent. " + "Ignoring current answer. Host: " + host.getName() + " . VM: " + vmDiskStat.getVmName() + " IO Read: " + vmDiskStat.getIORead() + " IO Write: " + vmDiskStat.getIOWrite() + " Bytes Read: " + vmDiskStat.getBytesRead() + " Bytes Write: " + vmDiskStat.getBytesWrite()); continue; @@ -5868,7 +5868,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { } @Override - @ActionEvent(eventType = EventTypes.EVENT_VM_EXPUNGE, eventDescription = "expunging Vm", async = true) + @ActionEvent(eventType = EventTypes.EVENT_VM_EXPUNGE, eventDescription = "expunging VM", async = true) public UserVm expungeVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException { Account caller = CallContext.current().getCallingAccount(); Long callerId = caller.getId(); @@ -5882,22 +5882,22 @@ public UserVm expungeVm(long vmId) throws ResourceUnavailableException, Concurre } if (vm.getRemoved() != null) { - logger.trace("Vm id=" + vmId + " is already expunged"); + logger.trace("VM id=" + vmId + " is already expunged"); return vm; } if (!(vm.getState() == State.Destroyed || vm.getState() == State.Expunging || vm.getState() == State.Error)) { - CloudRuntimeException ex = new CloudRuntimeException("Please destroy vm with specified vmId before expunge"); + CloudRuntimeException ex = new CloudRuntimeException("Please destroy VM with specified vmId before expunge"); ex.addProxyObject(String.valueOf(vmId), "vmId"); throw ex; } // When trying to expunge, permission is denied when the caller is not an admin and the AllowUserExpungeRecoverVm is false for the caller. if (!_accountMgr.isAdmin(callerId) && !AllowUserExpungeRecoverVm.valueIn(callerId)) { - throw new PermissionDeniedException("Expunging a vm can only be done by an Admin. Or when the allow.user.expunge.recover.vm key is set."); + throw new PermissionDeniedException("Expunging a VM can only be done by an Admin. Or when the allow.user.expunge.recover.vm key is set."); } - // check if vm belongs to AutoScale vm group in Disabled state + // check if VM belongs to AutoScale VM group in Disabled state autoScaleManager.checkIfVmActionAllowed(vmId); _vmSnapshotMgr.deleteVMSnapshotsFromDB(vmId, false); @@ -5908,7 +5908,7 @@ public UserVm expungeVm(long vmId) throws ResourceUnavailableException, Concurre if (status) { return _vmDao.findByIdIncludingRemoved(vmId); } else { - CloudRuntimeException ex = new CloudRuntimeException("Failed to expunge vm with specified vmId"); + CloudRuntimeException ex = new CloudRuntimeException("Failed to expunge VM with specified vmId"); ex.addProxyObject(String.valueOf(vmId), "vmId"); throw ex; } @@ -6133,7 +6133,7 @@ public UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityE } else { if (cmd.getSecurityGroupIdList() != null && !cmd.getSecurityGroupIdList().isEmpty()) { - throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone"); + throw new InvalidParameterValueException("Can't create VM with security groups; security group feature is not enabled per zone"); } vm = createAdvancedVirtualMachine(zone, serviceOffering, template, networkIds, owner, name, displayName, diskOfferingId, size, group, cmd.getHypervisor(), cmd.getHttpMethod(), userData, userDataId, userDataDetails, sshKeyPairNames, cmd.getIpToNetworkMap(), addrs, displayVm, keyboard, cmd.getAffinityGroupIdList(), cmd.getDetails(), @@ -6157,7 +6157,7 @@ public UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityE String extraConfig = cmd.getExtraConfig(); if (StringUtils.isNotBlank(extraConfig)) { if (EnableAdditionalVmConfig.valueIn(callerId)) { - logger.info("Adding extra configuration to user vm: " + vm.getUuid()); + logger.info("Adding extra configuration to user VM: " + vm.getUuid()); addExtraConfig(vm, extraConfig); } else { throw new InvalidParameterValueException("attempted setting extraconfig but enable.additional.vm.configuration is disabled"); @@ -6204,10 +6204,10 @@ protected void persistExtraConfigVmware(String decodedUrl, UserVm vm) { /** * Used to persist extra configuration settings in user_vm_details table for the XenServer hypervisor - * persists config as key/value pair e.g key = extraconfig-1 , value="PV-bootloader=pygrub" and so on to extraconfig-N where + * persists config as key/value pair e.g. key = extraconfig-1 , value="PV-bootloader=pygrub" and so on to extraconfig-N where * N denotes the number of extra configuration settings passed by user * - * @param decodedUrl A string containing extra configuration settings as key/value pairs seprated by newline escape character + * @param decodedUrl A string containing extra configuration settings as key/value pairs separated by newline escape character * e.x PV-bootloader=pygrub\nPV-args=console\nHV-Boot-policy="" */ protected void persistExtraConfigXenServer(String decodedUrl, UserVm vm) { @@ -6531,7 +6531,7 @@ private VMInstanceVO preVmStorageMigrationCheck(Long vmId) { + " hypervisors: [%s].", hypervisorType, HYPERVISORS_THAT_CAN_DO_STORAGE_MIGRATION_ON_NON_USER_VMS)); } - // Check that Vm does not have VM Snapshots + // Check that VM does not have VM Snapshots if (_vmSnapshotDao.findByVm(vmId).size() > 0) { throw new InvalidParameterValueException("VM's disk cannot be migrated, please remove all the VM Snapshots for this VM"); } @@ -6632,7 +6632,7 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) thr // business logic if (vm.getState() != State.Running) { if (logger.isDebugEnabled()) { - logger.debug("VM is not Running, unable to migrate the vm " + vm); + logger.debug("VM is not Running, unable to migrate the VM " + vm); } InvalidParameterValueException ex = new InvalidParameterValueException("VM is not Running, unable to migrate the vm with specified id"); ex.addProxyObject(vm.getUuid(), "vmId"); @@ -6698,7 +6698,7 @@ private DeployDestination chooseVmMigrationDestination(VMInstanceVO vm, Host src logger.warn("Unable to create deployment, affinity rules associated to the VM conflict", e2); throw new CloudRuntimeException("Unable to create deployment, affinity rules associated to the VM conflict"); } catch (final InsufficientServerCapacityException e3) { - throw new CloudRuntimeException("Unable to find a server to migrate the vm to"); + throw new CloudRuntimeException("Unable to find a server to migrate the VM to"); } } @@ -6735,7 +6735,7 @@ private DeployDestination checkVmMigrationDestination(VMInstanceVO vm, Host srcH Cluster cluster = _clusterDao.findById(destinationHost.getClusterId()); DeployDestination dest = new DeployDestination(dcVO, pod, cluster, destinationHost); - // check max guest vm limit for the destinationHost + // check max guest VM limit for the destinationHost HostVO destinationHostVO = _hostDao.findById(destinationHost.getId()); if (_capacityMgr.checkIfHostReachMaxGuestLimit(destinationHostVO)) { if (logger.isDebugEnabled()) { @@ -6751,7 +6751,7 @@ private DeployDestination checkVmMigrationDestination(VMInstanceVO vm, Host srcH if (checkStatusOfVolumeSnapshots(vmId, null)) { throw new CloudRuntimeException("There is/are unbacked up snapshot(s) on volume(s) attached to this VM, VM Migration is not permitted, please try again later."); } - logger.debug("Found no ongoing snapshots on volumes associated with the vm with id " + vmId); + logger.debug("Found no ongoing snapshots on volumes associated with the VM with id " + vmId); return dest; } @@ -6865,7 +6865,7 @@ public void checkHostsDedication(VMInstanceVO vm, long srcHostId, long destHostI //VM is deployed using implicit planner long accountOfVm = vm.getAccountId(); String msg = "VM of account " + accountOfVm + " with implicit deployment planner being migrated to host " + destHost.getName(); - //Get all vms on destination host + //Get all VMs on destination host boolean emptyDestination = false; List vmsOnDest = getVmsOnHost(destHostId); if (vmsOnDest == null || vmsOnDest.isEmpty()) { @@ -6873,20 +6873,20 @@ public void checkHostsDedication(VMInstanceVO vm, long srcHostId, long destHostI } if (!emptyDestination) { - //Check if vm is deployed using strict implicit planner + //Check if VM is deployed using strict implicit planner if (!isServiceOfferingUsingPlannerInPreferredMode(vm.getServiceOfferingId())) { - //Check if all vms on destination host are created using strict implicit mode + //Check if all VMs on destination host are created using strict implicit mode if (!checkIfAllVmsCreatedInStrictMode(accountOfVm, vmsOnDest)) { msg = "VM of account " + accountOfVm + " with strict implicit deployment planner being migrated to host " + destHost.getName() + " not having all vms strict implicitly dedicated to account " + accountOfVm; } } else { - //If vm is deployed using preferred implicit planner, check if all vms on destination host must be + //If VM is deployed using preferred implicit planner, check if all VMs on destination host must be //using implicit planner and must belong to same account for (VMInstanceVO vmsDest : vmsOnDest) { ServiceOfferingVO destPlanner = serviceOfferingDao.findById(vm.getId(), vmsDest.getServiceOfferingId()); if (!((destPlanner.getDeploymentPlanner() != null && destPlanner.getDeploymentPlanner().equals("ImplicitDedicationPlanner")) && vmsDest.getAccountId() == accountOfVm)) { - msg = "VM of account " + accountOfVm + " with preffered implicit deployment planner being migrated to host " + destHost.getName() + msg = "VM of account " + accountOfVm + " with preferred implicit deployment planner being migrated to host " + destHost.getName() + " not having all vms implicitly dedicated to account " + accountOfVm; } } @@ -7082,7 +7082,7 @@ private Pair getHostsForMigrateVmWithStorage(VMInstanceVO vm, Host d destinationHost.getName(), destinationHost.getUuid(), destinationHost.getState(), destinationHost.getResourceState())); } - // Check max guest vm limit for the destinationHost. + // Check max guest VM limit for the destinationHost. if (_capacityMgr.checkIfHostReachMaxGuestLimit(destinationHost)) { throw new VirtualMachineMigrationException(String.format("Cannot migrate VM as destination host %s (ID: %s) already has max running vms (count includes system VMs)", destinationHost.getName(), destinationHost.getUuid())); @@ -7119,7 +7119,7 @@ private Map getVolumePoolMappingForMigrateVmWithStorage(VMInstanceVO throw new InvalidParameterValueException("Cannot migrate volume " + volume + "to the destination storage pool " + pool.getName() + " as the storage pool is in maintenance mode."); } else { - // Verify the volume given belongs to the vm. + // Verify the volume given belongs to the VM. if (!vmVolumes.contains(volume)) { throw new InvalidParameterValueException(String.format("Volume " + volume + " doesn't belong to the VM %s (ID: %s) that has to be migrated", vm.getInstanceName(), vm.getUuid())); } @@ -7294,13 +7294,13 @@ public UserVm moveVMToUser(final AssignVMCmd cmd) throws ResourceAllocationExcep // get and check the valid VM final UserVmVO vm = _vmDao.findById(cmd.getVmId()); if (vm == null) { - throw new InvalidParameterValueException("There is no vm by that id " + cmd.getVmId()); + throw new InvalidParameterValueException("There is no VM by that id " + cmd.getVmId()); } else if (vm.getState() == State.Running) { // VV 3: check if vm is // running if (logger.isDebugEnabled()) { - logger.debug("VM is Running, unable to move the vm " + vm); + logger.debug("VM is Running, unable to move the VM " + vm); } - InvalidParameterValueException ex = new InvalidParameterValueException("VM is Running, unable to move the vm with specified vmId"); + InvalidParameterValueException ex = new InvalidParameterValueException("VM is Running, unable to move the VM with specified vmId"); ex.addProxyObject(vm.getUuid(), "vmId"); throw ex; } @@ -7331,8 +7331,8 @@ public UserVm moveVMToUser(final AssignVMCmd cmd) throws ResourceAllocationExcep throw new InvalidParameterValueException("The new account is the same as the old account. Account id =" + oldAccount.getAccountId()); } - // don't allow to move the vm if there are existing PF/LB/Static Nat - // rules, or vm is assigned to static Nat ip + // don't allow to move the VM if there are existing PF/LB/Static Nat + // rules, or VM is assigned to static Nat IP List pfrules = _portForwardingDao.listByVm(cmd.getVmId()); if (pfrules != null && pfrules.size() > 0) { throw new InvalidParameterValueException("Remove the Port forwarding rules for this VM before assigning to another user."); @@ -7349,7 +7349,7 @@ public UserVm moveVMToUser(final AssignVMCmd cmd) throws ResourceAllocationExcep List ips = _ipAddressDao.findAllByAssociatedVmId(cmd.getVmId()); for (IPAddressVO ip : ips) { if (ip.isOneToOneNat()) { - throw new InvalidParameterValueException("Remove the one to one nat rule for this VM for ip " + ip.toString()); + throw new InvalidParameterValueException("Remove the one to one nat rule for this VM for IP " + ip.toString()); } } @@ -7380,7 +7380,7 @@ public UserVm moveVMToUser(final AssignVMCmd cmd) throws ResourceAllocationExcep // VV 3: check if volumes and primary storage space are with in resource limits checkVolumesLimits(newAccount, volumes); - // VV 4: Check if new owner can use the vm template + // VV 4: Check if new owner can use the VM template if (template == null) { throw new InvalidParameterValueException(String.format("Template for VM: %s cannot be found", vm.getUuid())); } @@ -7389,21 +7389,21 @@ public UserVm moveVMToUser(final AssignVMCmd cmd) throws ResourceAllocationExcep _accountMgr.checkAccess(newAccount, null, true, templateOwner); } - // VV 5: check the new account can create vm in the domain + // VV 5: check the new account can create VM in the domain DomainVO domain = _domainDao.findById(cmd.getDomainId()); _accountMgr.checkAccess(newAccount, domain); Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(TransactionStatus status) { - //generate destroy vm event for usage + //generate destroy VM event for usage UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_DESTROY, vm.getAccountId(), vm.getDataCenterId(), vm.getId(), vm.getHostName(), vm.getServiceOfferingId(), vm.getTemplateId(), vm.getHypervisorType().toString(), VirtualMachine.class.getName(), vm.getUuid(), vm.isDisplayVm()); // update resource counts for old account resourceCountDecrement(oldAccount.getAccountId(), vm.isDisplayVm(), offering, template); - // OWNERSHIP STEP 1: update the vm owner + // OWNERSHIP STEP 1: update the VM owner vm.setAccountId(newAccount.getAccountId()); vm.setDomainId(cmd.getDomainId()); _vmDao.persist(vm); @@ -7457,7 +7457,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { Network defaultNetwork = _networkModel.getExclusiveGuestNetwork(zone.getId()); if (defaultNetwork == null) { - throw new InvalidParameterValueException("Unable to find a default network to start a vm"); + throw new InvalidParameterValueException("Unable to find a default network to start a VM"); } else { networkList.add(_networkDao.findById(defaultNetwork.getId())); } @@ -7526,7 +7526,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { applicableNetworks.add(defaultNetworkOld); requestedIPv4ForNics.put(defaultNetworkOld.getId(), defaultNicOld.getIPv4Address()); requestedIPv6ForNics.put(defaultNetworkOld.getId(), defaultNicOld.getIPv6Address()); - logger.debug("AssignVM: use old shared network " + defaultNetworkOld.getName() + " with old ip " + defaultNicOld.getIPv4Address() + " on default nic of vm:" + vm.getInstanceName()); + logger.debug("AssignVM: use old shared network " + defaultNetworkOld.getName() + " with old ip " + defaultNicOld.getIPv4Address() + " on default NIC of VM:" + vm.getInstanceName()); } } } @@ -7558,7 +7558,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { if (nicOld != null) { requestedIPv4ForNics.put(network.getId(), nicOld.getIPv4Address()); requestedIPv6ForNics.put(network.getId(), nicOld.getIPv6Address()); - logger.debug("AssignVM: use old shared network " + network.getName() + " with old ip " + nicOld.getIPv4Address() + " on nic of vm:" + vm.getInstanceName()); + logger.debug("AssignVM: use old shared network " + network.getName() + " with old ip " + nicOld.getIPv4Address() + " on NIC of VM:" + vm.getInstanceName()); } } logger.debug("AssignVM: Added network " + network.getName() + " to vm " + vm.getId()); @@ -7570,7 +7570,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { _networkMgr.cleanupNics(vmOldProfile); _networkMgr.removeNics(vmOldProfile); - // add the new nics + // add the new NICs LinkedHashMap> networks = new LinkedHashMap>(); int toggle = 0; NetworkVO defaultNetwork = null; @@ -7631,7 +7631,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmi); if (applicableNetworks.isEmpty()) { - throw new InvalidParameterValueException("No network is specified, please specify one when you move the vm. For now, please add a network to VM on NICs tab."); + throw new InvalidParameterValueException("No network is specified, please specify one when you move the VM. For now, please add a network to VM on NICs tab."); } else { _networkMgr.allocate(vmProfile, networks, null); } @@ -7644,7 +7644,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { } else { if (securityGroupIdList != null && !securityGroupIdList.isEmpty()) { - throw new InvalidParameterValueException("Can't move vm with security groups; security group feature is not enabled in this zone"); + throw new InvalidParameterValueException("Can't move VM with security groups; security group feature is not enabled in this zone"); } // if networkIdList is null and the first network of vm is shared network, then keep it if possible if (networkIdList == null || networkIdList.isEmpty()) { @@ -7655,7 +7655,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { applicableNetworks.add(defaultNetworkOld); requestedIPv4ForNics.put(defaultNetworkOld.getId(), defaultNicOld.getIPv4Address()); requestedIPv6ForNics.put(defaultNetworkOld.getId(), defaultNicOld.getIPv6Address()); - logger.debug("AssignVM: use old shared network " + defaultNetworkOld.getName() + " with old ip " + defaultNicOld.getIPv4Address() + " on default nic of vm:" + vm.getInstanceName()); + logger.debug("AssignVM: use old shared network " + defaultNetworkOld.getName() + " with old IP " + defaultNicOld.getIPv4Address() + " on default NIC of VM:" + vm.getInstanceName()); } } } @@ -7685,10 +7685,10 @@ public void doInTransactionWithoutResult(TransactionStatus status) { if (nicOld != null) { requestedIPv4ForNics.put(network.getId(), nicOld.getIPv4Address()); requestedIPv6ForNics.put(network.getId(), nicOld.getIPv6Address()); - logger.debug("AssignVM: use old shared network " + network.getName() + " with old ip " + nicOld.getIPv4Address() + " on nic of vm:" + vm.getInstanceName()); + logger.debug("AssignVM: use old shared network " + network.getName() + " with old ip " + nicOld.getIPv4Address() + " on NIC of VM:" + vm.getInstanceName()); } } - logger.debug("AssignVM: Added network " + network.getName() + " to vm " + vm.getId()); + logger.debug("AssignVM: Added network " + network.getName() + " to VM " + vm.getId()); applicableNetworks.add(network); } } else if (applicableNetworks.isEmpty()) { @@ -7775,7 +7775,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { logger.debug("AssignVM: Advance virtual, adding networks no " + networks.size() + " to " + vm.getInstanceName()); } // END IF NON SEC GRP ENABLED } // END IF ADVANCED - logger.info("AssignVM: vm " + vm.getInstanceName() + " now belongs to account " + newAccount.getAccountName()); + logger.info("AssignVM: VM " + vm.getInstanceName() + " now belongs to account " + newAccount.getAccountName()); return vm; } @@ -7859,7 +7859,7 @@ public UserVm restoreVM(RestoreVMCmd cmd) throws InsufficientCapacityException, if (checkStatusOfVolumeSnapshots(vmId, Volume.Type.ROOT)) { throw new CloudRuntimeException("There is/are unbacked up snapshot(s) on ROOT volume, Re-install VM is not permitted, please try again later."); } - logger.debug("Found no ongoing snapshots on volume of type ROOT, for the vm with id " + vmId); + logger.debug("Found no ongoing snapshots on volume of type ROOT, for the VM with id " + vmId); return restoreVMInternal(caller, vm, newTemplateId, rootDiskOfferingId, expunge, details); } @@ -7879,7 +7879,7 @@ private VMTemplateVO getRestoreVirtualMachineTemplate(Account caller, Long newTe Long templateId = root.getTemplateId(); boolean isISO = false; if (templateId == null) { - // Assuming that for a vm deployed using ISO, template ID is set to NULL + // Assuming that for a VM deployed using ISO, template ID is set to NULL isISO = true; templateId = vm.getIsoId(); } @@ -7933,7 +7933,7 @@ public UserVm restoreVirtualMachine(final Account caller, final long vmId, final } if (vm.getState() != VirtualMachine.State.Running && vm.getState() != VirtualMachine.State.Stopped) { - throw new CloudRuntimeException("Vm " + vm.getUuid() + " currently in " + vm.getState() + " state, restore vm can only execute when VM in Running or Stopped"); + throw new CloudRuntimeException("VM " + vm.getUuid() + " currently in " + vm.getState() + " state, restore vm can only execute when VM in Running or Stopped"); } if (vm.getState() == VirtualMachine.State.Running) { @@ -7972,8 +7972,8 @@ public UserVm restoreVirtualMachine(final Account caller, final long vmId, final try { _itMgr.stop(vm.getUuid()); } catch (ResourceUnavailableException e) { - logger.debug("Stop vm " + vm.getUuid() + " failed", e); - CloudRuntimeException ex = new CloudRuntimeException("Stop vm failed for specified vmId"); + logger.debug("Stop VM " + vm.getUuid() + " failed", e); + CloudRuntimeException ex = new CloudRuntimeException("Stop VM failed for specified vmId"); ex.addProxyObject(vm.getUuid(), "vmId"); throw ex; } @@ -7989,7 +7989,7 @@ public Pair doInTransaction(final TransactionStatus status) th Long templateId = root.getTemplateId(); boolean isISO = false; if (templateId == null) { - // Assuming that for a vm deployed using ISO, template ID is set to NULL + // Assuming that for a VM deployed using ISO, template ID is set to NULL isISO = true; templateId = userVm.getIsoId(); } @@ -8016,7 +8016,7 @@ public Pair doInTransaction(final TransactionStatus status) th getRootVolumeSizeForVmRestore(newVol, template, userVm, diskOffering, details, true); volumeMgr.saveVolumeDetails(newVol.getDiskOfferingId(), newVol.getId()); - // 1. Save usage event and update resource count for user vm volumes + // 1. Save usage event and update resource count for user VM volumes try { _resourceLimitMgr.incrementVolumeResourceCount(userVm.getAccountId(), newVol.isDisplay(), newVol.getSize(), diskOffering != null ? diskOffering : _diskOfferingDao.findById(newVol.getDiskOfferingId())); @@ -8087,7 +8087,7 @@ public Pair doInTransaction(final TransactionStatus status) th _itMgr.start(vm.getUuid(), params); vm = _vmDao.findById(vmId); if (template.isEnablePassword()) { - // this value is not being sent to the backend; need only for api + // this value is not being sent to the backend; need only for API // display purposes vm.setPassword(password); if (vm.isUpdateParameters()) { @@ -8215,12 +8215,12 @@ private void checkRestoreVmFromTemplate(UserVmVO vm, VMTemplateVO template, List if (!template.isDirectDownload()) { tmplStore = _templateStoreDao.findByTemplateZoneReady(template.getId(), vm.getDataCenterId()); if (tmplStore == null) { - throw new InvalidParameterValueException("Cannot restore the vm as the template " + template.getUuid() + " isn't available in the zone"); + throw new InvalidParameterValueException("Cannot restore the VM as the template " + template.getUuid() + " isn't available in the zone"); } } else { tmplStore = _templateStoreDao.findByTemplate(template.getId(), DataStoreRole.Image); if (tmplStore == null || (tmplStore != null && !tmplStore.getDownloadState().equals(VMTemplateStorageResourceAssoc.Status.BYPASSED))) { - throw new InvalidParameterValueException("Cannot restore the vm as the bypassed template " + template.getUuid() + " isn't available in the zone"); + throw new InvalidParameterValueException("Cannot restore the VM as the bypassed template " + template.getUuid() + " isn't available in the zone"); } } @@ -8311,7 +8311,7 @@ else if (host.getHypervisorType() == HypervisorType.KVM) { if (!cmds.isSuccessful()) { for (Answer answer : cmds.getAnswers()) { if (!answer.getResult()) { - logger.warn("Failed to reset vm due to: " + answer.getDetails()); + logger.warn("Failed to reset VM due to: " + answer.getDetails()); throw new CloudRuntimeException("Unable to reset " + vm + " due to " + answer.getDetails()); } @@ -8384,7 +8384,7 @@ private void encryptAndStorePassword(UserVmVO vm, String password) { String sshPublicKeys = vm.getDetail(VmDetailConstants.SSH_PUBLIC_KEY); if (sshPublicKeys != null && !sshPublicKeys.equals("") && password != null && !password.equals("saved_password")) { if (!sshPublicKeys.startsWith("ssh-rsa")) { - logger.warn("Only RSA public keys can be used to encrypt a vm password."); + logger.warn("Only RSA public keys can be used to encrypt a VM password."); return; } String encryptedPasswd = RSAHelper.encryptWithSSHPublicKey(sshPublicKeys, password); @@ -8404,7 +8404,7 @@ public void persistDeviceBusInfo(UserVmVO vm, String rootDiskController) { vm.setDetail(VmDetailConstants.ROOT_DISK_CONTROLLER, rootDiskController); _vmDao.saveDetails(vm); if (logger.isDebugEnabled()) { - logger.debug("Persisted device bus information rootDiskController=" + rootDiskController + " for vm: " + vm.getDisplayName()); + logger.debug("Persisted device bus information rootDiskController=" + rootDiskController + " for VM: " + vm.getDisplayName()); } } } @@ -8451,7 +8451,7 @@ private boolean checkStatusOfVolumeSnapshots(long vmId, Volume.Type type) { } else { listVolumes = _volsDao.findByInstance(vmId); } - logger.debug("Found "+listVolumes.size()+" no. of volumes of type "+type+" for vm with VM ID "+vmId); + logger.debug("Found "+listVolumes.size()+" no. of volumes of type "+type+" for VM with VM ID "+vmId); for (VolumeVO volume : listVolumes) { Long volumeId = volume.getId(); logger.debug("Checking status of snapshots for Volume with Volume Id: "+volumeId); @@ -8496,7 +8496,7 @@ private void detachVolumesFromVm(List volumes) { // Create new context and inject correct event resource type, id and details, // otherwise VOLUME.DETACH event will be associated with VirtualMachine and contain VM id and other information. CallContext volumeContext = CallContext.register(CallContext.current(), ApiCommandResourceType.Volume); - volumeContext.setEventDetails("Volume Type: " + volume.getVolumeType() + " Volume Id: " + this._uuidMgr.getUuid(Volume.class, volume.getId()) + " Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, volume.getInstanceId())); + volumeContext.setEventDetails("Volume Type: " + volume.getVolumeType() + " Volume Id: " + this._uuidMgr.getUuid(Volume.class, volume.getId()) + " VM Id: " + this._uuidMgr.getUuid(VirtualMachine.class, volume.getInstanceId())); volumeContext.setEventResourceType(ApiCommandResourceType.Volume); volumeContext.setEventResourceId(volume.getId()); @@ -8525,7 +8525,7 @@ private void destroyVolumeInContext(UserVmVO vm, boolean expunge, VolumeVO volum // Create new context and inject correct event resource type, id and details, // otherwise VOLUME.DESTROY event will be associated with VirtualMachine and contain VM id and other information. CallContext volumeContext = CallContext.register(CallContext.current(), ApiCommandResourceType.Volume); - volumeContext.setEventDetails("Volume Type: " + volume.getVolumeType() + " Volume Id: " + this._uuidMgr.getUuid(Volume.class, volume.getId()) + " Vm Id: " + vm.getUuid()); + volumeContext.setEventDetails("Volume Type: " + volume.getVolumeType() + " Volume Id: " + this._uuidMgr.getUuid(Volume.class, volume.getId()) + " VM Id: " + vm.getUuid()); volumeContext.setEventResourceType(ApiCommandResourceType.Volume); volumeContext.setEventResourceId(volume.getId()); try { @@ -8693,9 +8693,9 @@ private void postProcessingUnmanageVMVolumes(List volumes, UserVmVO vm private void checkUnmanagingVMOngoingVolumeSnapshots(UserVmVO vm) { logger.debug("Checking if there are any ongoing snapshots on the ROOT volumes associated with VM with ID " + vm.getId()); if (checkStatusOfVolumeSnapshots(vm.getId(), Volume.Type.ROOT)) { - throw new CloudRuntimeException("There is/are unbacked up snapshot(s) on ROOT volume, vm unmanage is not permitted, please try again later."); + throw new CloudRuntimeException("There is/are unbacked up snapshot(s) on ROOT volume, VM unmanage is not permitted, please try again later."); } - logger.debug("Found no ongoing snapshots on volume of type ROOT, for the vm with id " + vm.getId()); + logger.debug("Found no ongoing snapshots on volume of type ROOT, for the VM with id " + vm.getId()); } private void checkUnmanagingVMVolumes(UserVmVO vm, List volumes) { @@ -8753,7 +8753,7 @@ private void collectVmDiskAndNetworkStatistics(Long vmId, State expectedState) { if (uservm != null) { collectVmDiskAndNetworkStatistics(uservm, expectedState); } else { - logger.info(String.format("Skip collecting vm %s disk and network statistics as it is not user vm", uservm)); + logger.info(String.format("Skip collecting VM %s disk and network statistics as it is not user VM", uservm)); } } @@ -8762,7 +8762,7 @@ private void collectVmDiskAndNetworkStatistics(UserVm vm, State expectedState) { collectVmDiskStatistics(vm); collectVmNetworkStatistics(vm); } else { - logger.warn(String.format("Skip collecting vm %s disk and network statistics as the expected vm state is %s but actual state is %s", vm, expectedState, vm.getState())); + logger.warn(String.format("Skip collecting VM %s disk and network statistics as the expected VM state is %s but actual state is %s", vm, expectedState, vm.getState())); } } diff --git a/server/src/test/java/com/cloud/vm/UserVmManagerTest.java b/server/src/test/java/com/cloud/vm/UserVmManagerTest.java index 8be100d45708..ede0c1060ede 100644 --- a/server/src/test/java/com/cloud/vm/UserVmManagerTest.java +++ b/server/src/test/java/com/cloud/vm/UserVmManagerTest.java @@ -292,7 +292,7 @@ public void testScaleVMF1() throws Exception { lenient().when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance); - // UserContext.current().setEventDetails("Vm Id: "+getId()); + // UserContext.current().setEventDetails("VM Id: "+getId()); Account account = new AccountVO("testaccount", 1L, "networkdomain", Account.Type.NORMAL, "uuid"); UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString(), User.Source.UNKNOWN); //AccountVO(String accountName, long domainId, String networkDomain, short type, int regionId) @@ -402,7 +402,7 @@ public void testScaleVMF4() throws Exception { serviceOfferingIdField.setAccessible(true); serviceOfferingIdField.set(cmd, 1L); - //UserContext.current().setEventDetails("Vm Id: "+getId()); + //UserContext.current().setEventDetails("VM Id: "+getId()); //Account account = (Account) new AccountVO("testaccount", 1L, "networkdomain", (short) 0, 1); //AccountVO(String accountName, long domainId, String networkDomain, short type, int regionId) //UserContext.registerContext(1, account, null, true); diff --git a/systemvm/debian/opt/cloud/bin/setup/common.sh b/systemvm/debian/opt/cloud/bin/setup/common.sh index 9002153daee3..4cf2714f6733 100755 --- a/systemvm/debian/opt/cloud/bin/setup/common.sh +++ b/systemvm/debian/opt/cloud/bin/setup/common.sh @@ -478,7 +478,7 @@ setup_dnsmasq() { then sed -i -e "/^[#]*dhcp-option.*=119.*$/d" /etc/dnsmasq.conf echo "dhcp-option-force=119,$DNS_SEARCH_ORDER" >> /etc/dnsmasq.conf - # set the domain search order as a space seprated list for option 15 + # set the domain search order as a space separated list for option 15 DNS_SEARCH_ORDER=$(echo $DNS_SEARCH_ORDER | sed 's/,/ /g') #send domain name to dhcp clients sed -i s/[#]*dhcp-option=15.*$/dhcp-option=15,\""$DNS_SEARCH_ORDER"\"/ /etc/dnsmasq.conf @@ -539,7 +539,7 @@ setup_dnsmasq() { [ $ETH0_IP ] && echo "dhcp-option=6,$NS" >> /etc/dnsmasq.conf [ $ETH0_IP6 ] && echo "dhcp-option=option6:dns-server,$NS6" >> /etc/dnsmasq.conf #adding the name data-server to the /etc/hosts for allowing the access to user-data service and ssh-key reset in every subnet. - #removing the existing entires to avoid duplicates on restarts. + #removing the existing entries to avoid duplicates on restarts. sed -i '/data-server/d' /etc/hosts if [ -n "$ETH0_IP" ] then @@ -731,7 +731,7 @@ parse_cmd_line() { KEY=$(echo $i | cut -d= -f1) VALUE=$(echo $i | cut -d= -f2) echo -en ${COMMA} >> ${CHEF_TMP_FILE} - # Two lines so values do not accidentally interpretted as escapes!! + # Two lines so values do not accidentally interpreted as escapes!! echo -n \"${KEY}\"': '\"${VALUE}\" >> ${CHEF_TMP_FILE} COMMA=",\n\t" case $KEY in diff --git a/test/integration/component/maint/test_host_high_availability.py b/test/integration/component/maint/test_host_high_availability.py index c335c66b481f..609eb0c6c551 100644 --- a/test/integration/component/maint/test_host_high_availability.py +++ b/test/integration/component/maint/test_host_high_availability.py @@ -159,7 +159,7 @@ def tearDownClass(cls): try: # Remove the host from HA Host.update(cls.api_client, id=cls.hosts[2].id, hosttags="") - #Cleanup resources used + # Cleanup resources used cleanup_resources(cls.api_client, cls._cleanup) except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) @@ -179,7 +179,7 @@ def setUp(self): def tearDown(self): try: - #Clean up, terminate the created accounts, domains etc + # Clean up, terminate the created accounts, domains etc cleanup_resources(self.apiclient, self.cleanup) except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) @@ -220,7 +220,7 @@ def test_01_vm_deployment_with_compute_offering_with_ha_enabled(self): "The service offering is not HA enabled" ) - #create virtual machine with the service offering with Ha enabled + # create virtual machine with the service offering with Ha enabled virtual_machine = VirtualMachine.create( self.apiclient, self.services["virtual_machine"], @@ -253,7 +253,7 @@ def test_01_vm_deployment_with_compute_offering_with_ha_enabled(self): @attr(configuration="ha.tag") @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"]) def test_02_no_vm_creation_on_host_with_haenabled(self): - """ Verify you can not create new VMs on hosts with an ha.tag """ + """ Verify you cannot create new VMs on hosts with an ha.tag """ # Steps, #1. Fresh install CS (Bonita) that supports this feature @@ -296,7 +296,7 @@ def test_02_no_vm_creation_on_host_with_haenabled(self): self.debug("Deployed VM on host: %s" % vm.hostid) - #validate the virtual machine created is host Ha enabled + # validate the virtual machine created is host Ha enabled list_hosts_response = list_hosts( self.apiclient, id=vm.hostid @@ -310,7 +310,7 @@ def test_02_no_vm_creation_on_host_with_haenabled(self): self.assertNotEqual( len(list_hosts_response), 0, - "listHosts retuned empty list in response." + "listHosts returned empty list in response." ) self.assertEqual( @@ -319,7 +319,7 @@ def test_02_no_vm_creation_on_host_with_haenabled(self): "VM created on HA enabled host." ) - #create and verify virtual machine with Ha disabled service offering + # create and verify virtual machine with Ha disabled service offering virtual_machine_without_ha = VirtualMachine.create( self.apiclient, self.services["virtual_machine"], @@ -350,7 +350,7 @@ def test_02_no_vm_creation_on_host_with_haenabled(self): self.debug("Deployed VM on host: %s" % vm.hostid) - #verify that the virtual machine created on the host is Ha disabled + # verify that the virtual machine created on the host is Ha disabled list_hosts_response = list_hosts( self.apiclient, id=vm.hostid @@ -378,7 +378,7 @@ def test_02_no_vm_creation_on_host_with_haenabled(self): @attr(configuration="ha.tag") @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"]) def test_03_cant_migrate_vm_to_host_with_ha_positive(self): - """ Verify you can not migrate VMs to hosts with an ha.tag (positive) """ + """ Verify you cannot migrate VMs to hosts with an ha.tag (positive) """ # Steps, # 1. Create a Compute service offering with the 'Offer HA' option selected. @@ -495,7 +495,7 @@ def test_03_cant_migrate_vm_to_host_with_ha_positive(self): @attr(configuration="ha.tag") @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"]) def test_04_cant_migrate_vm_to_host_with_ha_negative(self): - """ Verify you can not migrate VMs to hosts with an ha.tag (negative) """ + """ Verify you cannot migrate VMs to hosts with an ha.tag (negative) """ # Steps, #1. Create a Compute service offering with the 'Offer HA' option selected. @@ -539,7 +539,7 @@ def test_04_cant_migrate_vm_to_host_with_ha_negative(self): self.debug("Deployed VM on host: %s" % vm.hostid) - #Find out Non-Suitable host for VM migration + # Find out Non-Suitable host for VM migration list_hosts_response = list_hosts( self.apiclient, type="Routing" @@ -564,7 +564,7 @@ def test_04_cant_migrate_vm_to_host_with_ha_negative(self): self.assertTrue(notSuitableHost is not None, "notsuitablehost should not be None") - #Migrate VM to Non-Suitable host + # Migrate VM to Non-Suitable host self.debug("Migrating VM-ID: %s to Host: %s" % (vm.id, notSuitableHost.id)) cmd = migrateVirtualMachine.migrateVirtualMachineCmd() @@ -572,7 +572,7 @@ def test_04_cant_migrate_vm_to_host_with_ha_negative(self): cmd.virtualmachineid = vm.id self.apiclient.migrateVirtualMachine(cmd) - #Verify that the virtual machine got migrated to targeted Non-Suitable host + # Verify that the virtual machine got migrated to targeted Non-Suitable host list_vm_response = list_virtual_machines( self.apiclient, id=vm.id @@ -598,7 +598,7 @@ def test_04_cant_migrate_vm_to_host_with_ha_negative(self): self.assertEqual( list_vm_response[0].hostid, notSuitableHost.id, - "The detination host id of migrated VM is not matching." + "The destination host id of migrated VM is not matching." ) @attr(configuration="ha.tag") @@ -650,7 +650,7 @@ def test_05_no_vm_with_ha_gets_migrated_to_ha_host_in_live_migration(self): vm_with_ha_enabled = vms[0] - #Verify the virtual machine got created on non HA host + # Verify the virtual machine got created on non HA host list_hosts_response = list_hosts( self.apiclient, id=vm_with_ha_enabled.hostid @@ -673,7 +673,7 @@ def test_05_no_vm_with_ha_gets_migrated_to_ha_host_in_live_migration(self): "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled" ) - #put the Host in maintenance mode + # put the Host in maintenance mode self.debug("Enabling maintenance mode for host %s" % vm_with_ha_enabled.hostid) cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd() cmd.id = vm_with_ha_enabled.hostid @@ -681,7 +681,7 @@ def test_05_no_vm_with_ha_gets_migrated_to_ha_host_in_live_migration(self): timeout = self.services["timeout"] - #verify the VM live migration happened to another running host + # verify the VM live migration happened to another running host self.debug("Waiting for VM to come up") time.sleep(timeout) @@ -781,7 +781,7 @@ def test_06_no_vm_without_ha_gets_migrated_to_ha_host_in_live_migration(self): vm_with_ha_disabled = vms[0] - #Verify the virtual machine got created on non HA host + # Verify the virtual machine got created on non HA host list_hosts_response = list_hosts( self.apiclient, id=vm_with_ha_disabled.hostid @@ -804,7 +804,7 @@ def test_06_no_vm_without_ha_gets_migrated_to_ha_host_in_live_migration(self): "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled" ) - #put the Host in maintenance mode + # put the Host in maintenance mode self.debug("Enabling maintenance mode for host %s" % vm_with_ha_disabled.hostid) cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd() cmd.id = vm_with_ha_disabled.hostid @@ -812,7 +812,7 @@ def test_06_no_vm_without_ha_gets_migrated_to_ha_host_in_live_migration(self): timeout = self.services["timeout"] - #verify the VM live migration happened to another running host + # verify the VM live migration happened to another running host self.debug("Waiting for VM to come up") time.sleep(timeout) diff --git a/test/integration/component/test_netscaler_lb.py b/test/integration/component/test_netscaler_lb.py index 66425d6765c1..e3c6abc2b1db 100644 --- a/test/integration/component/test_netscaler_lb.py +++ b/test/integration/component/test_netscaler_lb.py @@ -327,8 +327,8 @@ def test_lb_on_ip_with_pf(self): # 1. Deploy the first VM using a network from the above created # Network offering. # 2. Deploy another VM. - # 3. Create LB rule on Ip with PF rule. User should NOT be - # allowed to create an LB rule on Ip with PF + # 3. Create LB rule on IP with PF rule. User should NOT be + # allowed to create an LB rule on IP with PF # Creating network using the network offering created self.debug("Creating network with network offering: %s" % @@ -537,7 +537,7 @@ def test_pf_on_ip_with_lb(self): # Network offering. # 2. Deploy another VM. # 3. Create PF rule on Ip with LB rule. User should NOT be - # allowed to create an LB rule on Ip with LB + # allowed to create an LB rule on IP with LB # Creating network using the network offering created self.debug("Creating network with network offering: %s" % @@ -745,7 +745,7 @@ def test_lb_on_non_source_nat(self): # 1. Deploy the first VM using a network from the above created # Network offering. # 2. Deploy another VM. - # 3. Acquire Ip address and create LB rule on it. LB rule should be + # 3. Acquire IP address and create LB rule on it. LB rule should be # created successfully # Creating network using the network offering created @@ -957,12 +957,12 @@ def test_add_multiple_vms_lb(self): # 1. Deploy the first VM using a network from the above created # Network offering. # 2. Deploy another VM. - # 3. Acquire Ip address and create LB rule on it. Add multiple VMs to + # 3. Acquire IP address and create LB rule on it. Add multiple VMs to # this rule. LB rule should be - # In Netscaler: For every Vm added to the LB rule: + # In Netscaler: For every VM added to the LB rule: # 1. A server and service instance is created using guest VMs IP and # port number on the Netscaler LB device, - # 2. This service is bound to lb virtual server corresponding to lb + # 2. This service is bound to the LB virtual server corresponding to LB # rule. # Creating network using the network offering created @@ -1233,7 +1233,7 @@ def test_multiple_lb_publicip(self): # 1. Deploy the first VM using a network from the above created # Network offering. # 2. Deploy few more VMs. - # 3. Acquire an Ipaddress and create an LB rule for multiple Vms. + # 3. Acquire an IP address and create an LB rule for multiple VMs. # Repeat step2 for few times Requests to all these LB rules should # be serviced correctly. @@ -1545,8 +1545,8 @@ def test_multiple_lb_same_publicip(self): # 1. Deploy the first VM using a network from the above created # Network offering. # 2. Deploy few more VMs. - # 3. Acquire an Ipaddress and create an LB rule for multiple Vms. - # Create another Lb rule on the same Ipaddress pointing to + # 3. Acquire an IP address and create an LB rule for multiple VMs. + # Create another LB rule on the same IP address pointing to # different public port. Requests to all these LB rules should be # serviced correctly. @@ -1892,9 +1892,9 @@ def test_01_edit_name_lb_rule(self): """ # Validate the following - # 1. Create an Lb rule for couple of Vms . + # 1. Create an LB rule for a couple of VMs. # 2. Edit the name of the existing LB rule. When all the existing - # Lbrules are listed , we should see the edited name. + # LB rules are listed, we should see the edited name. self.debug("Assigning VMs to LB rule: %s" % self.lb_rule.name) self.lb_rule.assign(self.apiclient, [self.virtual_machine]) @@ -1903,7 +1903,7 @@ def test_01_edit_name_lb_rule(self): new_name = random_gen() self.lb_rule.update(self.apiclient, name=new_name) - self.debug("Verifing the name change in list Lb rules call") + self.debug("Verifying the name change in list LB rules call") lb_rules = LoadBalancerRule.list(self.apiclient, id=self.lb_rule.id) self.assertEqual( @@ -1925,9 +1925,9 @@ def test_02_edit_lb_ports(self): """ # Validate the following - # 1. Create an Lb rule for couple of Vms . + # 1. Create an LB rule for a couple of VMs. # 2. Edit the public/private of the existing LB rule. When all the - # existing Lbrules are listed, this should not be allowed. + # existing LB rules are listed, this should not be allowed. self.debug( "Editing public port of the LB rule: %s" % @@ -2259,15 +2259,15 @@ def tearDown(self): @attr(tags=["advancedns"]) def test_01_delete_public_ip(self): - """Test delete one public Ip with LB rules""" + """Test delete one public IP with LB rules""" # Validate the following - # 1. Associate 2 public Ips and create load balancing rules in it - # 2. Delete one of the public Ip - # 3. All the LB rules should be removed from that public Ip + # 1. Associate 2 public IPs and create load balancing rules in it + # 2. Delete one of the public IP + # 3. All the LB rules should be removed from that public IP # 4. In netscaler, make sure that all LB rules associated with that - # public Ip should get removed. - # 5. All servers and testdata service to that public Ip get deleted + # public IP should get removed. + # 5. All servers and testdata service to that public IP get deleted self.debug("Deleting public IP: %s from network: %s" % ( self.public_ip_2.ipaddress.ipaddress, @@ -2275,7 +2275,7 @@ def test_01_delete_public_ip(self): )) self.public_ip_2.delete(self.apiclient) self.debug( - "Public Ip: %s is deleted!" % + "Public IP: %s is deleted!" % self.public_ip_2.ipaddress.ipaddress) lb_rules = LoadBalancerRule.list( self.apiclient, @@ -2285,7 +2285,7 @@ def test_01_delete_public_ip(self): self.assertEqual( lb_rules, None, - "LB rules associated with the public Ip should get deleted" + "LB rules associated with the public IP should get deleted" ) self.debug("SSH into Netscaler to verify other resources are deleted") try: @@ -2333,7 +2333,7 @@ def test_02_stop_user_vm(self): # 1. Create 2 instances and add these two for load balancing # 2. Stop one of the user VM # 3. Test whether the request are not sent to stopped user VM - # 4. In netscaler, LB rules for this VM still remain configured.But + # 4. In netscaler, LB rules for this VM still remain configured. But # it will be marked as being down try: @@ -2405,7 +2405,7 @@ def test_03_start_user_vm(self): # 1. Create 2 instances and add these two for load balancing # 2. Stop one of the user VM # 3. Test whether the request are not sent to stopped user VM - # 4. In netscaler, LB rules for this VM still remain configured.But + # 4. In netscaler, LB rules for this VM still remain configured. But # it will be marked as being down self.debug("Starting VM instance: %s" % self.vm_2.name) @@ -2475,7 +2475,7 @@ def test_04_migrate_user_vm(self): # Validate the following # 1. Create 2 instances and add these two for load balancing - # 2. migrate one Vm to another host. + # 2. migrate one VM to another host. # 3. Test whether the request are sent to stopped user VM after migrate # 4. In netscaler, the LB rules are still configured. self.hypervisor = self.testClient.getHypervisorInfo() @@ -2496,7 +2496,7 @@ def test_04_migrate_user_vm(self): self.assertGreaterEqual( len(hosts), 2, - "Atleast 2 hosts should be present in a zone for VM migration" + "At least 2 hosts should be present in a zone for VM migration" ) # Remove the host of current VM from the hosts list @@ -2592,7 +2592,7 @@ def test_05_reboot_user_vm(self): # 1. Create 2 instances and add these two for load balancing # 2. Reboot one of the user VM # 3. Test whether the request are sent to both VMs after reboot - # 4. In netscaler, LB rules for this VM still remain configured. + # 4. In netscaler, LB rules for this VM still remain configured. self.debug("Rebooting VM instance: %s" % self.vm_2.name) self.vm_2.reboot(self.apiclient) @@ -2678,11 +2678,11 @@ def test_06_destroy_user_vm(self): # Validate the following # 1. Create 2 instances and add these two for load balancing # 2. Destroy one of the user VM - # 3. Until the time the Vm is in "Destroyed" state, the servies - # relating to this Vm will be marked as "Down". - # 4. Once the Vm gets expunged, then the servers and testdata + # 3. Until the time the VM is in "Destroyed" state, the services + # relating to this VM will be marked as "Down". + # 4. Once the VM gets expunged, then the servers and testdata # associated with this VM should get deleted and the LB rules - # should not be pointing to this Vm anymore. + # should not be pointing to this VM anymore. self.debug("Destroying VM instance: %s" % self.vm_2.name) self.vm_2.delete(self.apiclient) @@ -2758,12 +2758,12 @@ def test_07_delete_all_public_ip(self): """Test delete all public Ip with LB rules""" # Validate the following - # 1. Associate 2 public Ips and create load balancing rules in it + # 1. Associate 2 public IPs and create load balancing rules in it # 2. Delete all of the public Ip - # 3. All the LB rules should be removed from that public Ip + # 3. All the LB rules should be removed from that public IP # 4. In netscaler, make sure that all LB rules associated with that - # public Ip should get removed. - # 5. All servers and testdata service to that public Ip get deleted + # public IP should get removed. + # 5. All servers and testdata service to that public IP get deleted self.debug("Deleting public IP: %s from network: %s" % ( self.public_ip_1.ipaddress.ipaddress, diff --git a/tools/git/git-pr b/tools/git/git-pr index 3e5e97634be9..5a3185d05f25 100755 --- a/tools/git/git-pr +++ b/tools/git/git-pr @@ -152,7 +152,7 @@ fi currentBranch=$(git branch | grep "^*" | sed -e "s/^[*] //") if [ "${prDestinationBranch}" != "${currentBranch}" ] && [ ${force} -lt 1 ]; then echo "ERROR: This PR is made against branch '${prDestinationBranch}' while your current checked out branch is '${currentBranch}'." - echo "ERROR: Please make sure you're in the right branch and run this scipt again." + echo "ERROR: Please make sure you're in the right branch and run this script again." clean_up_and_exit 1 elif [ "${prDestinationBranch}" != "${currentBranch}" ] && [ ${force} -eq 1 ]; then echo "WARNING: You used --force to merge to '${currentBranch}' while this PR is for branch '${prDestinationBranch}'." From 3574cdcb5f2d0065b087d579938556a6909f0bfe Mon Sep 17 00:00:00 2001 From: John Bampton Date: Wed, 10 Jul 2024 21:05:29 +1000 Subject: [PATCH 02/13] Update api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java Co-authored-by: dahn --- .../org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java index f6ffd4dbf3bc..e9d4afb63140 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java @@ -756,7 +756,7 @@ public String getCreateEventDescription() { @Override public String getEventDescription() { if(getStartVm()) { - return "starting Vm. VM Id: " + getEntityUuid(); + return "starting VM. VM Id: " + getEntityUuid(); } return "deploying Vm. VM Id: " + getEntityUuid(); } From fba6bf56bc4cdd49dbd798cad5ca8ff8cc8db357 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Wed, 10 Jul 2024 21:05:39 +1000 Subject: [PATCH 03/13] Update api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java Co-authored-by: dahn --- .../org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java index e9d4afb63140..9f2af72d9622 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java @@ -758,7 +758,7 @@ public String getEventDescription() { if(getStartVm()) { return "starting VM. VM Id: " + getEntityUuid(); } - return "deploying Vm. VM Id: " + getEntityUuid(); + return "deploying VM. VM Id: " + getEntityUuid(); } @Override From 287b40f1a956f44f075dca1f677ec1f4604fc2a6 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Wed, 10 Jul 2024 21:06:03 +1000 Subject: [PATCH 04/13] Update server/src/main/java/com/cloud/network/NetworkServiceImpl.java Co-authored-by: dahn --- server/src/main/java/com/cloud/network/NetworkServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/com/cloud/network/NetworkServiceImpl.java b/server/src/main/java/com/cloud/network/NetworkServiceImpl.java index 0c3e59c5ec42..2a8b8e4686b6 100644 --- a/server/src/main/java/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/main/java/com/cloud/network/NetworkServiceImpl.java @@ -3390,7 +3390,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { long vmId = nic.getInstanceId(); VMInstanceVO vm = _vmDao.findById(vmId); if (vm == null) { - logger.error("Vm for nic " + nic.getId() + " not found with VM Id:" + vmId); + logger.error("VM for nic " + nic.getId() + " not found with VM Id:" + vmId); continue; } long isDefault = (nic.isDefaultNic()) ? 1 : 0; From 79a8b926f270e20126730b972bea5ef93092d729 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Wed, 10 Jul 2024 21:06:16 +1000 Subject: [PATCH 05/13] Update server/src/test/java/com/cloud/vm/UserVmManagerTest.java Co-authored-by: dahn --- server/src/test/java/com/cloud/vm/UserVmManagerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/test/java/com/cloud/vm/UserVmManagerTest.java b/server/src/test/java/com/cloud/vm/UserVmManagerTest.java index ede0c1060ede..c081855f0488 100644 --- a/server/src/test/java/com/cloud/vm/UserVmManagerTest.java +++ b/server/src/test/java/com/cloud/vm/UserVmManagerTest.java @@ -402,7 +402,7 @@ public void testScaleVMF4() throws Exception { serviceOfferingIdField.setAccessible(true); serviceOfferingIdField.set(cmd, 1L); - //UserContext.current().setEventDetails("VM Id: "+getId()); + //UserContext.current().setEventDetails("VM ID: "+getId()); //Account account = (Account) new AccountVO("testaccount", 1L, "networkdomain", (short) 0, 1); //AccountVO(String accountName, long domainId, String networkDomain, short type, int regionId) //UserContext.registerContext(1, account, null, true); From 8ac51b74932fc6b85fa1d9b3f30ca7475b85fe05 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Wed, 10 Jul 2024 21:06:26 +1000 Subject: [PATCH 06/13] Update plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/ServiceManagerImpl.java Co-authored-by: dahn --- .../network/contrail/management/ServiceManagerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/ServiceManagerImpl.java b/plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/ServiceManagerImpl.java index 98ad70bbe0d0..1001cd2f823c 100644 --- a/plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/ServiceManagerImpl.java +++ b/plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/ServiceManagerImpl.java @@ -134,7 +134,7 @@ private ServiceVirtualMachine createServiceVM(DataCenter zone, Account owner, Vi } catch (InsufficientCapacityException ex) { throw new CloudRuntimeException("Insufficient capacity", ex); } - CallContext.current().setEventDetails("VM Id: " + svm.getId()); + CallContext.current().setEventDetails("VM ID: " + svm.getId()); return svm; } From 0c81a3179444fa462ac5038706d0ae60f65251f8 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Wed, 10 Jul 2024 21:06:36 +1000 Subject: [PATCH 07/13] Update plugins/network-elements/netscaler/src/main/java/com/cloud/api/commands/StopNetScalerVMCmd.java Co-authored-by: dahn --- .../main/java/com/cloud/api/commands/StopNetScalerVMCmd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/network-elements/netscaler/src/main/java/com/cloud/api/commands/StopNetScalerVMCmd.java b/plugins/network-elements/netscaler/src/main/java/com/cloud/api/commands/StopNetScalerVMCmd.java index 9e8d90eb9f0a..47740d9c994b 100644 --- a/plugins/network-elements/netscaler/src/main/java/com/cloud/api/commands/StopNetScalerVMCmd.java +++ b/plugins/network-elements/netscaler/src/main/java/com/cloud/api/commands/StopNetScalerVMCmd.java @@ -110,7 +110,7 @@ public boolean isForced() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException { - CallContext.current().setEventDetails("NetScaler VM Id: " + getId()); + CallContext.current().setEventDetails("NetScaler VM ID: " + getId()); VirtualRouter result = null; VirtualRouter vm = _routerService.findRouter(getId()); if (vm == null || vm.getRole() != Role.NETSCALER_VM) { From 177d3559eb47ab82525184ce285367376562dd04 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Wed, 10 Jul 2024 21:06:47 +1000 Subject: [PATCH 08/13] Update server/src/test/java/com/cloud/vm/UserVmManagerTest.java Co-authored-by: dahn --- server/src/test/java/com/cloud/vm/UserVmManagerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/test/java/com/cloud/vm/UserVmManagerTest.java b/server/src/test/java/com/cloud/vm/UserVmManagerTest.java index c081855f0488..86350fa0130b 100644 --- a/server/src/test/java/com/cloud/vm/UserVmManagerTest.java +++ b/server/src/test/java/com/cloud/vm/UserVmManagerTest.java @@ -292,7 +292,7 @@ public void testScaleVMF1() throws Exception { lenient().when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance); - // UserContext.current().setEventDetails("VM Id: "+getId()); + // UserContext.current().setEventDetails("VM ID: "+getId()); Account account = new AccountVO("testaccount", 1L, "networkdomain", Account.Type.NORMAL, "uuid"); UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString(), User.Source.UNKNOWN); //AccountVO(String accountName, long domainId, String networkDomain, short type, int regionId) From e9b5c9d0091ae9d1ab94c1093e21c8357a66ff83 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Sat, 21 Dec 2024 08:22:01 +1000 Subject: [PATCH 09/13] Update tools/git/git-pr --- tools/git/git-pr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/git/git-pr b/tools/git/git-pr index 5a3185d05f25..3e5e97634be9 100755 --- a/tools/git/git-pr +++ b/tools/git/git-pr @@ -152,7 +152,7 @@ fi currentBranch=$(git branch | grep "^*" | sed -e "s/^[*] //") if [ "${prDestinationBranch}" != "${currentBranch}" ] && [ ${force} -lt 1 ]; then echo "ERROR: This PR is made against branch '${prDestinationBranch}' while your current checked out branch is '${currentBranch}'." - echo "ERROR: Please make sure you're in the right branch and run this script again." + echo "ERROR: Please make sure you're in the right branch and run this scipt again." clean_up_and_exit 1 elif [ "${prDestinationBranch}" != "${currentBranch}" ] && [ ${force} -eq 1 ]; then echo "WARNING: You used --force to merge to '${currentBranch}' while this PR is for branch '${prDestinationBranch}'." From 6d950039fe6375404d31a4d99b02e5aeaaea8401 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Thu, 5 Jun 2025 22:35:41 +1000 Subject: [PATCH 10/13] Fix up test failure --- server/src/test/java/com/cloud/vm/UserVmManagerImplTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/test/java/com/cloud/vm/UserVmManagerImplTest.java b/server/src/test/java/com/cloud/vm/UserVmManagerImplTest.java index cce30e9efcf4..96b6a56ebd31 100644 --- a/server/src/test/java/com/cloud/vm/UserVmManagerImplTest.java +++ b/server/src/test/java/com/cloud/vm/UserVmManagerImplTest.java @@ -1912,7 +1912,7 @@ public void validateIfVmHasNoRulesTestLoadBalancingRulesExistThrowsInvalidParame @Test public void validateIfVmHasNoRulesTestOneToOneNatRulesExistThrowsInvalidParameterValueException() { - String expectedMessage = String.format("Remove the One to One Nat rule for VM [%s] for IP [%s].", userVmVoMock, ipAddressVoMock.toString()); + String expectedMessage = String.format("Remove the One to One NAT rule for VM [%s] for IP [%s].", userVmVoMock, ipAddressVoMock.toString()); LinkedList ipAddressVoList = new LinkedList(); From cfcc791a589544ecf7c2c848ad5c3c51ebb2eb1c Mon Sep 17 00:00:00 2001 From: John Bampton Date: Fri, 6 Jun 2025 00:15:07 +1000 Subject: [PATCH 11/13] Fix up test --- test/integration/smoke/test_vm_strict_host_tags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/smoke/test_vm_strict_host_tags.py b/test/integration/smoke/test_vm_strict_host_tags.py index 2377e9a76185..e360e64c1ff8 100644 --- a/test/integration/smoke/test_vm_strict_host_tags.py +++ b/test/integration/smoke/test_vm_strict_host_tags.py @@ -423,7 +423,7 @@ def test_02_restore_vm_strict_tags_failure(self): vm.restore(self.apiclient, templateid=self.template_t2.id, expunge=True) self.fail("VM should not be restored") except Exception as e: - self.assertTrue("Unable to start VM with specified id" in str(e)) + self.assertTrue("Unable to start VM with specified ID" in str(e)) class TestMigrateVMStrictTags(cloudstackTestCase): From eea90fca9018859f46422e5e26f3e87b8d46de22 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Sat, 21 Jun 2025 01:01:16 +1000 Subject: [PATCH 12/13] Update api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java Co-authored-by: dahn --- .../api/command/admin/internallb/StartInternalLBVMCmd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java index 53ae0aed1149..c8feaaa21b62 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/internallb/StartInternalLBVMCmd.java @@ -103,7 +103,7 @@ public Long getApiResourceId() { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { - CallContext.current().setEventDetails("Internal Lb VM Id: " + getId()); + CallContext.current().setEventDetails("Internal Lb VM ID: " + getId()); VirtualRouter result = null; VirtualRouter router = _routerService.findRouter(getId()); if (router == null || router.getRole() != Role.INTERNAL_LB_VM) { From 25603ee8122e9b8373e320d07407c8982a12a0d4 Mon Sep 17 00:00:00 2001 From: dahn Date: Fri, 12 Dec 2025 11:18:53 +0100 Subject: [PATCH 13/13] Apply suggestions from code review Co-authored-by: Davi Torres <90287660+daviftorres@users.noreply.github.com> --- .../java/com/cloud/vm/UserVmManagerImpl.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java index a760b1802f0f..43d454becc76 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java @@ -2055,7 +2055,7 @@ private boolean upgradeRunningVirtualMachine(Long vmId, Long newServiceOfferingI _accountMgr.checkAccess(caller, null, true, vmInstance); - //Check if it's a scale "up" + // Check if it's a scale "up" ServiceOfferingVO newServiceOffering = serviceOfferingDao.findById(newServiceOfferingId); if (newServiceOffering.isDynamic()) { newServiceOffering.setDynamicFlag(true); @@ -3847,7 +3847,7 @@ public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, Service if (networkIdList == null || networkIdList.isEmpty()) { Network networkWithSecurityGroup = _networkModel.getNetworkWithSGWithFreeIPs(owner, zone.getId()); if (networkWithSecurityGroup == null) { - throw new InvalidParameterValueException("No network with security enabled is found in zone ID=" + zone.getUuid()); + throw new InvalidParameterValueException("No network with security enabled is found in zone ID = " + zone.getUuid()); } networkList.add(_networkDao.findById(networkWithSecurityGroup.getId())); @@ -4774,7 +4774,7 @@ private void checkIfHostNameUniqueInNtwkDomain(String hostName, List List hostNames = _vmInstanceDao.listDistinctHostNames(ntwkId); // * verify that there are no duplicates if (hostNames.contains(hostName)) { - throw new InvalidParameterValueException("The VM with hostName " + hostName + " already exists in the network domain: " + ntwkDomain.getKey() + "; network=" + throw new InvalidParameterValueException("The VM with hostName " + hostName + " already exists in the network domain: " + ntwkDomain.getKey() + "; network = " + ((_networkModel.getNetwork(ntwkId) != null) ? _networkModel.getNetwork(ntwkId).getName() : "")); } } @@ -5899,7 +5899,7 @@ private Pod getDestinationPod(Long podId, boolean isRootAdmin) { } destinationPod = _podDao.findById(podId); if (destinationPod == null) { - throw new InvalidParameterValueException("Unable to find the pod to deploy the VM, pod ID=" + podId); + throw new InvalidParameterValueException("Unable to find the pod to deploy the VM, pod ID = " + podId); } } return destinationPod; @@ -5914,7 +5914,7 @@ private Cluster getDestinationCluster(Long clusterId, boolean isRootAdmin) { } destinationCluster = _clusterDao.findById(clusterId); if (destinationCluster == null) { - throw new InvalidParameterValueException("Unable to find the cluster to deploy the VM, cluster ID=" + clusterId); + throw new InvalidParameterValueException("Unable to find the cluster to deploy the VM, cluster ID = " + clusterId); } } return destinationCluster; @@ -5929,7 +5929,7 @@ private HostVO getDestinationHost(Long hostId, boolean isRootAdmin, boolean isEx } destinationHost = _hostDao.findById(hostId); if (destinationHost == null) { - throw new InvalidParameterValueException("Unable to find the host to deploy the VM, host ID=" + hostId); + throw new InvalidParameterValueException("Unable to find the host to deploy the VM, host ID = " + hostId); } else if (destinationHost.getResourceState() != ResourceState.Enabled || destinationHost.getStatus() != Status.Up ) { throw new InvalidParameterValueException("Unable to deploy the VM as the host: " + destinationHost.getName() + " is not in the right state"); } @@ -6996,7 +6996,7 @@ private VMInstanceVO preVmStorageMigrationCheck(Long vmId) { VMInstanceVO vm = _vmInstanceDao.findById(vmId); if (vm == null) { - throw new InvalidParameterValueException("Unable to find the VM by ID=" + vmId); + throw new InvalidParameterValueException("Unable to find the VM by ID = " + vmId); } if (vm.getState() != State.Stopped) { @@ -7138,7 +7138,7 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) thr VMInstanceVO vm = _vmInstanceDao.findById(vmId); if (vm == null) { - throw new InvalidParameterValueException("Unable to find the VM by ID=" + vmId); + throw new InvalidParameterValueException("Unable to find the VM by ID = " + vmId); } // business logic if (vm.getState() != State.Running) { @@ -9021,7 +9021,7 @@ public Pair doInTransaction(final TransactionStatus status) th } } catch (Exception e) { logger.debug("Unable to start VM " + vm.getUuid(), e); - CloudRuntimeException ex = new CloudRuntimeException("Unable to start VM with specified ID" + e.getMessage()); + CloudRuntimeException ex = new CloudRuntimeException("Unable to start VM with specified ID." + e.getMessage()); ex.addProxyObject(vm.getUuid(), "vmId"); throw ex; }