From 2a7f84eafdabc45a04b3d7cb42ffa5b2f3219680 Mon Sep 17 00:00:00 2001 From: Hoang Nguyen Date: Wed, 27 Jan 2021 17:03:35 +0700 Subject: [PATCH 1/5] ui: Add quickview to the list of VM Snapshot (#4614) This PR is used to fix the Quick access menu bar missing for VM Snapshots Fixes #4607 --- ui/src/components/view/ListView.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/src/components/view/ListView.vue b/ui/src/components/view/ListView.vue index bd191ef926f..35f68b55066 100644 --- a/ui/src/components/view/ListView.vue +++ b/ui/src/components/view/ListView.vue @@ -93,6 +93,12 @@ {{ text }} + {{ text }} @@ -404,7 +410,7 @@ export default { methods: { quickViewEnabled () { return new RegExp(['/vm', '/kubernetes', '/ssh', '/vmgroup', '/affinitygroup', - '/volume', '/snapshot', '/backup', + '/volume', '/snapshot', '/vmsnapshot', '/backup', '/guestnetwork', '/vpc', '/vpncustomergateway', '/template', '/iso', '/project', '/account', From b84a675de92d4f91972ca0af04406583aac7c3c8 Mon Sep 17 00:00:00 2001 From: Sina Kashipazha Date: Wed, 27 Jan 2021 11:05:06 +0100 Subject: [PATCH 2/5] systemvm: Fixed typo (#4621) --- systemvm/test/runtests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/systemvm/test/runtests.sh b/systemvm/test/runtests.sh index 94958e531b0..c6a58bdb92a 100644 --- a/systemvm/test/runtests.sh +++ b/systemvm/test/runtests.sh @@ -26,7 +26,7 @@ pycodestyle --max-line-length=179 *py pycodestyle --max-line-length=179 --exclude=monitorServices.py,baremetal-vr.py,passwd_server_ip.py `find ../debian -name \*.py` if [ $? -gt 0 ] then - echo "Pylint failed, please check your code" + echo "pycodestyle failed, please check your code" exit 1 fi @@ -35,7 +35,7 @@ pylint --disable=R,C,W *.py pylint --disable=R,C,W `find ../debian -name \*.py` if [ $? -gt 0 ] then - echo "Pylint failed, please check your code" + echo "pylint failed, please check your code" exit 1 fi From 4a779deab2853dac440d7134a9d56aac0b9b7a6a Mon Sep 17 00:00:00 2001 From: slavkap <51903378+slavkap@users.noreply.github.com> Date: Wed, 27 Jan 2021 15:57:34 +0200 Subject: [PATCH 3/5] server: fix on changeServiceForVirtualMachine when updating read/write rate (#4491) When changing the service offering of a VM the disk_offering_id is not updated in volumes DB table and VM could not start Fixes #4125 --- .../java/com/cloud/vm/UserVmManagerImpl.java | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java index fe8d8a45bcb..20c7930d379 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java @@ -1035,6 +1035,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir // Check that the specified service offering ID is valid _itMgr.checkIfCanUpgrade(vmInstance, newServiceOffering); + resizeRootVolumeOfVmWithNewOffering(vmInstance, newServiceOffering); + _itMgr.upgradeVmDb(vmId, newServiceOffering, currentServiceOffering); // Increment or decrement CPU and Memory count accordingly. @@ -1139,19 +1141,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir // Check that the specified service offering ID is valid _itMgr.checkIfCanUpgrade(vmInstance, newServiceOffering); - DiskOfferingVO newROOTDiskOffering = _diskOfferingDao.findById(newServiceOffering.getId()); - - List vols = _volsDao.findReadyRootVolumesByInstance(vmInstance.getId()); - - for (final VolumeVO rootVolumeOfVm : vols) { - rootVolumeOfVm.setDiskOfferingId(newROOTDiskOffering.getId()); - - _volsDao.update(rootVolumeOfVm.getId(), rootVolumeOfVm); - - ResizeVolumeCmd resizeVolumeCmd = new ResizeVolumeCmd(rootVolumeOfVm.getId(), newROOTDiskOffering.getMinIops(), newROOTDiskOffering.getMaxIops()); - - _volumeService.resizeVolume(resizeVolumeCmd); - } + resizeRootVolumeOfVmWithNewOffering(vmInstance, newServiceOffering); // Check if the new service offering can be applied to vm instance ServiceOffering newSvcOffering = _offeringDao.findById(svcOffId); @@ -1177,6 +1167,23 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir } + private void resizeRootVolumeOfVmWithNewOffering(VMInstanceVO vmInstance, ServiceOfferingVO newServiceOffering) + throws ResourceAllocationException { + DiskOfferingVO newROOTDiskOffering = _diskOfferingDao.findById(newServiceOffering.getId()); + + List vols = _volsDao.findReadyRootVolumesByInstance(vmInstance.getId()); + + for (final VolumeVO rootVolumeOfVm : vols) { + rootVolumeOfVm.setDiskOfferingId(newROOTDiskOffering.getId()); + + ResizeVolumeCmd resizeVolumeCmd = new ResizeVolumeCmd(rootVolumeOfVm.getId(), newROOTDiskOffering.getMinIops(), newROOTDiskOffering.getMaxIops()); + + _volumeService.resizeVolume(resizeVolumeCmd); + + _volsDao.update(rootVolumeOfVm.getId(), rootVolumeOfVm); + } + } + @Override @ActionEvent(eventType = EventTypes.EVENT_NIC_CREATE, eventDescription = "Creating Nic", async = true) public UserVm addNicToVirtualMachine(AddNicToVMCmd cmd) throws InvalidParameterValueException, PermissionDeniedException, CloudRuntimeException { From 182cea79b51d41e7fe3a4b651764de2df8c27230 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Wed, 27 Jan 2021 14:58:52 +0100 Subject: [PATCH 4/5] server: fix cannot create vm if another vm with same name has been added and removed on the network (#4600) * server: fix cannot create vm if another vm with same name has been added and removed on the network steps to reproduce the issue (1) create vm-1 on network-1 (2) add vm-1 to network-2 (3) remove vm-1 from network-2 (4) create another vm with same name vm-1 on network-2 expected result: operation succeed actual result: operation failed. * #4600: add back a removed line --- .../com/cloud/vm/dao/VMInstanceDaoImpl.java | 1 + .../java/com/cloud/vm/UserVmManagerImpl.java | 19 ++++++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java index 1d7d4440566..97a505d7c8f 100755 --- a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java @@ -274,6 +274,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase implem SearchBuilder nicSearch = _nicDao.createSearchBuilder(); nicSearch.and("networkId", nicSearch.entity().getNetworkId(), SearchCriteria.Op.EQ); + nicSearch.and("removedNic", nicSearch.entity().getRemoved(), SearchCriteria.Op.NULL); DistinctHostNameSearch = createSearchBuilder(String.class); DistinctHostNameSearch.selectFields(DistinctHostNameSearch.entity().getHostName()); diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java index 20c7930d379..a084d63eb39 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java @@ -1252,17 +1252,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir throw new CloudRuntimeException(vmInstance + " is in zone:" + vmInstance.getDataCenterId() + " but " + network + " is in zone:" + network.getDataCenterId()); } - // Get all vms hostNames in the network - List hostNames = _vmInstanceDao.listDistinctHostNames(network.getId()); - // verify that there are no duplicates, listDistictHostNames could return hostNames even if the NIC - //in the network is removed, so also check if the NIC is present and then throw an exception. - //This will also check if there are multiple nics of same vm in the network - if (hostNames.contains(vmInstance.getHostName())) { - for (String hostName : hostNames) { - VMInstanceVO vm = _vmInstanceDao.findVMByHostName(hostName); - if (_networkModel.getNicInNetwork(vm.getId(), network.getId()) != null && vm.getHostName().equals(vmInstance.getHostName())) { - throw new CloudRuntimeException(network + " already has a vm with host name: " + vmInstance.getHostName()); - } + if(_networkModel.getNicInNetwork(vmInstance.getId(),network.getId()) != null){ + s_logger.debug("VM " + vmInstance.getHostName() + " already in network " + network.getName() + " going to add another NIC"); + } else { + //* get all vms hostNames in the network + List hostNames = _vmInstanceDao.listDistinctHostNames(network.getId()); + //* verify that there are no duplicates + if (hostNames.contains(vmInstance.getHostName())) { + throw new CloudRuntimeException("Network " + network.getName() + " already has a vm with host name: " + vmInstance.getHostName()); } } From 7ba037478880d9da4cd025db9847cd8412789e38 Mon Sep 17 00:00:00 2001 From: Daniel Costa Date: Thu, 28 Jan 2021 05:00:08 -0300 Subject: [PATCH 5/5] ui: Fix screenshot path on README of ui (#4620) --- ui/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/README.md b/ui/README.md index 6e02264402c..b72eedb3389 100644 --- a/ui/README.md +++ b/ui/README.md @@ -2,7 +2,7 @@ A modern role-based progressive CloudStack UI based on VueJS and Ant Design. -![Screenshot](ui/docs/screenshot-dashboard.png) +![Screenshot](docs/screenshot-dashboard.png) ## Getting Started