From 195385f5b9c18a4a214dd14ae23e7d9fae36de0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Beims=20Br=C3=A4scher?= Date: Fri, 12 Jun 2020 01:39:50 -0300 Subject: [PATCH] ui: Allow set IPv6 when deploying advanced network Zone with SG via UI (#4083) Advanced Network with Security Groups is a great option for deploying a Zone with IPv6 address support. However, it is not possible to set IPv6 DNS + IPv6 CIDR + IPv6 gateway via the zoneWizard UI. Currently, the workaround is to either (i) create a new network (the default guest network would not support IPv6), (ii) deploy a zone via API, or (iii) to run a MySQL update query to set the default guest network IPv6 config. This PR adds a small enhancement on the UI Zone deployment to allow deploying a Zone with Advanced Network with Security Groups + IPv6 CIDR, IPv6 gateway, and IPv6 DNS. Note that API [1] offers full support for such action, therefore there is no need for changing the API. It is just a small enhancement on UI that might be useful in the meantime that we wait for the new ACS UI. [1] https://cloudstack.apache.org/api/apidocs-4.13/apis/createNetwork.html --- ui/scripts/zoneWizard.js | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js index 785f3884765..f4d0e5db521 100755 --- a/ui/scripts/zoneWizard.js +++ b/ui/scripts/zoneWizard.js @@ -406,6 +406,9 @@ args.$form.find('[rel=ip6dns1]').hide(); args.$form.find('[rel=ip6dns2]').hide(); + + args.$form.find('[rel=ip6cidr]').hide(); + args.$form.find('[rel=ip6gateway]').hide(); } else { //Advanced zone if (args.data["zone-advanced-sg-enabled"] != "on") { //Advanced SG-disabled zone args.$form.find('[rel=networkOfferingId]').hide(); @@ -413,12 +416,18 @@ args.$form.find('[rel=ip6dns1]').show(); args.$form.find('[rel=ip6dns2]').show(); + + args.$form.find('[rel=ip6cidr]').hide(); + args.$form.find('[rel=ip6gateway]').hide(); } else { //Advanced SG-enabled zone args.$form.find('[rel=networkOfferingId]').show(); //will be used to create a guest network during zone creation args.$form.find('[rel=guestcidraddress]').hide(); - args.$form.find('[rel=ip6dns1]').hide(); - args.$form.find('[rel=ip6dns2]').hide(); + args.$form.find('[rel=ip6dns1]').show(); + args.$form.find('[rel=ip6dns2]').show(); + + args.$form.find('[rel=ip6cidr]').show(); + args.$form.find('[rel=ip6gateway]').show(); } } }, @@ -461,6 +470,21 @@ } }, + ip6cidr: { + label: 'label.ipv6.CIDR', + validation: { + required: false, + ipv6cidr: true + } + }, + ip6gateway: { + label: 'label.ipv6.gateway', + validation: { + required: false, + ipv6: true + } + }, + internaldns1: { label: 'label.internal.dns.1', validation: { @@ -3878,6 +3902,16 @@ endip: args.data.guestTraffic.guestEndIp }); } + if (args.data.zone.ip6cidr != null && args.data.zone.ip6cidr.length > 0) { + $.extend(data, { + ip6cidr: args.data.zone.ip6cidr + }); + } + if (args.data.zone.ip6gateway != null && args.data.zone.ip6gateway.length > 0) { + $.extend(data, { + ip6gateway: args.data.zone.ip6gateway + }); + } } $.ajax({