VPC: update default network offering for vpc tier to conserve_mode=1 (#8309)

This PR updates the conserve mode of default vpc tier offering to conserve_mode=1
so we can create both port forwarding and load balancing rules on a public IP in vpc tiers.

This fixes #8313
This commit is contained in:
Wei Zhou 2023-12-18 07:38:51 +01:00 committed by GitHub
parent 16d45f731d
commit 33e2a4dd66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

View File

@ -21,6 +21,8 @@
ALTER TABLE `cloud`.`mshost` MODIFY COLUMN `state` varchar(25); ALTER TABLE `cloud`.`mshost` MODIFY COLUMN `state` varchar(25);
UPDATE `cloud`.`network_offerings` SET conserve_mode=1 WHERE name='DefaultIsolatedNetworkOfferingForVpcNetworks';
-- Invalidate existing console_session records -- Invalidate existing console_session records
UPDATE `cloud`.`console_session` SET removed=now(); UPDATE `cloud`.`console_session` SET removed=now();
-- Modify acquired column in console_session to datetime type -- Modify acquired column in console_session to datetime type

View File

@ -1809,9 +1809,9 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
* ("No redunant router support when network belnogs to VPC"); } * ("No redunant router support when network belnogs to VPC"); }
*/ */
// 4) Conserve mode should be off // 4) Conserve mode should be off in older versions
if (guestNtwkOff.isConserveMode()) { if (guestNtwkOff.isConserveMode()) {
throw new InvalidParameterValueException("Only networks with conserve mode Off can belong to VPC"); s_logger.info("Creating a network with conserve mode in VPC");
} }
// 5) If Netscaler is LB provider make sure it is in dedicated mode // 5) If Netscaler is LB provider make sure it is in dedicated mode

View File

@ -1001,23 +1001,23 @@ class TestVPCNetwork(cloudstackTestCase):
# 1. Create a network offering with guest type=Isolated that has all # 1. Create a network offering with guest type=Isolated that has all
# supported Services(Vpn,dhcpdns,UserData, SourceNat,Static NAT,LB # supported Services(Vpn,dhcpdns,UserData, SourceNat,Static NAT,LB
# and PF,LB,NetworkAcl ) provided by VPCVR and conserve mode is ON # and PF,LB,NetworkAcl ) provided by VPCVR and conserve mode is ON
# 2. Create offering fails since Conserve mode ON isn't allowed within # 2. Create offering should succeed since Conserve mode ON is allowed within
# VPC # VPC since https://github.com/apache/cloudstack/pull/8309
# 3. Repeat test for offering which has Netscaler as external LB # 3. Repeat test for offering which has Netscaler as external LB
# provider # provider
""" """
self.debug("Creating network offering with conserve mode = ON") self.debug("Creating network offering with conserve mode = ON")
with self.assertRaises(Exception): try:
nw = NetworkOffering.create( nw = NetworkOffering.create(
self.apiclient, self.apiclient,
self.services[value], self.services[value],
conservemode=True conservemode=True
) )
self.cleanup.append(nw) self.cleanup.append(nw)
self.debug( except Exception as e:
"Network creation failed as VPC support nw with conserve mode OFF") self.warn("Network creation failed in VPC with conserve mode ON")
return return