Skip to content

Commit e82bcfd

Browse files
committed
Merge remote-tracking branch 'upstream/main' into instance-from-backup
2 parents d96a2b8 + ae50103 commit e82bcfd

File tree

8 files changed

+69
-10
lines changed

8 files changed

+69
-10
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
---
18-
default_stages: [commit, push]
18+
default_stages: [pre-commit, pre-push]
1919
default_language_version:
2020
# force all unspecified Python hooks to run python3
2121
python: python3
22-
minimum_pre_commit_version: "2.17.0"
22+
minimum_pre_commit_version: "3.2.0"
2323
repos:
2424
- repo: meta
2525
hooks:
@@ -32,7 +32,7 @@ repos:
3232
name: run gitleaks
3333
description: detect hardcoded secrets
3434
- repo: https://github.com/pre-commit/pre-commit-hooks
35-
rev: v4.6.0
35+
rev: v5.0.0
3636
hooks:
3737
#- id: check-added-large-files
3838
- id: check-case-conflict

engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
-- Schema upgrade from 4.20.1.0 to 4.21.0.0
2020
--;
2121

22+
-- Update default value for the config 'vm.network.nic.max.secondary.ipaddresses' (and value to default value if value is null)
23+
UPDATE `cloud`.`configuration` SET default_value = '10' WHERE name = 'vm.network.nic.max.secondary.ipaddresses';
24+
UPDATE `cloud`.`configuration` SET value = '10' WHERE name = 'vm.network.nic.max.secondary.ipaddresses' AND value IS NULL;
25+
2226
-- Add console_endpoint_creator_address column to cloud.console_session table
2327
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.console_session', 'console_endpoint_creator_address', 'VARCHAR(45)');
2428

requirements-dev.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
pre-commit

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@
1717

1818
# Marvin dependencies are installed via its bundle
1919

20-
pre-commit
21-
2220
# Install the SolidFire SDK for Python
2321
solidfire-sdk-python

server/src/main/java/com/cloud/configuration/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public enum Config {
395395
null),
396396
MaxNumberOfSecondaryIPsPerNIC(
397397
"Network", ManagementServer.class, Integer.class,
398-
"vm.network.nic.max.secondary.ipaddresses", "256",
398+
"vm.network.nic.max.secondary.ipaddresses", "10",
399399
"Specify the number of secondary ip addresses per nic per vm. Default value 10 is used, if not specified.", null),
400400

401401
EnableServiceMonitoring(

server/src/main/java/com/cloud/network/NetworkServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ public NicSecondaryIp allocateSecondaryGuestIP(final long nicId, IpAddresses req
910910
throw new InvalidParameterValueException("Invalid network id is given");
911911
}
912912

913-
int maxAllowedIpsPerNic = NumbersUtil.parseInt(_configDao.getValue(Config.MaxNumberOfSecondaryIPsPerNIC.key()), 10);
913+
int maxAllowedIpsPerNic = NumbersUtil.parseInt(_configDao.getValue(Config.MaxNumberOfSecondaryIPsPerNIC.key()), Integer.parseInt(Config.MaxNumberOfSecondaryIPsPerNIC.getDefaultValue()));
914914
Long nicWiseIpCount = _nicSecondaryIpDao.countByNicId(nicId);
915915
if (nicWiseIpCount.intValue() >= maxAllowedIpsPerNic) {
916916
logger.error("Maximum Number of Ips \"vm.network.nic.max.secondary.ipaddresses = \"{} per Nic has been crossed for the nic {}.", maxAllowedIpsPerNic, nicVO);

ui/public/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
"basicZoneEnabled": true,
9999
"multipleServer": false,
100100
"allowSettingTheme": true,
101+
"displayProjectFieldOnLogin": false,
101102
"imageSelectionInterface": "modern",
102103
"showUserCategoryForModernImageSelection": true,
103104
"showAllCategoryForModernImageSelection": false,

ui/src/views/auth/Login.vue

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@
9191
type="text"
9292
:placeholder="$t('label.domain')"
9393
v-model:value="form.domain"
94+
>
95+
<template #prefix>
96+
<project-outlined />
97+
</template>
98+
</a-input>
99+
</a-form-item>
100+
<a-form-item ref="project" name="project" v-if="$config.displayProjectFieldOnLogin">
101+
<a-input
102+
size="large"
103+
type="text"
104+
:placeholder="$t('label.project')"
105+
v-model:value="form.project"
94106
>
95107
<template #prefix>
96108
<block-outlined />
@@ -230,7 +242,8 @@ export default {
230242
loginType: 0
231243
},
232244
server: '',
233-
forgotPasswordEnabled: false
245+
forgotPasswordEnabled: false,
246+
project: null
234247
}
235248
},
236249
created () {
@@ -255,7 +268,8 @@ export default {
255268
this.form = reactive({
256269
server: (this.server.apiHost || '') + this.server.apiBase,
257270
username: this.$route.query?.username || '',
258-
domain: this.$route.query?.domain || ''
271+
domain: this.$route.query?.domain || '',
272+
project: null
259273
})
260274
this.rules = reactive({})
261275
this.setRules()
@@ -447,7 +461,7 @@ export default {
447461
})
448462
})
449463
},
450-
loginSuccess (res) {
464+
async loginSuccess (res) {
451465
this.$notification.destroy()
452466
this.$store.commit('SET_COUNT_NOTIFY', 0)
453467
if (store.getters.twoFaEnabled === true && store.getters.twoFaProvider !== '' && store.getters.twoFaProvider !== undefined) {
@@ -456,9 +470,33 @@ export default {
456470
this.$router.push({ path: '/setup2FA' }).catch(() => {})
457471
} else {
458472
this.$store.commit('SET_LOGIN_FLAG', true)
473+
const values = toRaw(this.form)
474+
if (values.project) {
475+
await this.getProject(values.project)
476+
this.$store.dispatch('ProjectView', this.project.id)
477+
this.$store.dispatch('SetProject', this.project)
478+
this.$store.dispatch('ToggleTheme', this.project.id === undefined ? 'light' : 'dark')
479+
}
459480
this.$router.push({ path: '/dashboard' }).catch(() => {})
460481
}
461482
},
483+
getProject (projectName) {
484+
return new Promise((resolve, reject) => {
485+
getAPI('listProjects', {
486+
response: 'json',
487+
domainId: this.selectedDomain,
488+
details: 'min'
489+
}).then((response) => {
490+
const projects = response.listprojectsresponse.project
491+
this.project = projects.filter(project => project.name === projectName)?.[0] || null
492+
resolve(this.project)
493+
}).catch((error) => {
494+
this.$notifyError(error)
495+
}).finally(() => {
496+
this.loading = false
497+
})
498+
})
499+
},
462500
requestFailed (err) {
463501
if (err && err.response && err.response.data && err.response.data.loginresponse) {
464502
const error = err.response.data.loginresponse.errorcode + ': ' + err.response.data.loginresponse.errortext

0 commit comments

Comments
 (0)