From 2729ee110eba9a7ba3117af3b8033bdf2032585b Mon Sep 17 00:00:00 2001 From: Daniel Augusto Veronezi Salvador <38945620+GutoVeronezi@users.noreply.github.com> Date: Fri, 9 Feb 2024 05:35:34 -0300 Subject: [PATCH 01/10] Enable over provisioning for SharedMountPoint primary storages (#8481) * Enable over provisioning for SharedMountPoint primary storages * Fix unit tests * Fix typos and small adjusts --------- Co-authored-by: Daniel Augusto Veronezi Salvador --- api/src/main/java/com/cloud/storage/Storage.java | 16 +++++++++------- .../test/java/com/cloud/storage/StorageTest.java | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/api/src/main/java/com/cloud/storage/Storage.java b/api/src/main/java/com/cloud/storage/Storage.java index c6dee56fa22..ad04a7a5fb2 100644 --- a/api/src/main/java/com/cloud/storage/Storage.java +++ b/api/src/main/java/com/cloud/storage/Storage.java @@ -138,7 +138,7 @@ public class Storage { LVM(false, false, false), // XenServer local LVM SR CLVM(true, false, false), RBD(true, true, false), // http://libvirt.org/storage.html#StorageBackendRBD - SharedMountPoint(true, false, true), + SharedMountPoint(true, true, true), VMFS(true, true, false), // VMware VMFS storage PreSetup(true, true, false), // for XenServer, Storage Pool is set up by customers. EXT(false, true, false), // XenServer local EXT SR @@ -152,12 +152,12 @@ public class Storage { StorPool(true, true, true); private final boolean shared; - private final boolean overprovisioning; + private final boolean overProvisioning; private final boolean encryption; - StoragePoolType(boolean shared, boolean overprovisioning, boolean encryption) { + StoragePoolType(boolean shared, boolean overProvisioning, boolean encryption) { this.shared = shared; - this.overprovisioning = overprovisioning; + this.overProvisioning = overProvisioning; this.encryption = encryption; } @@ -166,14 +166,16 @@ public class Storage { } public boolean supportsOverProvisioning() { - return overprovisioning; + return overProvisioning; } - public boolean supportsEncryption() { return encryption; } + public boolean supportsEncryption() { + return encryption; + } } public static List getNonSharedStoragePoolTypes() { - List nonSharedStoragePoolTypes = new ArrayList(); + List nonSharedStoragePoolTypes = new ArrayList<>(); for (StoragePoolType storagePoolType : StoragePoolType.values()) { if (!storagePoolType.isShared()) { nonSharedStoragePoolTypes.add(storagePoolType); diff --git a/api/src/test/java/com/cloud/storage/StorageTest.java b/api/src/test/java/com/cloud/storage/StorageTest.java index 951ee9fe76a..76fd5c5d3a4 100644 --- a/api/src/test/java/com/cloud/storage/StorageTest.java +++ b/api/src/test/java/com/cloud/storage/StorageTest.java @@ -52,7 +52,7 @@ public class StorageTest { } @Test - public void supportsOverprovisioningStoragePool() { + public void supportsOverProvisioningTestAllStoragePoolTypes() { Assert.assertTrue(StoragePoolType.Filesystem.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.NetworkFilesystem.supportsOverProvisioning()); Assert.assertFalse(StoragePoolType.IscsiLUN.supportsOverProvisioning()); @@ -63,7 +63,7 @@ public class StorageTest { Assert.assertFalse(StoragePoolType.CLVM.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.RBD.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.PowerFlex.supportsOverProvisioning()); - Assert.assertFalse(StoragePoolType.SharedMountPoint.supportsOverProvisioning()); + Assert.assertTrue(StoragePoolType.SharedMountPoint.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.VMFS.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.PreSetup.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.EXT.supportsOverProvisioning()); From 393f3d7727a8f8b2f19114ea439ed03653485146 Mon Sep 17 00:00:00 2001 From: Rene Peinthor Date: Fri, 9 Feb 2024 11:49:20 +0100 Subject: [PATCH 02/10] linstor: use relative hostname path (#8633) As described in issue #8310 some older distributions don't have hostname in /usr/bin so rely on PATH resolving --- .../cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java b/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java index 426145d9dcc..87746447188 100644 --- a/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java +++ b/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java @@ -72,7 +72,7 @@ public class LinstorStorageAdaptor implements StorageAdaptor { private String getHostname() { // either there is already some function for that in the agent or a better way. - ProcessBuilder pb = new ProcessBuilder("/usr/bin/hostname"); + ProcessBuilder pb = new ProcessBuilder("hostname"); try { String result; @@ -88,7 +88,7 @@ public class LinstorStorageAdaptor implements StorageAdaptor { return result.trim(); } catch (IOException | InterruptedException exc) { Thread.currentThread().interrupt(); - throw new CloudRuntimeException("Unable to run '/usr/bin/hostname' command."); + throw new CloudRuntimeException("Unable to run 'hostname' command."); } } From 27520f83fec8b634bb7f1745d4ed42b1059d0a5b Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Fri, 9 Feb 2024 16:21:41 +0530 Subject: [PATCH 03/10] packaging: bundle cmk in cloudstack-management package (#8574) This bundles latest cmk release in cloudstack-management package, so admins won't need to install it for typical first-install use. Signed-off-by: Rohit Yadav --- debian/cloudstack-management.install | 1 + debian/rules | 4 ++++ packaging/centos7/cloud.spec | 4 ++++ packaging/centos8/cloud.spec | 4 ++++ 4 files changed, 13 insertions(+) diff --git a/debian/cloudstack-management.install b/debian/cloudstack-management.install index e637541076e..3d0d7e23814 100644 --- a/debian/cloudstack-management.install +++ b/debian/cloudstack-management.install @@ -35,4 +35,5 @@ /usr/bin/cloudstack-migrate-databases /usr/bin/cloudstack-setup-encryption /usr/bin/cloudstack-sysvmadm +/usr/bin/cmk /usr/share/cloudstack-management/* diff --git a/debian/rules b/debian/rules index 2d07c5e5728..f8228e61e46 100755 --- a/debian/rules +++ b/debian/rules @@ -84,6 +84,10 @@ override_dh_auto_install: cp -r engine/schema/dist/systemvm-templates/* $(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/ rm -rf $(DESTDIR)/usr/share/$(PACKAGE)-management/templates/systemvm/md5sum.txt + # Bundle cmk in cloudstack-management + wget https://github.com/apache/cloudstack-cloudmonkey/releases/download/6.3.0/cmk.linux.x86-64 -O $(DESTDIR)/usr/bin/cmk + chmod +x $(DESTDIR)/usr/bin/cmk + # nast hack for a couple of configuration files mv $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/server/cloudstack-limits.conf $(DESTDIR)/$(SYSCONFDIR)/security/limits.d/ mv $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/server/cloudstack-sudoers $(DESTDIR)/$(SYSCONFDIR)/sudoers.d/$(PACKAGE) diff --git a/packaging/centos7/cloud.spec b/packaging/centos7/cloud.spec index 8fce8906dd1..25eba6495c1 100644 --- a/packaging/centos7/cloud.spec +++ b/packaging/centos7/cloud.spec @@ -277,6 +277,9 @@ install -D client/target/utilities/bin/cloud-setup-management ${RPM_BUILD_ROOT}% install -D client/target/utilities/bin/cloud-setup-baremetal ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-baremetal install -D client/target/utilities/bin/cloud-sysvmadm ${RPM_BUILD_ROOT}%{_bindir}/%{name}-sysvmadm install -D client/target/utilities/bin/cloud-update-xenserver-licenses ${RPM_BUILD_ROOT}%{_bindir}/%{name}-update-xenserver-licenses +# Bundle cmk in cloudstack-management +wget https://github.com/apache/cloudstack-cloudmonkey/releases/download/6.3.0/cmk.linux.x86-64 -O ${RPM_BUILD_ROOT}%{_bindir}/cmk +chmod +x ${RPM_BUILD_ROOT}%{_bindir}/cmk cp -r client/target/utilities/scripts/db/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/setup @@ -609,6 +612,7 @@ pip3 install --upgrade urllib3 %attr(0755,root,root) %{_bindir}/%{name}-set-guest-sshkey %attr(0755,root,root) %{_bindir}/%{name}-sysvmadm %attr(0755,root,root) %{_bindir}/%{name}-setup-encryption +%attr(0755,root,root) %{_bindir}/cmk %{_datadir}/%{name}-management/setup/*.sql %{_datadir}/%{name}-management/setup/*.sh %{_datadir}/%{name}-management/setup/server-setup.xml diff --git a/packaging/centos8/cloud.spec b/packaging/centos8/cloud.spec index 628df8446f3..c1277823b2c 100644 --- a/packaging/centos8/cloud.spec +++ b/packaging/centos8/cloud.spec @@ -259,6 +259,9 @@ install -D client/target/utilities/bin/cloud-setup-management ${RPM_BUILD_ROOT}% install -D client/target/utilities/bin/cloud-setup-baremetal ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-baremetal install -D client/target/utilities/bin/cloud-sysvmadm ${RPM_BUILD_ROOT}%{_bindir}/%{name}-sysvmadm install -D client/target/utilities/bin/cloud-update-xenserver-licenses ${RPM_BUILD_ROOT}%{_bindir}/%{name}-update-xenserver-licenses +# Bundle cmk in cloudstack-management +wget https://github.com/apache/cloudstack-cloudmonkey/releases/download/6.3.0/cmk.linux.x86-64 -O ${RPM_BUILD_ROOT}%{_bindir}/cmk +chmod +x ${RPM_BUILD_ROOT}%{_bindir}/cmk cp -r client/target/utilities/scripts/db/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/setup @@ -588,6 +591,7 @@ pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz %attr(0755,root,root) %{_bindir}/%{name}-set-guest-sshkey %attr(0755,root,root) %{_bindir}/%{name}-sysvmadm %attr(0755,root,root) %{_bindir}/%{name}-setup-encryption +%attr(0755,root,root) %{_bindir}/cmk %{_datadir}/%{name}-management/setup/*.sql %{_datadir}/%{name}-management/setup/*.sh %{_datadir}/%{name}-management/setup/server-setup.xml From a924a110e183b70e7c0ec008bd9f5ba7da80a124 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Fri, 9 Feb 2024 16:29:59 +0100 Subject: [PATCH 04/10] Veeam: revert unnecessary state change if restore backup and attach to another VM (#8614) --- .../java/org/apache/cloudstack/backup/BackupManagerImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java b/server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java index 2e45066ff60..36978ab2f87 100644 --- a/server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java +++ b/server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java @@ -770,20 +770,16 @@ public class BackupManagerImpl extends ManagerBase implements BackupManager { String[] hostPossibleValues = {host.getPrivateIpAddress(), host.getName()}; String[] datastoresPossibleValues = {datastore.getUuid(), datastore.getName()}; - updateVmState(vm, VirtualMachine.Event.RestoringRequested, VirtualMachine.State.Restoring); Pair result = restoreBackedUpVolume(backedUpVolumeUuid, backup, backupProvider, hostPossibleValues, datastoresPossibleValues); if (BooleanUtils.isFalse(result.first())) { - updateVmState(vm, VirtualMachine.Event.RestoringFailed, VirtualMachine.State.Stopped); throw new CloudRuntimeException(String.format("Error restoring volume [%s] of VM [%s] to host [%s] using backup provider [%s] due to: [%s].", backedUpVolumeUuid, vm.getUuid(), host.getUuid(), backupProvider.getName(), result.second())); } if (!attachVolumeToVM(vm.getDataCenterId(), result.second(), vmFromBackup.getBackupVolumeList(), backedUpVolumeUuid, vm, datastore.getUuid(), backup)) { - updateVmState(vm, VirtualMachine.Event.RestoringFailed, VirtualMachine.State.Stopped); throw new CloudRuntimeException(String.format("Error attaching volume [%s] to VM [%s]." + backedUpVolumeUuid, vm.getUuid())); } - updateVmState(vm, VirtualMachine.Event.RestoringSuccess, VirtualMachine.State.Stopped); return true; } From d8cd1228496d0b9b260ae912620518f836b88afd Mon Sep 17 00:00:00 2001 From: Vishesh Date: Fri, 9 Feb 2024 21:01:06 +0530 Subject: [PATCH 05/10] zone wizard: allow only one untagged physical network with guest traffic type (#8625) --- ui/public/locales/en.json | 5 +- .../views/infra/zone/ZoneWizardLaunchZone.vue | 3 + .../ZoneWizardPhysicalNetworkSetupStep.vue | 63 +++++++++++++++---- 3 files changed, 56 insertions(+), 15 deletions(-) diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json index 9a14bef74fa..e464d2ac1ed 100644 --- a/ui/public/locales/en.json +++ b/ui/public/locales/en.json @@ -2845,7 +2845,8 @@ "message.remove.vpc": "Please confirm that you want to remove the VPC", "message.request.failed": "Request failed.", "message.required.add.least.ip": "Please add at least 1 IP Range", -"message.required.traffic.type": "Error in configuration! All required traffic types should be added and with multiple physical networks each network should have a label.", +"message.required.traffic.type": "All required traffic types should be added and with multiple physical networks each network should have a label.", +"message.required.tagged.physical.network": "There can only be one untagged physical network with guest traffic type.", "message.reset.vpn.connection": "Please confirm that you want to reset VPN connection.", "message.resize.volume.failed": "Failed to resize volume.", "message.resize.volume.processing": "Volume resize is in progress", @@ -2881,7 +2882,7 @@ "message.set.default.nic": "Please confirm that you would like to make this NIC the default for this VM.", "message.set.default.nic.manual": "Please manually update the default NIC on the VM now.", "message.setting.updated": "Setting Updated:", -"message.setup.physical.network.during.zone.creation": "When adding a zone, you need to set up one or more physical networks. Each network corresponds to a NIC on the hypervisor. Each physical network can carry one or more types of traffic, with certain restrictions on how they may be combined. Add or remove one or more traffic types onto each physical network.", +"message.setup.physical.network.during.zone.creation": "When adding a zone, you need to set up one or more physical networks. Each physical network can carry one or more types of traffic, with certain restrictions on how they may be combined. Add or remove one or more traffic types onto each physical network.", "message.setup.physical.network.during.zone.creation.basic": "When adding a basic zone, you can set up one physical network, which corresponds to a NIC on the hypervisor. The network carries several types of traffic.

You may also add other traffic types onto the physical network.", "message.shared.network.offering.warning": "Domain admins and regular users can only create shared networks from network offering with the setting specifyvlan=false. Please contact an administrator to create a network offering if this list is empty.", "message.specify.tag.key": "Please specify a tag key.", diff --git a/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue b/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue index ce8769801cf..929b0bf02cd 100644 --- a/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue +++ b/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue @@ -466,6 +466,9 @@ export default { if (physicalNetwork.isolationMethod) { params.isolationmethods = physicalNetwork.isolationMethod } + if (physicalNetwork.tags) { + params.tags = physicalNetwork.tags + } try { if (!this.stepData.stepMove.includes('createPhysicalNetwork' + index)) { diff --git a/ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue b/ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue index 97871d398d3..a9d984788ad 100644 --- a/ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue +++ b/ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue @@ -77,14 +77,17 @@ +