From 0e2c09bacafacbceae69416ee333844fbc8b3f49 Mon Sep 17 00:00:00 2001 From: Hoang Nguyen Date: Tue, 18 Jan 2022 16:05:28 +0700 Subject: [PATCH 1/5] UI - Fixes Pod, Cluster selected is incorrect on addHost dialog (#5869) * fix pod selected is incorrect * fixes fetch cluster with podid empty * clear clusterid field --- ui/src/views/infra/HostAdd.vue | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/ui/src/views/infra/HostAdd.vue b/ui/src/views/infra/HostAdd.vue index 7444f931c19..d02ff88ebb0 100644 --- a/ui/src/views/infra/HostAdd.vue +++ b/ui/src/views/infra/HostAdd.vue @@ -123,7 +123,6 @@ initialValue: authMethod }]" buttonStyle="solid" - :defaultValue="authMethod" @change="selected => { handleAuthMethodChange(selected.target.value) }"> {{ $t('label.password') }} @@ -321,22 +320,24 @@ export default { this.loading = true api('listZones', { showicon: true }).then(response => { this.zonesList = response.listzonesresponse.zone || [] - this.zoneId = this.zonesList[0].id || null - this.fetchPods() + this.zoneId = this.zonesList[0]?.id || null + this.fetchPods(this.zoneId) }).catch(error => { this.$notifyError(error) }).finally(() => { this.loading = false }) }, - fetchPods () { + fetchPods (zoneId) { + this.zoneId = zoneId this.loading = true api('listPods', { zoneid: this.zoneId }).then(response => { this.podsList = response.listpodsresponse.pod || [] - this.podId = this.podsList[0].id || null - this.fetchClusters() + this.podId = this.podsList[0]?.id || null + this.form.setFieldsValue({ podid: this.podId }) + this.fetchClusters(this.podId) }).catch(error => { this.$notifyError(error) this.podsList = [] @@ -345,13 +346,19 @@ export default { this.loading = false }) }, - fetchClusters () { + fetchClusters (podId) { + this.form.clearField('clusterid') + this.clusterId = null + this.clustersList = [] + if (!podId) return + this.podId = podId this.loading = true api('listClusters', { podid: this.podId }).then(response => { this.clustersList = response.listclustersresponse.cluster || [] - this.clusterId = this.clustersList[0].id || null + this.clusterId = this.clustersList[0]?.id || null + this.form.setFieldsValue({ clusterid: this.clusterId }) if (this.clusterId) { this.handleChangeCluster(this.clusterId) } From fb35f46a964c71117e40b69020f93d1f35be9c21 Mon Sep 17 00:00:00 2001 From: dahn Date: Tue, 18 Jan 2022 10:21:51 +0100 Subject: [PATCH 2/5] Delete ldap config from UI (#5871) * add params to delete command * pass known params Co-authored-by: Daan Hoogland --- ui/src/config/section/config.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/src/config/section/config.js b/ui/src/config/section/config.js index 8b77c65d411..25c4e3e3ffe 100644 --- a/ui/src/config/section/config.js +++ b/ui/src/config/section/config.js @@ -51,10 +51,16 @@ export default { label: 'label.remove.ldap', message: 'message.remove.ldap', dataView: true, - args: ['hostname'], + args: ['hostname', 'port', 'domainid'], mapping: { hostname: { value: (record) => { return record.hostname } + }, + port: { + value: (record) => { return record.port } + }, + domainid: { + value: (record) => { return record.domainid } } } } From f3289fb596e1fd6394ef1879da2da71078a492a9 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Thu, 20 Jan 2022 09:40:23 +0100 Subject: [PATCH 3/5] server: fix regular user can create isolated network without sourcenat (#5844) * server: fix regular user can create isolated network without sourcenat --- .../com/cloud/network/NetworkServiceImpl.java | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/com/cloud/network/NetworkServiceImpl.java b/server/src/main/java/com/cloud/network/NetworkServiceImpl.java index 178a4c896ef..de97c2939db 100644 --- a/server/src/main/java/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/main/java/com/cloud/network/NetworkServiceImpl.java @@ -1360,12 +1360,9 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C performBasicPrivateVlanChecks(vlanId, secondaryVlanId, privateVlanType); - // Regular user can create Guest Isolated Source Nat enabled network only - if (_accountMgr.isNormalUser(caller.getId()) && (ntwkOff.getTrafficType() != TrafficType.Guest - || ntwkOff.getGuestType() != Network.GuestType.Isolated && areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat))) { - throw new InvalidParameterValueException( - String.format("Regular users can only create a network from network offerings having traffic type [%s] and network type [%s] with a service [%s] enabled.", TrafficType.Guest, - Network.GuestType.Isolated, Service.SourceNat.getName())); + // Regular user can create Guest Isolated Source Nat enabled network or L2 network only + if (_accountMgr.isNormalUser(caller.getId())) { + validateNetworkOfferingForRegularUser(ntwkOff); } // Don't allow to specify vlan if the caller is not ROOT admin @@ -1457,6 +1454,23 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C return network; } + private void validateNetworkOfferingForRegularUser(NetworkOfferingVO ntwkOff) { + if (ntwkOff.getTrafficType() != TrafficType.Guest) { + throw new InvalidParameterValueException("Regular users can only create a Guest network"); + } + if (ntwkOff.getGuestType() == GuestType.Isolated && areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat)) { + s_logger.debug(String.format("Creating a network from network offerings having traffic type [%s] and network type [%s] with a service [%s] enabled.", + TrafficType.Guest, GuestType.Isolated, Service.SourceNat.getName())); + } else if (ntwkOff.getGuestType() == GuestType.L2) { + s_logger.debug(String.format("Creating a network from network offerings having traffic type [%s] and network type [%s].", + TrafficType.Guest, GuestType.L2)); + } else { + throw new InvalidParameterValueException( + String.format("Regular users can only create an %s network with a service [%s] enabled, or a %s network.", + GuestType.Isolated, Service.SourceNat.getName(), GuestType.L2)); + } + } + /** * Retrieve information (if set) for private VLAN when creating the network */ From 4996b800b5d3b601c76502e4bd5d2286a24db045 Mon Sep 17 00:00:00 2001 From: sureshanaparti <12028987+sureshanaparti@users.noreply.github.com> Date: Thu, 20 Jan 2022 14:37:51 +0530 Subject: [PATCH 4/5] Now correct values are shown when configuring limits for a domain. (#5874) (#5880) Now correct values are shown when configuring limits for a domain. (#5874) (#5880) Co-authored-by: JoaoJandre <48719461+JoaoJandre@users.noreply.github.com> Co-authored-by: Joao --- ui/src/components/view/ResourceLimitTab.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/src/components/view/ResourceLimitTab.vue b/ui/src/components/view/ResourceLimitTab.vue index 93cce68fd7b..91cf42d90f0 100644 --- a/ui/src/components/view/ResourceLimitTab.vue +++ b/ui/src/components/view/ResourceLimitTab.vue @@ -105,6 +105,7 @@ export default { try { this.formLoading = true this.dataResource = await this.listResourceLimits(params) + this.form.resetFields() this.formLoading = false } catch (e) { this.$notification.error({ From f639f56834d563b01b1699568aa94d30908e6a06 Mon Sep 17 00:00:00 2001 From: DK101010 <57522802+DK101010@users.noreply.github.com> Date: Thu, 20 Jan 2022 14:54:26 +0100 Subject: [PATCH 5/5] fill volume attached field (#5865) Co-authored-by: DK101010 --- .../cloudstack/engine/orchestration/VolumeOrchestrator.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index 3b9397782f5..d88e17d98ec 100644 --- a/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -164,6 +164,7 @@ import com.cloud.vm.dao.UserVmCloneSettingDao; import com.cloud.vm.dao.UserVmDao; import static com.cloud.storage.resource.StorageProcessor.REQUEST_TEMPLATE_RELOAD; +import java.util.Date; public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrationService, Configurable { @@ -1975,6 +1976,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati vol.setPath(path); vol.setChainInfo(chainInfo); vol.setState(Volume.State.Ready); + vol.setAttached(new Date()); vol = _volsDao.persist(vol); return toDiskProfile(vol, offering); }