mirror of https://github.com/apache/cloudstack.git
Merge branch 'main' into service_offering_category_feature
This commit is contained in:
commit
4ff6cf37e9
|
|
@ -20,7 +20,7 @@
|
|||
# pre-commit
|
||||
|
||||
We run [pre-commit](https://pre-commit.com/) with
|
||||
[GitHub Actions](https://github.com/apache/cloudstack/blob/main/.github/workflows/linter.yml) so installation on your
|
||||
[GitHub Actions](https://github.com/apache/cloudstack/blob/main/.github/workflows/pre-commit.yml) so installation on your
|
||||
local machine is currently optional.
|
||||
|
||||
The `pre-commit` [configuration file](https://github.com/apache/cloudstack/blob/main/.pre-commit-config.yaml)
|
||||
|
|
@ -78,7 +78,7 @@ public class Networks {
|
|||
}
|
||||
@Override
|
||||
public String getValueFrom(URI uri) {
|
||||
return uri.getAuthority();
|
||||
return uri == null ? null : uri.getAuthority();
|
||||
}
|
||||
},
|
||||
Vswitch("vs", String.class), LinkLocal(null, null), Vnet("vnet", Long.class), Storage("storage", Integer.class), Lswitch("lswitch", String.class) {
|
||||
|
|
@ -96,7 +96,7 @@ public class Networks {
|
|||
*/
|
||||
@Override
|
||||
public String getValueFrom(URI uri) {
|
||||
return uri.getSchemeSpecificPart();
|
||||
return uri == null ? null : uri.getSchemeSpecificPart();
|
||||
}
|
||||
},
|
||||
Mido("mido", String.class), Pvlan("pvlan", String.class),
|
||||
|
|
@ -177,7 +177,7 @@ public class Networks {
|
|||
* @return the scheme as BroadcastDomainType
|
||||
*/
|
||||
public static BroadcastDomainType getSchemeValue(URI uri) {
|
||||
return toEnumValue(uri.getScheme());
|
||||
return toEnumValue(uri == null ? null : uri.getScheme());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -191,7 +191,7 @@ public class Networks {
|
|||
if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(str)) {
|
||||
return Native;
|
||||
}
|
||||
return getSchemeValue(new URI(str));
|
||||
return getSchemeValue(str == null ? null : new URI(str));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -220,7 +220,7 @@ public class Networks {
|
|||
* @return the host part as String
|
||||
*/
|
||||
public String getValueFrom(URI uri) {
|
||||
return uri.getHost();
|
||||
return uri == null ? null : uri.getHost();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -243,7 +243,7 @@ public class Networks {
|
|||
* @throws URISyntaxException the string is not even an uri
|
||||
*/
|
||||
public static String getValue(String uriString) throws URISyntaxException {
|
||||
return getValue(new URI(uriString));
|
||||
return getValue(uriString == null ? null : new URI(uriString));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,6 +37,24 @@ public class NetworksTest {
|
|||
public void setUp() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullBroadcastDomainTypeTest() throws URISyntaxException {
|
||||
BroadcastDomainType type = BroadcastDomainType.getTypeOf(null);
|
||||
Assert.assertEquals("a null uri should mean a broadcasttype of undecided", BroadcastDomainType.UnDecided, type);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullBroadcastDomainTypeValueTest() {
|
||||
URI uri = null;
|
||||
Assert.assertNull(BroadcastDomainType.getValue(uri));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullBroadcastDomainTypeStringValueTest() throws URISyntaxException {
|
||||
String uriString = null;
|
||||
Assert.assertNull(BroadcastDomainType.getValue(uriString));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyBroadcastDomainTypeTest() throws URISyntaxException {
|
||||
BroadcastDomainType type = BroadcastDomainType.getTypeOf("");
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
-- Licensed to the Apache Software Foundation (ASF) under one
|
||||
-- or more contributor license agreements. See the NOTICE file
|
||||
-- distributed with this work for additional information
|
||||
-- regarding copyright ownership. The ASF licenses this file
|
||||
-- to you under the Apache License, Version 2.0 (the
|
||||
-- "License"); you may not use this file except in compliance
|
||||
-- with the License. You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing,
|
||||
-- software distributed under the License is distributed on an
|
||||
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
-- KIND, either express or implied. See the License for the
|
||||
-- specific language governing permissions and limitations
|
||||
-- under the License.
|
||||
|
||||
--;
|
||||
-- Schema upgrade cleanup from 4.22.0.0 to 4.23.0.0
|
||||
--;
|
||||
|
|
@ -16,5 +16,5 @@
|
|||
-- under the License.
|
||||
|
||||
--;
|
||||
-- Schema upgrade cleanup from 4.22.1.0 to 4.22.3.0
|
||||
-- Schema upgrade cleanup from 4.22.1.0 to 4.23.0.0
|
||||
--;
|
||||
|
|
|
|||
|
|
@ -1689,7 +1689,11 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
|
|||
*/
|
||||
srcFile = new QemuImgFile(KVMPhysicalDisk.RBDStringBuilder(srcPool, sourcePath));
|
||||
srcFile.setFormat(sourceFormat);
|
||||
destFile = new QemuImgFile(destPath);
|
||||
if (destPool.getType() == StoragePoolType.RBD) {
|
||||
destFile = new QemuImgFile(KVMPhysicalDisk.RBDStringBuilder(destPool, destPath));
|
||||
} else {
|
||||
destFile = new QemuImgFile(destPath);
|
||||
}
|
||||
destFile.setFormat(destFormat);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class VTreeMigrationInfo {
|
|||
}
|
||||
|
||||
public void setMigrationStatus(String migrationStatus) {
|
||||
this.migrationStatus = EnumUtils.fromString(MigrationStatus.class, migrationStatus, MigrationStatus.None);
|
||||
this.migrationStatus = EnumUtils.getEnumIgnoreCase(MigrationStatus.class, migrationStatus, MigrationStatus.None);
|
||||
}
|
||||
|
||||
public void setMigrationStatus(MigrationStatus migrationStatus) {
|
||||
|
|
|
|||
|
|
@ -1767,7 +1767,7 @@ public class ApiDBUtils {
|
|||
return null;
|
||||
}
|
||||
String jobInstanceId = null;
|
||||
ApiCommandResourceType jobInstanceType = EnumUtils.fromString(ApiCommandResourceType.class, job.getInstanceType(), ApiCommandResourceType.None);
|
||||
ApiCommandResourceType jobInstanceType = EnumUtils.getEnumIgnoreCase(ApiCommandResourceType.class, job.getInstanceType(), ApiCommandResourceType.None);
|
||||
|
||||
if (job.getInstanceId() == null) {
|
||||
// when assert is hit, implement 'getInstanceId' of BaseAsyncCmd and return appropriate instance id
|
||||
|
|
|
|||
|
|
@ -1997,8 +1997,13 @@ export default {
|
|||
},
|
||||
onSearch (opts) {
|
||||
const query = Object.assign({}, this.$route.query)
|
||||
const searchFilters = this.$route?.meta?.searchFilters || []
|
||||
searchFilters.forEach(key => delete query[key])
|
||||
let searchFilters = this.$route?.meta?.searchFilters || []
|
||||
if (typeof searchFilters === 'function') {
|
||||
searchFilters = searchFilters()
|
||||
}
|
||||
if (Array.isArray(searchFilters)) {
|
||||
searchFilters.forEach(key => delete query[key])
|
||||
}
|
||||
delete query.name
|
||||
delete query.templatetype
|
||||
delete query.keyword
|
||||
|
|
|
|||
|
|
@ -29,30 +29,4 @@ public class EnumUtils extends org.apache.commons.lang3.EnumUtils {
|
|||
b.append("]");
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
public static <T extends Enum<T>> T fromString(Class<T> clz, String value, T defaultVal) {
|
||||
assert (clz != null);
|
||||
|
||||
if (value != null) {
|
||||
try {
|
||||
return Enum.valueOf(clz, value.trim());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
assert (false);
|
||||
}
|
||||
}
|
||||
return defaultVal;
|
||||
}
|
||||
|
||||
public static <T extends Enum<T>> T fromString(Class<T> clz, String value) {
|
||||
assert (clz != null);
|
||||
|
||||
if (value != null) {
|
||||
try {
|
||||
return Enum.valueOf(clz, value.trim());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
assert (false);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue