Skip to content

Commit 9c2a462

Browse files
committed
Merge remote-tracking branch 'apache/4.17' into main
2 parents 68c09f9 + fa34d68 commit 9c2a462

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

engine/schema/src/main/resources/META-INF/db/schema-41610to41700.sql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,9 +887,8 @@ left join `cloud`.`mshost_status` on
887887
((`cloud`.`mshost`.`uuid` = `cloud`.`mshost_status`.`ms_id`)));
888888

889889
-- Alter event table to add resource_id and resource_type
890-
ALTER TABLE `cloud`.`event`
891-
ADD COLUMN `resource_id` bigint unsigned COMMENT 'ID of the resource associated with the event' AFTER `domain_id`,
892-
ADD COLUMN `resource_type` varchar(32) COMMENT 'Type of the resource associated with the event' AFTER `resource_id`;
890+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.event','resource_id', 'bigint unsigned COMMENT "ID of the resource associated with the event" AFTER `domain_id`');
891+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.event','resource_type', 'VARCHAR(32) COMMENT "Type of the resource associated with the event" AFTER `resource_id`');
893892

894893
DROP VIEW IF EXISTS `cloud`.`event_view`;
895894
CREATE VIEW `cloud`.`event_view` AS

framework/db/src/main/java/com/cloud/utils/db/ConnectionConcierge.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public String resetConnection(String name) {
174174

175175
Connection conn = TransactionLegacy.getStandaloneConnection();
176176
if (conn == null) {
177-
return "Unable to get anotehr db connection";
177+
return "Unable to get another db connection";
178178
}
179179

180180
concierge.reset(conn);
@@ -198,9 +198,13 @@ public String resetKeepAliveTask(int seconds) {
198198
protected void runInContext() {
199199
s_logger.trace("connection concierge keep alive task");
200200
for (Map.Entry<String, ConnectionConcierge> entry : _conns.entrySet()) {
201+
String name = entry.getKey();
201202
ConnectionConcierge concierge = entry.getValue();
202203
if (concierge.keepAlive()) {
203-
testValidity(entry.getKey(), entry.getValue().conn());
204+
if (testValidity(name, concierge.conn()) != null) {
205+
s_logger.info("Resetting DB connection " + name);
206+
resetConnection(name);
207+
}
204208
}
205209
}
206210
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ public void checkNetworkIpv6Upgrade(Network network) throws InsufficientAddressC
502502
ipAddressDao.listByAssociatedVpc(network.getVpcId(), true);
503503
for (IPAddressVO address : addresses) {
504504
VlanVO vlan = vlanDao.findById(address.getVlanId());
505-
final List<VlanVO> ranges = vlanDao.listIpv6RangeByZoneIdAndVlanId(network.getPhysicalNetworkId(), vlan.getVlanTag());
505+
final List<VlanVO> ranges = vlanDao.listIpv6RangeByZoneIdAndVlanId(network.getDataCenterId(), vlan.getVlanTag());
506506
if (CollectionUtils.isEmpty(ranges)) {
507507
s_logger.error(String.format("Unable to find IPv6 address for zone ID: %d, physical network ID: %d, VLAN: %s", network.getDataCenterId(), network.getPhysicalNetworkId(), vlan.getVlanTag()));
508508
InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Insufficient address capacity", DataCenter.class, network.getDataCenterId());

server/src/test/java/com/cloud/network/Ipv6ServiceImplTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,10 @@ public void testCheckNetworkIpv6UpgradeForNoPrefixes() {
593593

594594
@Test
595595
public void testCheckNetworkIpv6UpgradeForNoIpv6Vlan() {
596-
final long physicalNetworkId = 1L;
596+
final long zoneId = 1L;
597597
Mockito.when(dataCenterGuestIpv6PrefixDao.listByDataCenterId(Mockito.anyLong())).thenReturn(List.of(Mockito.mock(DataCenterGuestIpv6PrefixVO.class)));
598598
Network network = Mockito.mock(Network.class);
599-
Mockito.when(network.getPhysicalNetworkId()).thenReturn(physicalNetworkId);
599+
Mockito.when(network.getDataCenterId()).thenReturn(zoneId);
600600
Mockito.when(network.getVpcId()).thenReturn(null);
601601
Mockito.when(ipAddressDao.listByAssociatedNetwork(Mockito.anyLong(), Mockito.anyBoolean())).thenReturn(List.of(Mockito.mock(IPAddressVO.class)));
602602
VlanVO vlanVO = Mockito.mock(VlanVO.class);
@@ -611,16 +611,16 @@ public void testCheckNetworkIpv6UpgradeForNoIpv6Vlan() {
611611

612612
@Test
613613
public void testCheckNetworkIpv6UpgradeForNetwork() {
614-
final long physicalNetworkId = 1L;
614+
final long zoneId = 1L;
615615
Mockito.when(dataCenterGuestIpv6PrefixDao.listByDataCenterId(Mockito.anyLong())).thenReturn(List.of(Mockito.mock(DataCenterGuestIpv6PrefixVO.class)));
616616
Network network = Mockito.mock(Network.class);
617-
Mockito.when(network.getPhysicalNetworkId()).thenReturn(physicalNetworkId);
617+
Mockito.when(network.getDataCenterId()).thenReturn(zoneId);
618618
Mockito.when(network.getVpcId()).thenReturn(null);
619619
Mockito.when(ipAddressDao.listByAssociatedNetwork(Mockito.anyLong(), Mockito.anyBoolean())).thenReturn(List.of(Mockito.mock(IPAddressVO.class)));
620620
VlanVO vlanVO = Mockito.mock(VlanVO.class);
621621
Mockito.when(vlanVO.getVlanTag()).thenReturn(vlan);
622622
Mockito.when(vlanDao.findById(Mockito.anyLong())).thenReturn(vlanVO);
623-
Mockito.when(vlanDao.listIpv6RangeByZoneIdAndVlanId(physicalNetworkId, vlan)).thenReturn(List.of(vlanVO));
623+
Mockito.when(vlanDao.listIpv6RangeByZoneIdAndVlanId(zoneId, vlan)).thenReturn(List.of(vlanVO));
624624
try {
625625
ipv6Service.checkNetworkIpv6Upgrade(network);
626626
} catch (InsufficientAddressCapacityException | ResourceAllocationException e) {

0 commit comments

Comments
 (0)