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 ce30b2281181..2488e1271643 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/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 9ac33d47a34d..f8f91f6a1613 100644 --- a/server/src/main/java/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/main/java/com/cloud/network/NetworkServiceImpl.java @@ -4464,7 +4464,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { long vmId = nic.getInstanceId(); VMInstanceVO vm = _vmDao.findById(vmId); if (vm == null) { - logger.error("Instance for NIC {} not found with Instance Id: {}", nic, vmId); + logger.error("Instance for NIC {} not found with Instance ID: {}", nic, vmId); continue; } long isDefault = (nic.isDefaultNic()) ? 1 : 0; diff --git a/server/src/main/java/com/cloud/template/TemplateManagerImpl.java b/server/src/main/java/com/cloud/template/TemplateManagerImpl.java index 482d0b405d72..86bcb8a76d79 100755 --- a/server/src/main/java/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/main/java/com/cloud/template/TemplateManagerImpl.java @@ -1392,7 +1392,7 @@ public boolean detachIso(long vmId, Long isoParamId, Boolean... extraParams) { if (isoId == null) { throw new InvalidParameterValueException("The specified instance has no ISO attached to it."); } - CallContext.current().setEventDetails("Vm ID: " + virtualMachine.getUuid() + " ISO ID: " + isoId); + CallContext.current().setEventDetails("VM ID: " + virtualMachine.getUuid() + " ISO ID: " + isoId); State vmState = virtualMachine.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 a0aeabf4dffc..689b748379f7 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java @@ -896,7 +896,7 @@ private void addVmUefiBootOptionsToParams(Map names = cmd.getNames(); @@ -1167,14 +1167,14 @@ private boolean resetVMSSHKeyInternal(Long vmId, String sshPublicKeys, String ke _vmDao.saveDetails(userVm); if (vmInstance.getState() == State.Stopped) { - logger.debug("Vm " + vmInstance + " is stopped, not rebooting it as a part of SSH Key reset"); + logger.debug("VM " + vmInstance + " is stopped, not rebooting it as a part of SSH Key reset"); return true; } if (rebootVirtualMachine(userId, vmId, false, false) == null) { - logger.warn("Failed to reboot the vm " + vmInstance); + logger.warn("Failed to reboot the VM " + vmInstance); return false; } else { - logger.debug("Vm " + vmInstance + " is rebooted successfully as a part of SSH Key reset"); + logger.debug("VM " + vmInstance + " is rebooted successfully as a part of SSH Key reset"); return true; } } @@ -1185,7 +1185,7 @@ public boolean stopVirtualMachine(long userId, long vmId) { boolean status = false; UserVmVO vm = _vmDao.findById(vmId); if (logger.isDebugEnabled()) { - logger.debug("Stopping vm {} with id {}", vm, vmId); + logger.debug("Stopping VM {} with ID {}", vm, vmId); } if (vm == null || vm.getRemoved() != null) { if (logger.isDebugEnabled()) { @@ -1215,7 +1215,7 @@ private UserVm rebootVirtualMachine(long userId, long vmId, boolean enterSetup, } if (vm == null || vm.getState() == State.Destroyed || vm.getState() == State.Expunging || vm.getRemoved() != null) { - logger.warn("Vm {} with id={} doesn't exist or is not in correct state", vm, vmId); + logger.warn("VM {} with ID={} doesn't exist or is not in correct state", vm, vmId); return null; } @@ -1233,7 +1233,7 @@ private UserVm rebootVirtualMachine(long userId, long vmId, boolean enterSetup, DataCenterVO dc = _dcDao.findById(vm.getDataCenterId()); try { if (dc.getNetworkType() == DataCenter.NetworkType.Advanced) { - //List all networks of vm + //List all networks of VM List vmNetworks = _vmNetworkMapDao.getNetworks(vmId); List routers = new ArrayList<>(); //List the stopped routers @@ -1255,7 +1255,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("Rebooting vm {}{}.", vm, enterSetup ? " entering hardware setup menu" : " as is"); + logger.info("Rebooting VM {}{}.", vm, enterSetup ? " entering hardware setup menu" : " as is"); } Map params = null; if (enterSetup) { @@ -1269,7 +1269,7 @@ private UserVm rebootVirtualMachine(long userId, long vmId, boolean enterSetup, } return _vmDao.findById(vmId); } else { - logger.error("Vm {} is not in Running state, failed to reboot", vm); + logger.error("VM {} is not in Running state, failed to reboot", vm); return null; } } @@ -1290,7 +1290,7 @@ private UserVm forceRebootVirtualMachine(UserVmVO vm, long hostId, boolean enter } @Override - @ActionEvent(eventType = EventTypes.EVENT_VM_UPGRADE, eventDescription = "upgrading Vm") + @ActionEvent(eventType = EventTypes.EVENT_VM_UPGRADE, eventDescription = "upgrading VM") /* * TODO: cleanup eventually - Refactored API call */ @@ -1304,7 +1304,7 @@ public UserVm upgradeVirtualMachine(UpgradeVMCmd cmd) throws ResourceAllocationE //UserVmVO vmInstance = _vmDao.findById(vmId); VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId); if (vmInstance == null) { - throw new InvalidParameterValueException("unable to find an Instance with id " + vmId); + throw new InvalidParameterValueException("unable to find an Instance with ID " + vmId); } else if (!(vmInstance.getState().equals(State.Stopped))) { throw new InvalidParameterValueException("Unable to upgrade Instance " + vmInstance + " " + " in state " + vmInstance.getState() + "; make sure the Instance is stopped"); @@ -1358,7 +1358,7 @@ protected void addCurrentDetailValueToInstanceDetailsMapIfNewValueWasNotSpecifie private void validateOfferingMaxResource(ServiceOfferingVO offering) { Integer maxCPUCores = ConfigurationManagerImpl.VM_SERVICE_OFFERING_MAX_CPU_CORES.value() == 0 ? Integer.MAX_VALUE: ConfigurationManagerImpl.VM_SERVICE_OFFERING_MAX_CPU_CORES.value(); if (offering.getCpu() > maxCPUCores) { - throw new InvalidParameterValueException("Invalid cpu cores value, please choose another service offering with cpu cores between 1 and " + maxCPUCores); + throw new InvalidParameterValueException("Invalid CPU cores value, please choose another service offering with CPU cores between 1 and " + maxCPUCores); } Integer maxRAMSize = ConfigurationManagerImpl.VM_SERVICE_OFFERING_MAX_RAM_SIZE.value() == 0 ? Integer.MAX_VALUE: ConfigurationManagerImpl.VM_SERVICE_OFFERING_MAX_RAM_SIZE.value(); if (offering.getRamSize() > maxRAMSize) { @@ -1516,7 +1516,7 @@ public UserVm addNicToVirtualMachine(AddNicToVMCmd cmd) throws InvalidParameterV throw new InvalidParameterValueException("Unable to find an Instance with ID " + vmId); } - // 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("NIC cannot be added to Instance with Instance Snapshots"); } @@ -1567,7 +1567,7 @@ public UserVm addNicToVirtualMachine(AddNicToVMCmd cmd) throws InvalidParameterV if (_networkModel.getNicInNetwork(vmInstance.getId(),network.getId()) != null) { logger.debug("Instance {} already in network {} going to add another NIC", vmInstance, network); } 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())) { @@ -1752,7 +1752,7 @@ public UserVm removeNicFromVirtualMachine(RemoveNicFromVMCmd cmd) throws Invalid throw new InvalidParameterValueException(String.format("Zone %s, has a NetworkType of Basic. Can't remove a NIC from a VM on a Basic Network", dc)); } - // 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); } @@ -1762,7 +1762,7 @@ public UserVm removeNicFromVirtualMachine(RemoveNicFromVMCmd cmd) throws Invalid 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."); } @@ -1798,7 +1798,7 @@ public UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th throw new InvalidParameterValueException("Unable to find an Instance with ID " + vmId); } - // 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("NIC cannot be updated for Instance with Instance Snapshots"); } @@ -1824,11 +1824,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"); } @@ -1871,9 +1871,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); // close nic's old row before opening its new one, not after - otherwise the REMOVE below can't tell @@ -1902,7 +1902,7 @@ public UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th return _vmDao.findById(vmInstance.getId()); } - throw new CloudRuntimeException(String.format("something strange happened, new default network(%s) is not null, and is not equal to the network(%d) of the chosen nic", newdefault, nic.getNetworkId())); + throw new CloudRuntimeException(String.format("something strange happened, new default network(%s) is not null, and is not equal to the network(%d) of the chosen NIC", newdefault, nic.getNetworkId())); } @Override @@ -1911,28 +1911,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); } @@ -1942,7 +1942,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; } @@ -1975,7 +1975,7 @@ 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(); @@ -2127,7 +2127,7 @@ public UserVm upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableEx throw new InvalidParameterValueException(String.format("Operation not supported for instance: %s", vm.getName())); } - CallContext.current().setEventDetails("Vm Id: " + vm.getUuid()); + CallContext.current().setEventDetails("VM ID: " + vm.getUuid()); Map cmdDetails = cmd.getDetails(); @@ -2155,7 +2155,7 @@ public boolean upgradeVirtualMachine(Long vmId, Long newServiceOfferingId, Map() { @@ -2674,7 +2674,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); @@ -2713,21 +2713,21 @@ 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()); for (VolumeVO volume : rootVol) { clvmPoolManager.clearClvmLockHostDetail(volume); } - // 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)) { - 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; } @@ -2772,8 +2772,8 @@ private void transitionExpungingToError(long vmId) { } /** - * 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 */ @@ -2784,25 +2784,25 @@ 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(UserVmVO vm) { long vmId = vm.getId(); boolean success = true; - // Remove vm from security groups + // Remove VM from security groups _securityGroupMgr.removeInstanceFromGroups(vm); - // 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 {} expunge", vm); + logger.debug("Firewall rules are removed successfully as a part of VM {} expunge", vm); } else { success = false; - logger.warn("Fail to remove firewall rules as a part of vm {} expunge", vm); + logger.warn("Fail to remove firewall rules as a part of VM {} expunge", vm); } // cleanup port forwarding rules @@ -2810,23 +2810,23 @@ private boolean cleanupVmResources(UserVmVO vm) { NsxProviderVO nsx = nsxProviderDao.findByZoneId(vmInstanceVO.getDataCenterId()); if (Objects.isNull(nsx) || Objects.isNull(kubernetesServiceHelpers.get(0).findByVmId(vmId))) { if (_rulesMgr.revokePortForwardingRulesForVm(vmId)) { - logger.debug("Port forwarding rules are removed successfully as a part of vm {} expunge", vm); + logger.debug("Port forwarding rules are removed successfully as a part of VM {} expunge", vm); } else { success = false; - logger.warn("Fail to remove port forwarding rules as a part of vm {} expunge", vm); + logger.warn("Fail to remove port forwarding rules as a part of VM {} expunge", vm); } } // cleanup load balancer rules if (_lbMgr.removeVmFromLoadBalancers(vmId)) { - logger.debug("Removed vm {} from all load balancers as a part of expunge process", vm); + logger.debug("Removed VM {} from all load balancers as a part of expunge process", vm); } else { success = false; - logger.warn("Fail to remove vm {} from load balancers as a part of expunge process", vm); + logger.warn("Fail to remove VM {} from load balancers as a part of expunge process", vm); } - // If vm is assigned to static nat, disable static nat for the ip - // address and disassociate ip if elasticIP is enabled + // 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) { @@ -2853,7 +2853,7 @@ 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); @@ -2867,7 +2867,7 @@ private void updateVmStateForFailedVmCreation(Long vmId, Long hostId) { } catch (NoTransitionException e1) { logger.error("Error when transitioning state of [{}].", vm, e1); } - // destroy associated volumes for vm in error state + // destroy associated volumes for VM in error state // get all volumes in non destroyed state logger.debug("Destroying associated volumes of [{}] as it was unable to be deployed.", vm); List volumesForThisVm = _volsDao.findUsableVolumesForInstance(vm.getId()); @@ -2915,7 +2915,7 @@ protected void runInContext() { ActionEventUtils.onActionEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, Domain.ROOT_DOMAIN, EventTypes.EVENT_NETWORK_EXTERNAL_DHCP_VM_IPFETCH, - "Instance " + vmId + " NIC id "+ nicId + " IP addr fetch failed ", vmId, ApiCommandResourceType.VirtualMachine.toString()); + "Instance " + vmId + " NIC ID "+ nicId + " IP addr fetch failed ", vmId, ApiCommandResourceType.VirtualMachine.toString()); continue; } @@ -3245,7 +3245,7 @@ protected void updateDisplayVmFlag(Boolean isDisplayVm, Long id, UserVmVO vmInst protected void validateInputsAndPermissionForUpdateVirtualMachineCommand(UpdateVMCmd cmd) { UserVmVO vmInstance = _vmDao.findById(cmd.getId()); if (vmInstance == null) { - throw new InvalidParameterValueException("unable to find virtual machine with id: " + cmd.getId()); + throw new InvalidParameterValueException("unable to find virtual machine with ID: " + cmd.getId()); } validateGuestOsIdForUpdateVirtualMachineCommand(cmd); Account caller = CallContext.current().getCallingAccount(); @@ -3326,8 +3326,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 correct state. current state: {}", vm, vm.getState()); - throw new InvalidParameterValueException(String.format("Vm %s is not in the right state", vm)); + logger.error("VM {} is not in the correct state. current state: {}", vm, vm.getState()); + throw new InvalidParameterValueException(String.format("VM %s is not in the right state", vm)); } if (displayName == null) { @@ -3340,7 +3340,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) { @@ -3405,11 +3405,11 @@ public UserVm updateVirtualMachine(long id, String displayName, String group, Bo checkNameForRFCCompliance(hostName); if (vm.getHostName().equals(hostName)) { - logger.debug("Vm " + vm + " is already set with the hostName specified: " + hostName); + logger.debug("VM " + vm + " is already set with the hostName specified: " + hostName); 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) { @@ -3494,7 +3494,7 @@ private void updateSecurityGroup(UserVmVO vm, List securityGroupIdList) { protected void updateUserData(UserVm vm) throws ResourceUnavailableException, InsufficientCapacityException { boolean result = updateUserDataInternal(vm); if (result) { - logger.debug("User data successfully updated for vm id: {}", vm); + logger.debug("User data successfully updated for VM ID: {}", vm); } else { throw new CloudRuntimeException("Failed to reset userdata for the virtual machine "); } @@ -3589,7 +3589,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); + logger.error("unable to find any NICs for VM {}", vm); return false; } @@ -3613,18 +3613,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 {} in vm {} because it is not supported in network {}", nic, vmProfile, network); + logger.debug("Not applying userdata for NIC {} in VM {} because it is not supported in network {}", nic, vmProfile, network); } 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) { @@ -3645,7 +3645,7 @@ public UserVm startVirtualMachine(StartVMCmd cmd) throws ExecutionException, Con } @Override - @ActionEvent(eventType = EventTypes.EVENT_VM_START, eventDescription = "starting Vm", async = true) + @ActionEvent(eventType = EventTypes.EVENT_VM_START, eventDescription = "starting VM", async = true) public void startVirtualMachine(UserVm vm, DeploymentPlan plan) throws OperationTimedoutException, ResourceUnavailableException, InsufficientCapacityException { _itMgr.advanceStart(vm.getUuid(), null, plan, null); } @@ -3659,7 +3659,7 @@ public void startVirtualMachineForHA(VirtualMachine vm, Map nics = _nicDao.listByVmId(vmId); for (NicVO nic : nics) { Network network = _networkModel.getNetwork(nic.getNetworkId()); @@ -3764,11 +3764,11 @@ public UserVm destroyVm(DestroyVMCmd cmd, boolean checkExpunge) throws ResourceU UserVmVO vm = _vmDao.findById(vmId); if (vm == null || vm.getRemoved() != null) { - throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId); + throw new InvalidParameterValueException("unable to find a virtual machine with ID " + vmId); } if (Arrays.asList(State.Destroyed, State.Expunging).contains(vm.getState()) && !expunge) { - logger.debug("Vm {} is already destroyed", vm); + logger.debug("VM {} is already destroyed", vm); return vm; } @@ -3897,7 +3897,7 @@ private InstanceGroupVO createVmGroup(String groupName, long accountId) { try { account = _accountDao.acquireInLockTable(accountId); // to ensure // duplicate - // vm group + // VM group // names are // not // created. @@ -3926,7 +3926,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); @@ -3963,7 +3963,7 @@ public boolean addInstanceToGroup(final long userVmId, String groupName) { instanceBootGroupMembershipGuard.validateVmEligibleForGroupMembership(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()); } @@ -3971,14 +3971,14 @@ 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 {} with id {}", vm, userVmId); + logger.warn("Failed to acquire lock on user VM {} with ID {}", vm, 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) { @@ -3986,7 +3986,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { throw new CloudRuntimeException(String.format("Failed to acquire lock on Instance group %s", groupFinal)); } - // 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); @@ -4014,8 +4014,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); @@ -4026,7 +4026,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; } } @@ -4045,7 +4045,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); } } @@ -4062,7 +4062,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, List dataDiskInfoList, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List sshKeyPairs, Map requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List affinityGroupIdList, @@ -4073,7 +4073,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 @@ -4084,7 +4084,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 { if (!_itMgr.isBlankInstance(template)) { networkList.add(_networkDao.findById(defaultNetwork.getId())); @@ -4131,7 +4131,7 @@ private List validateAndUpdateSecurityGroupsIfNeeded(List securityGr } @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, List dataDiskInfoList, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List sshKeyPairs, Map requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, @@ -4143,7 +4143,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 @@ -4156,7 +4156,7 @@ public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, Service } else 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())); @@ -4176,7 +4176,7 @@ public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, Service NetworkOffering ntwkOffering = _networkOfferingDao.findById(network.getNetworkOfferingId()); if (network == null) { - throw new InvalidParameterValueException("Unable to find network by id " + networkId); + throw new InvalidParameterValueException("Unable to find network by ID " + networkId); } if (!_networkModel.isSecurityGroupSupportedInNetwork(network) && (ntwkOffering.getGuestType() != GuestType.L2)) { @@ -4195,7 +4195,7 @@ public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, Service NetworkVO network = _networkDao.findById(networkId); if (network == null) { - throw new InvalidParameterValueException("Unable to find network by id " + networkIdList.get(0).longValue()); + throw new InvalidParameterValueException("Unable to find network by ID " + networkIdList.get(0).longValue()); } boolean isSecurityGroupEnabled = _networkModel.isSecurityGroupSupportedInNetwork(network); @@ -4204,7 +4204,7 @@ public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, Service } if (network.getTrafficType() != TrafficType.Guest || !Arrays.asList(GuestType.Shared, GuestType.L2).contains(network.getGuestType())) { - throw new InvalidParameterValueException("Can specify only Shared or L2 Guest networks when deploy vm in Advance Security Group enabled zone"); + throw new InvalidParameterValueException("Can specify only Shared or L2 Guest networks when deploy VM in Advance Security Group enabled zone"); } _accountMgr.checkAccess(owner, AccessType.UseEntry, false, network); @@ -4245,7 +4245,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, List dataDiskInfoList, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List sshKeyPairs, Map requestedIps, IpAddresses defaultIps, Boolean displayvm, String keyboard, List affinityGroupIdList, @@ -4256,7 +4256,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 @@ -4277,11 +4277,11 @@ public UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serv for (Long networkId : networkIdList) { NetworkVO network = _networkDao.findById(networkId); if (network == null) { - throw new InvalidParameterValueException("Unable to find network by id " + networkIdList.get(0).longValue()); + throw new InvalidParameterValueException("Unable to find network by ID " + networkIdList.get(0).longValue()); } if (network.getVpcId() != null) { // Only ISOs, XenServer, KVM, and VmWare template types are - // supported for vpc networks + // supported for VPC networks if (template.getFormat() != ImageFormat.ISO && !vpcSupportedHTypes.contains(template.getHypervisorType())) { throw new InvalidParameterValueException("Can't create Instance from Template with hypervisor " + template.getHypervisorType() + " in VPC Network " + network); } else if (template.getFormat() == ImageFormat.ISO && !vpcSupportedHTypes.contains(hypervisor)) { @@ -4297,7 +4297,7 @@ public UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serv // don't allow to use system networks NetworkOffering networkOffering = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId()); if (networkOffering.isSystemOnly()) { - throw new InvalidParameterValueException(String.format("Network id=%s is system only and can't be used for vm deployment", network.getUuid())); + throw new InvalidParameterValueException(String.format("Network ID=%s is system only and can't be used for VM deployment", network.getUuid())); } networkList.add(network); } @@ -4309,7 +4309,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); @@ -4325,11 +4325,11 @@ private NetworkVO getNetworkToAddToNetworkList(VirtualMachineTemplate template, List vpcSupportedHTypes, Long networkId) { NetworkVO network = _networkDao.findById(networkId); if (network == null) { - throw new InvalidParameterValueException("Unable to find network by id " + networkId); + throw new InvalidParameterValueException("Unable to find network by ID " + networkId); } if (network.getVpcId() != null) { // Only ISOs, XenServer, KVM, and VmWare template types are - // supported for vpc networks + // supported for VPC networks if (template.getFormat() != ImageFormat.ISO && !vpcSupportedHTypes.contains(template.getHypervisorType())) { throw new InvalidParameterValueException("Can't create Instance from Template with hypervisor " + template.getHypervisorType() + " in VPC Network " + network); } else if (template.getFormat() == ImageFormat.ISO && !vpcSupportedHTypes.contains(hypervisor)) { @@ -4344,7 +4344,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(String.format("Network id=%s is system only and can't be used for vm deployment", network.getUuid())); + throw new InvalidParameterValueException(String.format("Network ID=%s is system only and can't be used for VM deployment", network.getUuid())); } return network; } @@ -4363,7 +4363,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) { @@ -4393,7 +4393,7 @@ private NetworkVO createDefaultNetworkForAccount(DataCenter zone, Account owner, // Validate physical network PhysicalNetwork physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId); if (physicalNetwork == null) { - throw new InvalidParameterValueException("Unable to find physical network with id: " + physicalNetworkId + " and tag: " + throw new InvalidParameterValueException("Unable to find physical network with ID: " + physicalNetworkId + " and tag: " + requiredOfferings.get(0).getTags()); } logger.debug("Creating Network for Account {} from the network offering {} as a part of deployVM process", owner, requiredOfferings.get(0)); @@ -4418,7 +4418,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."); } } } @@ -4426,7 +4426,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"); } } @@ -4443,7 +4443,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.findByIdIncludingRemoved(tmplt.getId()); if (template != null) { @@ -4482,7 +4482,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); } @@ -4495,7 +4495,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(); @@ -4630,12 +4630,12 @@ private UserVm getUncheckedUserVmResource(DataCenter zone, String hostName, Stri try { reserveStorageResourcesForVm(checkedReservations, owner, diskOfferingId, diskSize, dataDiskInfoList, rootDiskOfferingId, offering, volumesSize, vmType); - // verify security group ids + // verify security group IDs if (securityGroupIdList != null) { for (Long securityGroupId : securityGroupIdList) { SecurityGroup sg = _securityGroupDao.findById(securityGroupId); if (sg == null) { - throw new InvalidParameterValueException("Unable to find security group by id " + securityGroupId); + throw new InvalidParameterValueException("Unable to find security group by ID " + securityGroupId); } else { // verify permissions _accountMgr.checkAccess(caller, null, true, owner, sg); @@ -4706,10 +4706,10 @@ private UserVm getUncheckedUserVmResource(DataCenter zone, String hostName, Stri } if (hypervisorType != HypervisorType.BareMetal && hypervisorType != HypervisorType.External) { - // 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); } } @@ -4796,7 +4796,7 @@ private UserVm getUncheckedUserVmResource(DataCenter zone, String hostName, Stri profile.setOrderIndex(networkIndex); if (defaultNetworkNumber == 0) { defaultNetworkNumber++; - // if user requested specific ip for default network, add it + // if user requested specific IP for default network, add it if (defaultIps.getIp4Address() != null || defaultIps.getIp6Address() != null) { _networkModel.checkRequestedIpAddresses(network.getId(), defaultIps); profile = new NicProfile(defaultIps.getIp4Address(), defaultIps.getIp6Address()); @@ -4825,10 +4825,10 @@ private UserVm getUncheckedUserVmResource(DataCenter zone, String hostName, Stri } // 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) { if (_itMgr.isBlankInstance(template)) { logger.debug("Template is a dummy template for hypervisor {}, vm can be created without a default network", hypervisorType); @@ -4836,7 +4836,7 @@ private UserVm getUncheckedUserVmResource(DataCenter zone, String hostName, Stri 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"); @@ -4946,11 +4946,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); } } @@ -5105,7 +5105,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() : "")); } } @@ -5168,7 +5168,7 @@ private UserVmVO commitUserVm(final boolean isImport, final DataCenter zone, fin VMTemplateVO templateVO = _templateDao.findById(template.getId()); if (templateVO == null) { - InvalidParameterValueException ipve = new InvalidParameterValueException("Unable to look up template by id " + template.getId()); + InvalidParameterValueException ipve = new InvalidParameterValueException("Unable to look up template by ID " + template.getId()); ipve.add(VirtualMachine.class, vm.getUuid()); throw ipve; } @@ -5231,7 +5231,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<>(); @@ -5246,7 +5246,7 @@ private UserVmVO commitUserVm(final boolean isImport, final DataCenter zone, fin rootDiskOfferingId, rootDiskKmsKeyId, dataDiskInfoList, volume, snapshot); } - CallContext.current().setEventDetails("Vm Id: " + vm.getUuid()); + CallContext.current().setEventDetails("VM ID: " + vm.getUuid()); if (!isImport) { if (!offering.isDynamic()) { @@ -5369,7 +5369,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. */ @@ -5479,7 +5479,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()); @@ -5490,12 +5490,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: {} from host: {}", userVm, host, e); + logger.warn("Error while collecting network stats for VM: {} from host: {}", userVm, host, e); return; } if (networkStatsAnswer != null) { if (!networkStatsAnswer.getResult()) { - logger.warn("Error while collecting network stats vm: {} from host: {}; details: {}", userVm, host, networkStatsAnswer.getDetails()); + logger.warn("Error while collecting network stats VM: {} from host: {}; details: {}", userVm, host, networkStatsAnswer.getDetails()); return; } try { @@ -5554,14 +5554,14 @@ public void doInTransactionWithoutResult(TransactionStatus status) { } if (vmNetworkStat_lock == null) { - logger.warn("unable to find vm network stats from host for account: {} with vm: {} and nic: {}", account, userVm, nic); + logger.warn("unable to find VM network stats from host for account: {} with VM: {} and NIC: {}", account, userVm, nic); 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 + " . VM: " + vmNetworkStat.getVmName() + " Sent(Bytes): " + toHumanReadableSize(vmNetworkStat.getBytesSent()) + " Received(Bytes): " + toHumanReadableSize(vmNetworkStat.getBytesReceived())); continue; @@ -5596,13 +5596,13 @@ public void doInTransactionWithoutResult(TransactionStatus status) { } }); } catch (Exception e) { - logger.warn("Unable to update vm network statistics for vm: {} from host: {}", userVm, host, e); + logger.warn("Unable to update VM network statistics for VM: {} from host: {}", userVm, host, e); } } } @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() || cmd.isBlankInstance()) { @@ -5666,7 +5666,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 {} due to {}", vm, e.getMessage(), e); + logger.fatal("Unable to resize the data disk for VM {} due to {}", vm, e.getMessage(), e); } } finally { @@ -5676,7 +5676,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)); } @@ -5732,7 +5732,7 @@ public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, Depl if (CKS_NODE.equals(vm.getUserVmType()) || SHAREDFSVM.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()); @@ -5775,7 +5775,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"; } @@ -5923,17 +5923,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; } @@ -5982,12 +5982,12 @@ public void finalizeExpunge(VirtualMachine vm) { private void checkForceStopVmPermission(Account callingAccount) { if (!AllowUserForceStopVm.valueIn(callingAccount.getId())) { logger.error("Parameter [{}] can only be passed by Admin accounts or when the allow.user.force.stop.vm config is true for the account.", ApiConstants.FORCED); - throw new PermissionDeniedException("Account does not have the permission to force stop the vm."); + throw new PermissionDeniedException("Account does not have the permission to force stop the 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(); @@ -6000,14 +6000,14 @@ public UserVm stopVirtualMachine(long vmId, boolean forced) throws ConcurrentOpe UserVmVO vm = _vmDao.findById(vmId); if (vm == null) { - throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId); + throw new InvalidParameterValueException("unable to find a virtual machine with ID " + vmId); } if (forced) { checkForceStopVmPermission(caller); } - // 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; @@ -6045,7 +6045,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); } } @@ -6214,7 +6214,7 @@ public Pair> startVirtualMach UserVmVO vm = _vmDao.findById(vmId); if (vm == null) { - throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId); + throw new InvalidParameterValueException("unable to find a virtual machine with ID " + vmId); } if (vm.getState() == State.Running) { @@ -6318,7 +6318,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; @@ -6333,7 +6333,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; @@ -6348,7 +6348,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"); } @@ -6366,7 +6366,7 @@ public UserVm destroyVm(long vmId, boolean expunge) throws ResourceUnavailableEx } if (vm.getState() == State.Destroyed || vm.getState() == State.Expunging) { - logger.trace("Vm {} is already destroyed", vm); + logger.trace("VM {} is already destroyed", vm); return vm; } @@ -6413,12 +6413,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); } } @@ -6429,9 +6429,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(); @@ -6444,12 +6444,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: {} from host: {}", userVm, host, e); + logger.warn("Error while collecting disk stats for VM: {} from host: {}", userVm, host, e); return; } if (diskStatsAnswer != null) { if (!diskStatsAnswer.getResult()) { - logger.warn("Error while collecting disk stats vm: {} from host: {}; details: {}", userVm, host, diskStatsAnswer.getDetails()); + logger.warn("Error while collecting disk stats VM: {} from host: {}; details: {}", userVm, host, diskStatsAnswer.getDetails()); return; } try { @@ -6483,7 +6483,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) { } if (vmDiskStat_lock == null) { - logger.warn("unable to find vm disk stats from host for account: {} with vm: {} and volume: {}", account, userVm, volume); + logger.warn("unable to find VM disk stats from host for account: {} with VM: {} and volume: {}", account, userVm, volume); continue; } @@ -6492,7 +6492,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" + + logger.debug("VM disk stats changed from the time" + " GetVmDiskStatsCommand was sent. Ignoring current " + "answer. Host: {} . VM: {} IO Read: {} IO Write: {} " + "Bytes Read: {} Bytes Write: {}", @@ -6563,7 +6563,7 @@ host, vmDiskStat, toHumanReadableSize(vmDiskStat.getBytesWrite()), } @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(); @@ -6580,22 +6580,22 @@ public UserVm expungeVm(long vmId) throws ResourceUnavailableException, Concurre } if (vm.getRemoved() != null) { - logger.trace("Vm {} is already expunged", vm); + logger.trace("VM {} is already expunged", vm); 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); @@ -6606,7 +6606,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; } @@ -6690,7 +6690,7 @@ private void verifyServiceOffering(BaseDeployVMCmd cmd, ServiceOffering serviceO Long overrideDiskOfferingId = cmd.getOverrideDiskOfferingId(); if (serviceOffering.getDiskOfferingStrictness() && overrideDiskOfferingId != null) { - throw new InvalidParameterValueException(String.format("Cannot override disk offering id %d since provided service offering is strictly mapped to its disk offering", overrideDiskOfferingId)); + throw new InvalidParameterValueException(String.format("Cannot override disk offering ID %d since provided service offering is strictly mapped to its disk offering", overrideDiskOfferingId)); } if (!serviceOffering.isDynamic()) { @@ -6924,7 +6924,7 @@ private UserVm createVirtualMachine(BaseDeployVMCmd cmd, DataCenter zone, Accoun } 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, dataDiskInfoList, group, hypervisor, cmd.getHttpMethod(), userData, userDataId, userDataDetails, sshKeyPairNames, ipToNetworkMap, addrs, displayVm, keyboard, cmd.getAffinityGroupIdList(), cmd.getDetails(), @@ -6950,7 +6950,7 @@ private UserVm createVirtualMachine(BaseDeployVMCmd cmd, DataCenter zone, Accoun String extraConfig = cmd.getExtraConfig(); if (StringUtils.isNotBlank(extraConfig)) { if (EnableAdditionalVmConfig.valueIn(callerId)) { - logger.info("Adding extra configuration to user vm: {}", vm); + logger.info("Adding extra configuration to user VM: {}", vm); addExtraConfig(vm, extraConfig); } else { throw new InvalidParameterValueException("attempted setting extraconfig but enable.additional.vm.configuration is disabled"); @@ -7216,7 +7216,7 @@ protected void persistExtraConfigVmware(String decodedUrl, UserVm vm) { * 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) { @@ -7525,11 +7525,11 @@ 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) { - InvalidParameterValueException ex = new InvalidParameterValueException("VM is not Stopped, unable to migrate the vm having the specified id"); + InvalidParameterValueException ex = new InvalidParameterValueException("VM is not Stopped, unable to migrate the vm having the specified ID"); ex.addProxyObject(vm.getUuid(), "vmId"); throw ex; } @@ -7546,10 +7546,10 @@ private VMInstanceVO preVmStorageMigrationCheck(Long vmId) { List vols = _volsDao.findByInstance(vm.getId()); if (vols.size() > 1 && !(HypervisorType.VMware.equals(hypervisorType) || HypervisorType.KVM.equals(hypervisorType))) { - throw new InvalidParameterValueException("Data disks attached to the vm, can not migrate. Need to detach data disks first"); + throw new InvalidParameterValueException("Data disks attached to the VM, can not migrate. Need to detach data disks first"); } - // 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("Instance's disk cannot be migrated, please remove all the Instance Snapshots for this Instance"); } @@ -7642,7 +7642,7 @@ private void checkDestinationHypervisorType(StoragePool destPool, VMInstanceVO v } if (vm.getHypervisorType() != destHypervisorType && destHypervisorType != HypervisorType.Any) { - throw new InvalidParameterValueException("hypervisor is not compatible: dest: " + destHypervisorType.toString() + ", vm: " + vm.getHypervisorType().toString()); + throw new InvalidParameterValueException("hypervisor is not compatible: dest: " + destHypervisorType.toString() + ", VM: " + vm.getHypervisorType().toString()); } } @@ -7667,14 +7667,14 @@ 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) { 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"); + InvalidParameterValueException ex = new InvalidParameterValueException("VM is not Running, unable to migrate the vm with specified ID"); ex.addProxyObject(vm.getUuid(), "vmId"); throw ex; } @@ -7703,7 +7703,7 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) thr long srcHostId = vm.getHostId(); Host srcHost = _resourceMgr.getHost(srcHostId); if (srcHost == null) { - throw new InvalidParameterValueException("Cannot migrate VM, host with id: " + srcHostId + " for VM not found"); + throw new InvalidParameterValueException("Cannot migrate VM, host with ID: " + srcHostId + " for VM not found"); } DeployDestination dest = null; @@ -7725,7 +7725,7 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) thr } private DeployDestination chooseVmMigrationDestination(VMInstanceVO vm, Host srcHost, Long poolId) { - vm.setLastHostId(null); // Last host does not have higher priority in vm migration + vm.setLastHostId(null); // Last host does not have higher priority in VM migration final ServiceOfferingVO offering = serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId()); final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm, null, offering, null, null); final long srcHostId = srcHost.getId(); @@ -7739,7 +7739,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"); } } @@ -7832,7 +7832,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 if (_capacityMgr.checkIfHostReachMaxGuestLimit(destinationHostVO)) { if (logger.isDebugEnabled()) { logger.debug("Host: {} already has max Running VMs(count includes system VMs), cannot migrate to this host", destinationHost); @@ -7845,7 +7845,7 @@ private DeployDestination checkVmMigrationDestination(VMInstanceVO vm, Host srcH if (checkStatusOfVolumeSnapshots(vm, 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 {}", vm); + logger.debug("Found no ongoing snapshots on volumes associated with the VM {}", vm); return dest; } @@ -8009,14 +8009,14 @@ 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 = String.format("Instance of Account %d with strict implicit deployment planner being migrated to host %s not having all Instances strict implicitly dedicated to Account %d", accountOfVm, destHost, 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()); @@ -8114,7 +8114,7 @@ private boolean isImplicitPlannerUsedByOffering(long offeringId) { boolean implicitPlannerUsed = false; ServiceOfferingVO offering = serviceOfferingDao.findByIdIncludingRemoved(offeringId); if (offering == null) { - logger.error("Couldn't retrieve the offering by the given id : " + offeringId); + logger.error("Couldn't retrieve the offering by the given ID : " + offeringId); } else { String plannerName = offering.getDeploymentPlanner(); if (plannerName != null) { @@ -8218,7 +8218,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 Instance as destination host %s (ID: %s) already has max running Instances (count includes system VMs)", destinationHost.getName(), destinationHost.getUuid())); @@ -8255,14 +8255,14 @@ private Map getVolumePoolMappingForMigrateVmWithStorage(VMInstanceVO VolumeVO volume = _volsDao.findByUuid(entry.getKey()); StoragePoolVO pool = _storagePoolDao.findByUuid(entry.getValue()); if (volume == null) { - throw new InvalidParameterValueException("There is no volume present with the given id " + entry.getKey()); + throw new InvalidParameterValueException("There is no volume present with the given ID " + entry.getKey()); } else if (pool == null) { - throw new InvalidParameterValueException("There is no storage pool present with the given id " + entry.getValue()); + throw new InvalidParameterValueException("There is no storage pool present with the given ID " + entry.getValue()); } else if (pool.isInMaintenance()) { 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())); } @@ -8340,7 +8340,7 @@ public VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinatio if (vm.getState() != State.Running) { // OfflineVmwareMigration: and not vmware 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); } CloudRuntimeException ex = new CloudRuntimeException(String.format("Unable to migrate the VM %s (ID: %s) as it is not in Running state", vm.getInstanceName(), vm.getUuid())); ex.addProxyObject(vm.getUuid(), "vmId"); @@ -8523,7 +8523,7 @@ protected void validateIfVmHasNoRules(UserVmVO vm, Long vmId) throws InvalidPara List ips = _ipAddressDao.findAllByAssociatedVmId(vmId); for (IPAddressVO ip : ips) { if (ip.isOneToOneNat()) { - throw new InvalidParameterValueException(String.format("Remove the One to One Nat rule for VM [%s] for IP [%s].", vm, ip)); + throw new InvalidParameterValueException(String.format("Remove the One to One NAT rule for VM [%s] for IP [%s].", vm, ip)); } } } @@ -9274,7 +9274,6 @@ protected NetworkVO createApplicableNetworkToCreateVm(Account newAccount, DataCe long requiredOfferingId = requiredOffering.getId(); logger.debug("Creating network for account [{}] from the network offering [{}] as a part of VM deployment process.", newAccount, requiredOfferingId); - String networkName = String.format("%s-network", newAccount.getAccountName()); Network newNetwork = _networkMgr.createGuestNetwork(requiredOfferingId, networkName, networkName, null, null, null, false, null, newAccount, null, physicalNetwork, zoneId, ACLType.Account, null, null, null, null, true, null, @@ -9411,7 +9410,7 @@ public UserVm restoreVM(RestoreVMCmd cmd) throws InsufficientCapacityException, if (checkStatusOfVolumeSnapshots(vm, 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 {}", vm); + logger.debug("Found no ongoing snapshots on volume of type ROOT, for the VM {}", vm); return restoreVMInternal(caller, vm, newTemplateId, rootDiskOfferingId, expunge, details); } @@ -9431,11 +9430,11 @@ 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(); } - //newTemplateId can be either template or ISO id. In the following snippet based on the vm deployment (from template or ISO) it is handled accordingly + //newTemplateId can be either template or ISO ID. In the following snippet based on the VM deployment (from template or ISO) it is handled accordingly if (newTemplateId != null) { template = _templateDao.findById(newTemplateId); _accountMgr.checkAccess(caller, null, true, template); @@ -9445,7 +9444,7 @@ private VMTemplateVO getRestoreVirtualMachineTemplate(Account caller, Long newTe } } else { if (template.getFormat().equals(ImageFormat.ISO)) { - throw new InvalidParameterValueException("Invalid template id provided to restore the VM "); + throw new InvalidParameterValueException("Invalid template ID provided to restore the VM "); } } } else { @@ -9485,7 +9484,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) { @@ -9524,7 +9523,7 @@ public UserVm restoreVirtualMachine(final Account caller, final long vmId, final vm.setState(State.Stopped); } catch (ResourceUnavailableException e) { logger.debug("Stop vm {} failed", vm, e); - CloudRuntimeException ex = new CloudRuntimeException("Stop vm failed for specified vmId"); + CloudRuntimeException ex = new CloudRuntimeException("Stop VM failed for specified vmId"); ex.addProxyObject(vm.getUuid(), "vmId"); throw ex; } @@ -9540,7 +9539,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(); } @@ -9568,7 +9567,7 @@ public Pair doInTransaction(final TransactionStatus status) th volumeMgr.saveVolumeDetails(newVol.getDiskOfferingId(), newVol.getId()); newVol = _volsDao.findById(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())); @@ -9642,7 +9641,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()) { @@ -9656,7 +9655,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; } @@ -9775,12 +9774,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"); } } @@ -9884,7 +9883,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: {}", vm, answer.getDetails()); + logger.warn("Failed to reset VM {} due to: {}", vm, answer.getDetails()); throw new CloudRuntimeException("Unable to reset " + vm + " due to " + answer.getDetails()); } @@ -9957,7 +9956,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); @@ -9977,7 +9976,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={} for vm: {}", rootDiskController, vm); + logger.debug("Persisted device bus information rootDiskController={} for VM: {}", rootDiskController, vm); } } } @@ -10001,7 +10000,7 @@ public ConfigKey[] getConfigKeys() { public String getVmUserData(long vmId) { UserVmVO vm = _vmDao.findById(vmId); if (vm == null) { - throw new InvalidParameterValueException("Unable to find virtual machine with id " + vmId); + throw new InvalidParameterValueException("Unable to find virtual machine with ID " + vmId); } _accountMgr.checkAccess(CallContext.current().getCallingAccount(), null, true, vm); @@ -10028,7 +10027,7 @@ private boolean checkStatusOfVolumeSnapshots(VirtualMachine vm, Volume.Type type } else { listVolumes = _volsDao.findByInstance(vmId); } - logger.debug("Found {} no. of volumes of type {} for vm with VM ID {}", listVolumes.size(), type, vm); + logger.debug("Found {} no. of volumes of type {} for VM with VM ID {}", listVolumes.size(), type, vm); for (VolumeVO volume : listVolumes) { long volumeId = volume.getId(); logger.debug("Checking status of snapshots for Volume: {}", volume); @@ -10066,7 +10065,7 @@ private void validateVolumes(List volumes) { } if (volume.isDeleteProtection()) { throw new InvalidParameterValueException(String.format( - "Volume [id = %s, name = %s] has delete protection enabled and cannot be deleted", + "Volume [ID = %s, name = %s] has delete protection enabled and cannot be deleted", volume.getUuid(), volume.getName())); } } @@ -10552,9 +10551,9 @@ private void postProcessingUnmanageVMVolumes(List volumes, UserVmVO vm void checkUnmanagingVMOngoingVolumeSnapshots(UserVmVO vm) { logger.debug("Checking if there are any ongoing snapshots on the ROOT volumes associated with VM {}", vm); if (checkStatusOfVolumeSnapshots(vm, 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 {}", vm); + logger.debug("Found no ongoing snapshots on volume of type ROOT, for the VM {}", vm); } void checkUnmanagingVMVolumes(UserVmVO vm, List volumes) { @@ -10610,7 +10609,7 @@ private void collectVmDiskAndNetworkStatistics(Long vmId, State expectedState) { if (uservm != null) { collectVmDiskAndNetworkStatistics(uservm, expectedState); } else { - logger.info("Skip collecting vmId {} disk and network statistics as it is not user vm", vmId); + logger.info("Skip collecting vmId {} disk and network statistics as it is not user VM", vmId); } } @@ -10619,7 +10618,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/UserVmManagerImplTest.java b/server/src/test/java/com/cloud/vm/UserVmManagerImplTest.java index b3d6c4793475..89d703f3ff4b 100644 --- a/server/src/test/java/com/cloud/vm/UserVmManagerImplTest.java +++ b/server/src/test/java/com/cloud/vm/UserVmManagerImplTest.java @@ -2577,7 +2577,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<>(); diff --git a/server/src/test/java/com/cloud/vm/UserVmManagerTest.java b/server/src/test/java/com/cloud/vm/UserVmManagerTest.java index 2a7d35ed399f..e91ed4141592 100644 --- a/server/src/test/java/com/cloud/vm/UserVmManagerTest.java +++ b/server/src/test/java/com/cloud/vm/UserVmManagerTest.java @@ -293,7 +293,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) @@ -405,7 +405,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 ef610c914079..7e9245293f40 100755 --- a/systemvm/debian/opt/cloud/bin/setup/common.sh +++ b/systemvm/debian/opt/cloud/bin/setup/common.sh @@ -483,7 +483,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 @@ -544,7 +544,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 @@ -736,7 +736,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,