Skip to content

Commit 45eba18

Browse files
committed
Revert default VPC offerings conserve mode
1 parent 9e3eeb7 commit 45eba18

File tree

3 files changed

+32
-10
lines changed

3 files changed

+32
-10
lines changed

engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ CREATE TABLE IF NOT EXISTS `cloud`.`webhook_filter` (
5050
CONSTRAINT `fk_webhook_filter__webhook_id` FOREIGN KEY(`webhook_id`) REFERENCES `webhook`(`id`) ON DELETE CASCADE
5151
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
5252

53-
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vpc_offerings','conserve_mode', 'tinyint(1) unsigned NULL DEFAULT 0');
54-
UPDATE `cloud`.`vpc_offerings` SET conserve_mode=1 WHERE name='Default VPC offering';
53+
-- Add conserve mode for VPC offerings
54+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vpc_offerings','conserve_mode', 'tinyint(1) unsigned NULL DEFAULT 0 COMMENT ''True if the VPC offering is IP conserve mode enabled, allowing public IP services to be used across multiple VPC tiers'' ');

server/src/main/java/com/cloud/network/vpc/VpcManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
388388
}
389389
createVpcOffering(VpcOffering.defaultVPCOfferingName, VpcOffering.defaultVPCOfferingName, svcProviderMap,
390390
true, State.Enabled, null, false,
391-
false, false, null, null, false, true);
391+
false, false, null, null, false, false);
392392
}
393393

394394
// configure default vpc offering with Netscaler as LB Provider
@@ -429,7 +429,7 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
429429
}
430430
}
431431
createVpcOffering(VpcOffering.redundantVPCOfferingName, VpcOffering.redundantVPCOfferingName, svcProviderMap, true, State.Enabled,
432-
null, false, false, true, null, null, false, true);
432+
null, false, false, true, null, null, false, false);
433433
}
434434

435435
// configure default vpc offering with NSX as network service provider in NAT mode

ui/src/views/network/PublicIpResource.vue

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ export default {
135135
return
136136
}
137137
if (this.resource && this.resource.vpcid) {
138+
const vpc = await this.fetchVpc()
139+
140+
// VPC IPs with source nat have only VPN when VPC offering conserve mode = false
141+
if (this.resource.issourcenat && vpc.vpcofferingconservemode === false) {
142+
this.tabs = this.defaultTabs.concat(this.$route.meta.tabs.filter(tab => tab.name === 'vpn'))
143+
return
144+
}
145+
138146
// VPC IPs with static nat have nothing
139147
if (this.resource.isstaticnat) {
140148
if (this.resource.virtualmachinetype === 'DomainRouter') {
@@ -148,14 +156,13 @@ export default {
148156
149157
const network = await this.fetchNetwork()
150158
if (network && network.networkofferingconservemode) {
151-
this.tabs = tabs
152-
return
153-
} else {
154-
// VPC IPs with source nat have only VPN when conserve mode = false
155-
if (this.resource.issourcenat) {
159+
// VPC IPs with source nat have only VPN when VPC offering conserve mode = false
160+
if (this.resource.issourcenat && vpc.vpcofferingconservemode === false) {
156161
this.tabs = this.defaultTabs.concat(this.$route.meta.tabs.filter(tab => tab.name === 'vpn'))
157-
return
162+
} else {
163+
this.tabs = tabs
158164
}
165+
return
159166
}
160167
161168
this.portFWRuleCount = await this.fetchPortFWRule()
@@ -193,6 +200,21 @@ export default {
193200
fetchAction () {
194201
this.actions = this.$route.meta.actions || []
195202
},
203+
fetchVpc () {
204+
if (!this.resource.vpcid) {
205+
return null
206+
}
207+
return new Promise((resolve, reject) => {
208+
getAPI('listVPCs', {
209+
id: this.resource.vpcid
210+
}).then(json => {
211+
const vpc = json.listvpcsresponse?.vpc?.[0] || null
212+
resolve(vpc)
213+
}).catch(e => {
214+
reject(e)
215+
})
216+
})
217+
},
196218
fetchNetwork () {
197219
if (!this.resource.associatednetworkid) {
198220
return null

0 commit comments

Comments
 (0)