Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21b2025

Browse files
committed
Merge release branch 4.20 to 4.22
* 4.20: Fix/flasharray delete rename destroy patch conflict (#13049) Fix VPC network offerings listing in isolated network creation form (#12645) Update mysql java connector version to 8.4.0 (matching version for MySQL 8.4) (#12640) adaptive: honor user-provided capacityBytes when provider stats are unavailable (#13059) Flexibilize public IP selection (#11076)
2 parents d1e1aa5 + c267ad3 commit 21b2025

22 files changed

Lines changed: 193 additions & 96 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ jobs:
282282
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md#mysql
283283
sudo apt-get install -y mysql-server
284284
sudo systemctl start mysql
285-
sudo mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''; FLUSH PRIVILEGES;"
285+
sudo mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY ''; FLUSH PRIVILEGES;"
286286
sudo systemctl restart mysql
287287
sudo mysql -uroot -e "SELECT VERSION();"
288288

engine/schema/src/main/java/com/cloud/network/dao/PublicIpQuarantineDao.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,21 @@
1919
import com.cloud.network.vo.PublicIpQuarantineVO;
2020
import com.cloud.utils.db.GenericDao;
2121

22+
import java.util.Date;
23+
import java.util.List;
24+
2225
public interface PublicIpQuarantineDao extends GenericDao<PublicIpQuarantineVO, Long> {
2326

2427
PublicIpQuarantineVO findByPublicIpAddressId(long publicIpAddressId);
2528

2629
PublicIpQuarantineVO findByIpAddress(String publicIpAddress);
30+
31+
/**
32+
* Returns a list of public IP addresses that are actively quarantined at the specified date and the previous owner differs from the specified user.
33+
*
34+
* @param userId used to check against the IP's previous owner;
35+
* @param date used to check if the quarantine is active;
36+
* @return a list of PublicIpQuarantineVOs.
37+
*/
38+
List<PublicIpQuarantineVO> listQuarantinedIpAddressesToUser(Long userId, Date date);
2739
}

engine/schema/src/main/java/com/cloud/network/dao/PublicIpQuarantineDaoImpl.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@
2626

2727
import javax.annotation.PostConstruct;
2828
import javax.inject.Inject;
29+
import java.util.Date;
30+
import java.util.List;
2931

3032
@Component
3133
public class PublicIpQuarantineDaoImpl extends GenericDaoBase<PublicIpQuarantineVO, Long> implements PublicIpQuarantineDao {
3234
private SearchBuilder<PublicIpQuarantineVO> publicIpAddressByIdSearch;
3335

3436
private SearchBuilder<IPAddressVO> ipAddressSearchBuilder;
3537

38+
private SearchBuilder<PublicIpQuarantineVO> quarantinedIpAddressesSearch;
39+
3640
@Inject
3741
IPAddressDao ipAddressDao;
3842

@@ -47,8 +51,16 @@ public void init() {
4751
publicIpAddressByIdSearch.join("quarantineJoin", ipAddressSearchBuilder, ipAddressSearchBuilder.entity().getId(),
4852
publicIpAddressByIdSearch.entity().getPublicIpAddressId(), JoinBuilder.JoinType.INNER);
4953

54+
quarantinedIpAddressesSearch = createSearchBuilder();
55+
quarantinedIpAddressesSearch.and("previousOwnerId", quarantinedIpAddressesSearch.entity().getPreviousOwnerId(), SearchCriteria.Op.NEQ);
56+
quarantinedIpAddressesSearch.and();
57+
quarantinedIpAddressesSearch.op("removedIsNull", quarantinedIpAddressesSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
58+
quarantinedIpAddressesSearch.and("endDate", quarantinedIpAddressesSearch.entity().getEndDate(), SearchCriteria.Op.GT);
59+
quarantinedIpAddressesSearch.cp();
60+
5061
ipAddressSearchBuilder.done();
5162
publicIpAddressByIdSearch.done();
63+
quarantinedIpAddressesSearch.done();
5264
}
5365

5466
@Override
@@ -68,4 +80,14 @@ public PublicIpQuarantineVO findByIpAddress(String publicIpAddress) {
6880

6981
return findOneBy(sc, filter);
7082
}
83+
84+
@Override
85+
public List<PublicIpQuarantineVO> listQuarantinedIpAddressesToUser(Long userId, Date date) {
86+
SearchCriteria<PublicIpQuarantineVO> sc = quarantinedIpAddressesSearch.create();
87+
88+
sc.setParameters("previousOwnerId", userId);
89+
sc.setParameters("endDate", date);
90+
91+
return searchIncludingRemoved(sc, null, false, false);
92+
}
7193
}

engine/storage/snapshot/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
<scope>compile</scope>
5858
</dependency>
5959
<dependency>
60-
<groupId>mysql</groupId>
61-
<artifactId>mysql-connector-java</artifactId>
60+
<groupId>com.mysql</groupId>
61+
<artifactId>mysql-connector-j</artifactId>
6262
<scope>test</scope>
6363
</dependency>
6464
</dependencies>

framework/db/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
<artifactId>commons-pool2</artifactId>
5454
</dependency>
5555
<dependency>
56-
<groupId>mysql</groupId>
57-
<artifactId>mysql-connector-java</artifactId>
56+
<groupId>com.mysql</groupId>
57+
<artifactId>mysql-connector-j</artifactId>
5858
</dependency>
5959
<dependency>
6060
<groupId>org.apache.cloudstack</groupId>

packaging/systemd/cloudstack-management.default

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
JAVA_OPTS="-Djava.security.properties=/etc/cloudstack/management/java.security.ciphers -Djava.awt.headless=true -Xmx2G -XX:+UseParallelGC -XX:MaxGCPauseMillis=500 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/cloudstack/management/ -XX:ErrorFile=/var/log/cloudstack/management/cloudstack-management.err --add-opens=java.base/java.lang=ALL-UNNAMED --add-exports=java.base/sun.security.x509=ALL-UNNAMED"
1919

20-
CLASSPATH="/usr/share/cloudstack-management/lib/*:/etc/cloudstack/management:/usr/share/cloudstack-common:/usr/share/cloudstack-management/setup:/usr/share/cloudstack-management:/usr/share/java/mysql-connector-java.jar:/usr/share/cloudstack-mysql-ha/lib/*"
20+
CLASSPATH="/usr/share/cloudstack-management/lib/*:/etc/cloudstack/management:/usr/share/cloudstack-common:/usr/share/cloudstack-management/setup:/usr/share/cloudstack-management:/usr/share/cloudstack-mysql-ha/lib/*"
2121

2222
BOOTSTRAP_CLASS=org.apache.cloudstack.ServerDaemon
2323

packaging/systemd/cloudstack-usage.default

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
JAVA_OPTS="-Xms256m -Xmx2048m --add-opens=java.base/java.lang=ALL-UNNAMED"
1919

20-
CLASSPATH="/usr/share/cloudstack-usage/*:/usr/share/cloudstack-usage/lib/*:/usr/share/cloudstack-mysql-ha/lib/*:/etc/cloudstack/usage:/usr/share/java/mysql-connector-java.jar"
20+
CLASSPATH="/usr/share/cloudstack-usage/*:/usr/share/cloudstack-usage/lib/*:/usr/share/cloudstack-mysql-ha/lib/*:/etc/cloudstack/usage"
2121

2222
JAVA_CLASS=com.cloud.usage.UsageServer
2323

plugins/network-elements/globodns/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
<artifactId>globodns-client</artifactId>
3434
</dependency>
3535
<dependency>
36-
<groupId>mysql</groupId>
37-
<artifactId>mysql-connector-java</artifactId>
36+
<groupId>com.mysql</groupId>
37+
<artifactId>mysql-connector-j</artifactId>
3838
<scope>test</scope>
3939
</dependency>
4040
</dependencies>

plugins/network-elements/tungsten/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
<artifactId>reload4j</artifactId>
4242
</dependency>
4343
<dependency>
44-
<groupId>mysql</groupId>
45-
<artifactId>mysql-connector-java</artifactId>
44+
<groupId>com.mysql</groupId>
45+
<artifactId>mysql-connector-j</artifactId>
4646
<scope>test</scope>
4747
</dependency>
4848
</dependencies>

plugins/storage/volume/adaptive/src/main/java/org/apache/cloudstack/storage/datastore/lifecycle/AdaptiveDataStoreLifeCycleImpl.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,14 @@ public DataStore initialize(Map<String, Object> dsInfos) {
217217
// validate the provided details are correct/valid for the provider
218218
api.validate();
219219

220-
// if we have user-provided capacity bytes, validate they do not exceed the manaaged storage capacity bytes
220+
// User-provided capacityBytes always wins; validate against storage stats only when
221+
// the provider could actually report them. If the provider cannot (empty pod with no
222+
// footprint, no quota set, transient probe failure), fall through and use what the
223+
// user supplied rather than failing the whole registration.
221224
ProviderVolumeStorageStats stats = api.getManagedStorageStats();
222-
if (capacityBytes != null && capacityBytes != 0 && stats != null) {
223-
if (stats.getCapacityInBytes() > 0) {
224-
if (stats.getCapacityInBytes() < capacityBytes) {
225-
throw new InvalidParameterValueException("Capacity bytes provided exceeds the capacity of the storage endpoint: provided by user: " + capacityBytes + ", storage capacity from storage provider: " + stats.getCapacityInBytes());
226-
}
225+
if (capacityBytes != null && capacityBytes > 0) {
226+
if (stats != null && stats.getCapacityInBytes() > 0 && stats.getCapacityInBytes() < capacityBytes) {
227+
throw new InvalidParameterValueException("Provided capacity bytes exceed the capacity of the storage endpoint: provided by user: " + capacityBytes + ", storage capacity from storage provider: " + stats.getCapacityInBytes());
227228
}
228229
parameters.setCapacityBytes(capacityBytes);
229230
}

0 commit comments

Comments
 (0)