From 493d6a08d2b948a6fa226867b912e2f041c2efc1 Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Mon, 10 May 2021 20:48:44 +0530 Subject: [PATCH 01/10] ui: Display Zone Name instead of Zone UUID in list view (#5011) --- ui/src/config/section/offering.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/config/section/offering.js b/ui/src/config/section/offering.js index 64678de2daf..b8b2beff3d9 100644 --- a/ui/src/config/section/offering.js +++ b/ui/src/config/section/offering.js @@ -174,7 +174,7 @@ export default { icon: 'cloud-upload', docHelp: 'adminguide/virtual_machines.html#backup-offerings', permission: ['listBackupOfferings', 'listInfrastructure'], - columns: ['name', 'description', 'zoneid'], + columns: ['name', 'description', 'zonename'], details: ['name', 'id', 'description', 'externalid', 'zone', 'created'], actions: [{ api: 'importBackupOffering', From 4ecef4bfb486dd78c8406b4f203c24cb7521117b Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 12 May 2021 16:20:17 +0530 Subject: [PATCH 02/10] ui: prevent same string docHelp override (#5014) Prevent same string docHelp suffix override. List all existing docHelp suffixes in the config file during the build process. Updated apache/cloudstack-documentation#199 Signed-off-by: Abhishek Kumar --- ui/package.json | 2 ++ ui/postbuild.sh | 36 +++++++++++++++++++++++++++++++ ui/prebuild.sh | 47 +++++++++++++++++++++++++++++++++++++++++ ui/public/config.json | 6 +++--- ui/src/utils/plugins.js | 2 +- 5 files changed, 89 insertions(+), 4 deletions(-) create mode 100755 ui/postbuild.sh create mode 100755 ui/prebuild.sh diff --git a/ui/package.json b/ui/package.json index fcc561fb6e3..3879ee92a6c 100644 --- a/ui/package.json +++ b/ui/package.json @@ -24,9 +24,11 @@ "url": "https://github.com/apache/cloudstack/issues" }, "scripts": { + "prebuild": "./prebuild.sh", "start": "vue-cli-service lint --no-fix && vue-cli-service serve", "serve": "vue-cli-service lint --no-fix && vue-cli-service serve", "build": "vue-cli-service build", + "postbuild": "./postbuild.sh", "lint": "vue-cli-service lint", "i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'", "test:unit": "vue-cli-service test:unit" diff --git a/ui/postbuild.sh b/ui/postbuild.sh new file mode 100755 index 00000000000..ab7734f3838 --- /dev/null +++ b/ui/postbuild.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +DIR=$(dirname $0) +configFile="$DIR/public/config.json" +tmpFile="$DIR/public/config.json.tmp" +echo "Post-build: removing all docHelp suffixes in ${configFile}" + +node > ${tmpFile} < ${tmpFile} < 0) { for (var key in docHelpMappings) { - if (docHelp.includes(key)) { + if (docHelp.includes(key) && docHelp !== docHelpMappings[key]) { docHelp = docHelp.replace(key, docHelpMappings[key]) break } From aa289542f01fd838e3573550d24bd8142b2dea0c Mon Sep 17 00:00:00 2001 From: Nicolas Vazquez Date: Thu, 13 May 2021 06:00:34 -0300 Subject: [PATCH 03/10] vmware: Fix deploy-as-is not honoured on upload from local (#5015) * Fix deploy-as-is not honoured on upload from local * Missing param --- .../user/template/GetUploadParamsForTemplateCmd.java | 10 ++++++++++ .../storage/upload/params/TemplateUploadParams.java | 4 ++-- .../cloud/storage/upload/params/UploadParamsBase.java | 6 ++++-- .../java/com/cloud/template/TemplateAdapterBase.java | 4 ++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java index b42b2717b91..2fafe933968 100644 --- a/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java @@ -89,6 +89,11 @@ public class GetUploadParamsForTemplateCmd extends AbstractGetUploadParamsCmd { @Parameter(name = ApiConstants.TEMPLATE_TAG, type = CommandType.STRING, description = "the tag for this template.") private String templateTag; + @Parameter(name=ApiConstants.DEPLOY_AS_IS, + type = CommandType.BOOLEAN, + description = "(VMware only) true if VM deployments should preserve all the configurations defined for this template", since = "4.15.1") + private Boolean deployAsIs; + public String getDisplayText() { return displayText; } @@ -153,6 +158,11 @@ public class GetUploadParamsForTemplateCmd extends AbstractGetUploadParamsCmd { return templateTag; } + public boolean isDeployAsIs() { + return Hypervisor.HypervisorType.VMware.toString().equalsIgnoreCase(hypervisor) && + Boolean.TRUE.equals(deployAsIs); + } + @Override public void execute() throws ServerApiException { validateRequest(); diff --git a/server/src/main/java/com/cloud/storage/upload/params/TemplateUploadParams.java b/server/src/main/java/com/cloud/storage/upload/params/TemplateUploadParams.java index 9dede2ee5a3..31206ca31b3 100644 --- a/server/src/main/java/com/cloud/storage/upload/params/TemplateUploadParams.java +++ b/server/src/main/java/com/cloud/storage/upload/params/TemplateUploadParams.java @@ -29,10 +29,10 @@ public class TemplateUploadParams extends UploadParamsBase { Long zoneId, Hypervisor.HypervisorType hypervisorType, String chksum, String templateTag, long templateOwnerId, Map details, Boolean sshkeyEnabled, - Boolean isDynamicallyScalable, Boolean isRoutingType) { + Boolean isDynamicallyScalable, Boolean isRoutingType, boolean deployAsIs) { super(userId, name, displayText, bits, passwordEnabled, requiresHVM, isPublic, featured, isExtractable, format, guestOSId, zoneId, hypervisorType, chksum, templateTag, templateOwnerId, details, - sshkeyEnabled, isDynamicallyScalable, isRoutingType); + sshkeyEnabled, isDynamicallyScalable, isRoutingType, deployAsIs); setBootable(true); } } diff --git a/server/src/main/java/com/cloud/storage/upload/params/UploadParamsBase.java b/server/src/main/java/com/cloud/storage/upload/params/UploadParamsBase.java index e5bc1a3c906..60ccc27a48f 100644 --- a/server/src/main/java/com/cloud/storage/upload/params/UploadParamsBase.java +++ b/server/src/main/java/com/cloud/storage/upload/params/UploadParamsBase.java @@ -44,6 +44,7 @@ public abstract class UploadParamsBase implements UploadParams { private boolean sshkeyEnabled; private boolean isDynamicallyScalable; private boolean isRoutingType; + private boolean deployAsIs; UploadParamsBase(long userId, String name, String displayText, Integer bits, boolean passwordEnabled, boolean requiresHVM, @@ -52,7 +53,7 @@ public abstract class UploadParamsBase implements UploadParams { Long zoneId, Hypervisor.HypervisorType hypervisorType, String checksum, String templateTag, long templateOwnerId, Map details, boolean sshkeyEnabled, - boolean isDynamicallyScalable, boolean isRoutingType) { + boolean isDynamicallyScalable, boolean isRoutingType, boolean deployAsIs) { this.userId = userId; this.name = name; this.displayText = displayText; @@ -73,6 +74,7 @@ public abstract class UploadParamsBase implements UploadParams { this.sshkeyEnabled = sshkeyEnabled; this.isDynamicallyScalable = isDynamicallyScalable; this.isRoutingType = isRoutingType; + this.deployAsIs = deployAsIs; } UploadParamsBase(long userId, String name, String displayText, boolean isPublic, boolean isFeatured, @@ -216,7 +218,7 @@ public abstract class UploadParamsBase implements UploadParams { @Override public boolean isDeployAsIs() { - return false; + return deployAsIs; } void setIso(boolean iso) { diff --git a/server/src/main/java/com/cloud/template/TemplateAdapterBase.java b/server/src/main/java/com/cloud/template/TemplateAdapterBase.java index 52628ee2e23..290a895adc0 100644 --- a/server/src/main/java/com/cloud/template/TemplateAdapterBase.java +++ b/server/src/main/java/com/cloud/template/TemplateAdapterBase.java @@ -337,7 +337,7 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat params.isExtractable(), params.getFormat(), params.getGuestOSId(), zoneList, params.getHypervisorType(), params.getChecksum(), params.isBootable(), params.getTemplateTag(), owner, params.getDetails(), params.isSshKeyEnabled(), params.getImageStoreUuid(), - params.isDynamicallyScalable(), params.isRoutingType() ? TemplateType.ROUTING : TemplateType.USER, params.isDirectDownload(), false); + params.isDynamicallyScalable(), params.isRoutingType() ? TemplateType.ROUTING : TemplateType.USER, params.isDirectDownload(), params.isDeployAsIs()); } private Long getDefaultDeployAsIsGuestOsId() { @@ -358,7 +358,7 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat BooleanUtils.toBoolean(cmd.isFeatured()), BooleanUtils.toBoolean(cmd.isExtractable()), cmd.getFormat(), osTypeId, cmd.getZoneId(), HypervisorType.getType(cmd.getHypervisor()), cmd.getChecksum(), cmd.getTemplateTag(), cmd.getEntityOwnerId(), cmd.getDetails(), BooleanUtils.toBoolean(cmd.isSshKeyEnabled()), - BooleanUtils.toBoolean(cmd.isDynamicallyScalable()), BooleanUtils.toBoolean(cmd.isRoutingType())); + BooleanUtils.toBoolean(cmd.isDynamicallyScalable()), BooleanUtils.toBoolean(cmd.isRoutingType()), cmd.isDeployAsIs()); return prepareUploadParamsInternal(params); } From 1b28ea1ebb81f4a61bc7d705ffaa1563794030be Mon Sep 17 00:00:00 2001 From: Wei Zhou <57355700+weizhouapache@users.noreply.github.com> Date: Thu, 13 May 2021 11:01:47 +0200 Subject: [PATCH 04/10] network: fix dhcp/password/metadata issues on shared networks with multiple subnets (#5013) * #4943: apply iptables for password and metadata * #4943: fix wrong ip alias * #4943: revert previous change and add ip_aliases Co-authored-by: Wei Zhou --- .../com/cloud/network/IpAddressManager.java | 3 +- .../cloud/network/IpAddressManagerImpl.java | 28 +++++++++++-------- .../cloud/network/rules/DhcpSubNetRules.java | 6 ++-- .../cloud/server/ManagementServerImpl.java | 2 +- systemvm/debian/opt/cloud/bin/configure.py | 1 + 5 files changed, 24 insertions(+), 16 deletions(-) diff --git a/engine/components-api/src/main/java/com/cloud/network/IpAddressManager.java b/engine/components-api/src/main/java/com/cloud/network/IpAddressManager.java index 0a50e4b29df..61489e5f7c8 100644 --- a/engine/components-api/src/main/java/com/cloud/network/IpAddressManager.java +++ b/engine/components-api/src/main/java/com/cloud/network/IpAddressManager.java @@ -185,7 +185,7 @@ public interface IpAddressManager { IpAddress allocateIp(Account ipOwner, boolean isSystem, Account caller, long callerId, DataCenter zone, Boolean displayIp, String ipaddress) throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException; - PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List vlanDbIds, Long networkId, String requestedIp, boolean isSystem) + PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List vlanDbIds, Long networkId, String requestedIp, String requestedGateway, boolean isSystem) throws InsufficientAddressCapacityException; PublicIp getAvailablePublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List vlanDbIds, Long networkId, String requestedIp, boolean isSystem) @@ -219,6 +219,7 @@ public interface IpAddressManager { final boolean assign, final boolean allocate, final String requestedIp, + final String requestedGateway, final boolean isSystem, final Long vpcId, final Boolean displayIp, diff --git a/server/src/main/java/com/cloud/network/IpAddressManagerImpl.java b/server/src/main/java/com/cloud/network/IpAddressManagerImpl.java index 2f630cfa682..99c9ae4c779 100644 --- a/server/src/main/java/com/cloud/network/IpAddressManagerImpl.java +++ b/server/src/main/java/com/cloud/network/IpAddressManagerImpl.java @@ -476,6 +476,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage SearchBuilder vlanSearch = _vlanDao.createSearchBuilder(); vlanSearch.and("type", vlanSearch.entity().getVlanType(), Op.EQ); vlanSearch.and("networkId", vlanSearch.entity().getNetworkId(), Op.EQ); + vlanSearch.and("vlanGateway", vlanSearch.entity().getVlanGateway(), Op.EQ); AssignIpAddressSearch.join("vlan", vlanSearch, vlanSearch.entity().getId(), AssignIpAddressSearch.entity().getVlanId(), JoinType.INNER); AssignIpAddressSearch.done(); @@ -487,6 +488,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage SearchBuilder podVlanSearch = _vlanDao.createSearchBuilder(); podVlanSearch.and("type", podVlanSearch.entity().getVlanType(), Op.EQ); podVlanSearch.and("networkId", podVlanSearch.entity().getNetworkId(), Op.EQ); + podVlanSearch.and("vlanGateway", podVlanSearch.entity().getVlanGateway(), Op.EQ); SearchBuilder podVlanMapSB = _podVlanMapDao.createSearchBuilder(); podVlanMapSB.and("podId", podVlanMapSB.entity().getPodId(), Op.EQ); AssignIpAddressFromPodVlanSearch.join("podVlanMapSB", podVlanMapSB, podVlanMapSB.entity().getVlanDbId(), AssignIpAddressFromPodVlanSearch.entity().getVlanId(), @@ -755,34 +757,34 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage @Override public PublicIp assignPublicIpAddress(long dcId, Long podId, Account owner, VlanType type, Long networkId, String requestedIp, boolean isSystem, boolean forSystemVms) throws InsufficientAddressCapacityException { - return fetchNewPublicIp(dcId, podId, null, owner, type, networkId, false, true, requestedIp, isSystem, null, null, forSystemVms); + return fetchNewPublicIp(dcId, podId, null, owner, type, networkId, false, true, requestedIp, null, isSystem, null, null, forSystemVms); } @Override - public PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List vlanDbIds, Long networkId, String requestedIp, boolean isSystem) + public PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List vlanDbIds, Long networkId, String requestedIp, String requestedGateway, boolean isSystem) throws InsufficientAddressCapacityException { - return fetchNewPublicIp(dcId, podId, vlanDbIds, owner, type, networkId, false, true, requestedIp, isSystem, null, null, false); + return fetchNewPublicIp(dcId, podId, vlanDbIds, owner, type, networkId, false, true, requestedIp, requestedGateway, isSystem, null, null, false); } @Override public PublicIp getAvailablePublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List vlanDbIds, Long networkId, String requestedIp, boolean isSystem) throws InsufficientAddressCapacityException { - return fetchNewPublicIp(dcId, podId, vlanDbIds, owner, type, networkId, false, false, false, requestedIp, isSystem, null, null, false); + return fetchNewPublicIp(dcId, podId, vlanDbIds, owner, type, networkId, false, false, false, requestedIp, null, isSystem, null, null, false); } @DB public PublicIp fetchNewPublicIp(final long dcId, final Long podId, final List vlanDbIds, final Account owner, final VlanType vlanUse, final Long guestNetworkId, - final boolean sourceNat, final boolean allocate, final String requestedIp, final boolean isSystem, final Long vpcId, final Boolean displayIp, final boolean forSystemVms) + final boolean sourceNat, final boolean allocate, final String requestedIp, final String requestedGateway, final boolean isSystem, final Long vpcId, final Boolean displayIp, final boolean forSystemVms) throws InsufficientAddressCapacityException { return fetchNewPublicIp(dcId, podId, vlanDbIds, owner, vlanUse, guestNetworkId, - sourceNat, true, allocate, requestedIp, isSystem, vpcId, displayIp, forSystemVms); + sourceNat, true, allocate, requestedIp, requestedGateway, isSystem, vpcId, displayIp, forSystemVms); } @DB public PublicIp fetchNewPublicIp(final long dcId, final Long podId, final List vlanDbIds, final Account owner, final VlanType vlanUse, final Long guestNetworkId, - final boolean sourceNat, final boolean assign, final boolean allocate, final String requestedIp, final boolean isSystem, final Long vpcId, final Boolean displayIp, final boolean forSystemVms) + final boolean sourceNat, final boolean assign, final boolean allocate, final String requestedIp, final String requestedGateway, final boolean isSystem, final Long vpcId, final Boolean displayIp, final boolean forSystemVms) throws InsufficientAddressCapacityException { - List addrs = listAvailablePublicIps(dcId, podId, vlanDbIds, owner, vlanUse, guestNetworkId, sourceNat, assign, allocate, requestedIp, isSystem, vpcId, displayIp, forSystemVms, true); + List addrs = listAvailablePublicIps(dcId, podId, vlanDbIds, owner, vlanUse, guestNetworkId, sourceNat, assign, allocate, requestedIp, requestedGateway, isSystem, vpcId, displayIp, forSystemVms, true); IPAddressVO addr = addrs.get(0); if (vlanUse == VlanType.VirtualNetwork) { _firewallMgr.addSystemFirewallRules(addr, owner); @@ -793,7 +795,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage @Override public List listAvailablePublicIps(final long dcId, final Long podId, final List vlanDbIds, final Account owner, final VlanType vlanUse, final Long guestNetworkId, - final boolean sourceNat, final boolean assign, final boolean allocate, final String requestedIp, final boolean isSystem, + final boolean sourceNat, final boolean assign, final boolean allocate, final String requestedIp, final String requestedGateway, final boolean isSystem, final Long vpcId, final Boolean displayIp, final boolean forSystemVms, final boolean lockOneRow) throws InsufficientAddressCapacityException { return Transaction.execute(new TransactionCallbackWithException, InsufficientAddressCapacityException>() { @Override @@ -864,6 +866,10 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage sc.setJoinParameters("vlan", "networkId", guestNetworkId); errorMessage.append(", network id=" + guestNetworkId); } + if (requestedGateway != null) { + sc.setJoinParameters("vlan", "vlanGateway", requestedGateway); + errorMessage.append(", requested gateway=" + requestedGateway); + } sc.setJoinParameters("vlan", "type", vlanUse); if (requestedIp != null) { @@ -1023,7 +1029,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage VpcVO vpc = _vpcDao.findById(vpcId); displayIp = vpc.isDisplay(); } - return fetchNewPublicIp(dcId, null, null, owner, VlanType.VirtualNetwork, guestNtwkId, isSourceNat, true, null, false, vpcId, displayIp, false); + return fetchNewPublicIp(dcId, null, null, owner, VlanType.VirtualNetwork, guestNtwkId, isSourceNat, true, null, null, false, vpcId, displayIp, false); } }); if (ip.getState() != State.Allocated) { @@ -1219,7 +1225,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage ip = Transaction.execute(new TransactionCallbackWithException() { @Override public PublicIp doInTransaction(TransactionStatus status) throws InsufficientAddressCapacityException { - PublicIp ip = fetchNewPublicIp(zone.getId(), null, null, ipOwner, vlanType, null, false, assign, ipaddress, isSystem, null, displayIp, false); + PublicIp ip = fetchNewPublicIp(zone.getId(), null, null, ipOwner, vlanType, null, false, assign, ipaddress, null, isSystem, null, displayIp, false); if (ip == null) { InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Unable to find available public IP addresses", DataCenter.class, zone diff --git a/server/src/main/java/com/cloud/network/rules/DhcpSubNetRules.java b/server/src/main/java/com/cloud/network/rules/DhcpSubNetRules.java index ed5513795a3..dd12acd8972 100644 --- a/server/src/main/java/com/cloud/network/rules/DhcpSubNetRules.java +++ b/server/src/main/java/com/cloud/network/rules/DhcpSubNetRules.java @@ -123,10 +123,10 @@ public class DhcpSubNetRules extends RuleApplier { IpAddressManager ipAddrMgr = visitor.getVirtualNetworkApplianceFactory().getIpAddrMgr(); if (dc.getNetworkType() == NetworkType.Basic) { routerPublicIP = ipAddrMgr.assignPublicIpAddressFromVlans(_router.getDataCenterId(), vm.getPodIdToDeployIn(), caller, Vlan.VlanType.DirectAttached, - vlanDbIdList, _nic.getNetworkId(), null, false); + vlanDbIdList, _nic.getNetworkId(), null, _nic.getIPv4Gateway(), false); } else { routerPublicIP = ipAddrMgr.assignPublicIpAddressFromVlans(_router.getDataCenterId(), null, caller, Vlan.VlanType.DirectAttached, vlanDbIdList, - _nic.getNetworkId(), null, false); + _nic.getNetworkId(), null, _nic.getIPv4Gateway(), false); } _routerAliasIp = routerPublicIP.getAddress().addr(); @@ -171,4 +171,4 @@ public class DhcpSubNetRules extends RuleApplier { public String getRouterAliasIp() { return _routerAliasIp; } -} \ No newline at end of file +} diff --git a/server/src/main/java/com/cloud/server/ManagementServerImpl.java b/server/src/main/java/com/cloud/server/ManagementServerImpl.java index 44024e75650..65204e82335 100644 --- a/server/src/main/java/com/cloud/server/ManagementServerImpl.java +++ b/server/src/main/java/com/cloud/server/ManagementServerImpl.java @@ -2178,7 +2178,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe long dcId = dc.getId(); try { freeAddrs.addAll(_ipAddressMgr.listAvailablePublicIps(dcId, null, vlanDbIds, owner, VlanType.VirtualNetwork, associatedNetworkId, - false, false, false, null, false, cmd.getVpcId(), cmd.isDisplay(), false, false)); // Free + false, false, false, null, null, false, cmd.getVpcId(), cmd.isDisplay(), false, false)); // Free } catch (InsufficientAddressCapacityException e) { s_logger.warn("no free address is found in zone " + dcId); } diff --git a/systemvm/debian/opt/cloud/bin/configure.py b/systemvm/debian/opt/cloud/bin/configure.py index d0a83abd855..8fdf134b506 100755 --- a/systemvm/debian/opt/cloud/bin/configure.py +++ b/systemvm/debian/opt/cloud/bin/configure.py @@ -1070,6 +1070,7 @@ def main(argv): config.address().process() databag_map = OrderedDict([("guest_network", {"process_iptables": True, "executor": []}), + ("ip_aliases", {"process_iptables": True, "executor": []}), ("vm_password", {"process_iptables": False, "executor": [CsPassword("vmpassword", config)]}), ("vm_metadata", {"process_iptables": False, "executor": [CsVmMetadata('vmdata', config)]}), ("network_acl", {"process_iptables": True, "executor": []}), From 57c82866020a635a46b8253c901a839c48ec5389 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 14 May 2021 23:13:43 +0530 Subject: [PATCH 05/10] ui: pass podid for basic zone createvlaniprange (#5022) While add IP range for a basic zone, podid parameter must be passed with createVlanIpRange. Signed-off-by: Abhishek Kumar --- ui/src/views/network/CreateVlanIpRange.vue | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/ui/src/views/network/CreateVlanIpRange.vue b/ui/src/views/network/CreateVlanIpRange.vue index 80c3b7425e0..60f638ee423 100644 --- a/ui/src/views/network/CreateVlanIpRange.vue +++ b/ui/src/views/network/CreateVlanIpRange.vue @@ -23,6 +23,17 @@ :form="form" @submit="handleSubmit" layout="vertical"> + + + {{ pod.name }} + + {{ $t('label.gateway') }} @@ -195,6 +206,8 @@ export default { data () { return { loading: false, + zone: {}, + pods: [], ipV4Regex: /^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i, ipV6Regex: /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i } @@ -206,8 +219,41 @@ export default { this.apiConfig.params.forEach(param => { this.apiParams[param.name] = param }) + this.fetchData() }, methods: { + async fetchData () { + await this.fetchZone() + if (this.zone.networktype === 'Basic') { + this.fetchPods() + } + }, + fetchZone () { + return new Promise((resolve, reject) => { + this.loading = true + api('listZones', { id: this.resource.zoneid }).then(json => { + this.zone = json.listzonesresponse.zone[0] || {} + resolve(this.zone) + }).catch(error => { + this.$notifyError(error) + reject(error) + }).finally(() => { + this.loading = false + }) + }) + }, + fetchPods () { + this.loading = true + api('listPods', { + zoneid: this.resource.zoneid + }).then(response => { + this.pods = response.listpodsresponse.pod ? response.listpodsresponse.pod : [] + }).catch(error => { + this.$notifyError(error) + }).finally(() => { + this.loading = false + }) + }, handleSubmit (e) { e.preventDefault() @@ -219,6 +265,9 @@ export default { const params = {} params.forVirtualNetwork = false params.networkid = this.resource.id + if (values.podid) { + params.podid = values.podid + } params.gateway = values.gateway params.netmask = values.netmask params.startip = values.startip From cc7f4265640d6faf8f50ce2e5892da5a6913241d Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Fri, 14 May 2021 23:14:12 +0530 Subject: [PATCH 06/10] ui: Allow IP range creation for Physical Network - Guest Traffic in Basic Zones (#5020) * ui: Allow IP range creation for Physical Network - Guest Traffic * get guest network only for basic zone --- .../views/infra/network/IpRangesTabGuest.vue | 1 - .../views/infra/network/IpRangesTabPublic.vue | 87 +++++++++++++++---- .../views/infra/network/TrafficTypesTab.vue | 55 ++++++++++-- 3 files changed, 118 insertions(+), 25 deletions(-) diff --git a/ui/src/views/infra/network/IpRangesTabGuest.vue b/ui/src/views/infra/network/IpRangesTabGuest.vue index 58e1e659215..29a62ff8e8b 100644 --- a/ui/src/views/infra/network/IpRangesTabGuest.vue +++ b/ui/src/views/infra/network/IpRangesTabGuest.vue @@ -149,7 +149,6 @@ export default { page: this.page, pagesize: this.pageSize }).then(response => { - console.log(response) this.items = response.listnetworksresponse.network ? response.listnetworksresponse.network : [] this.total = response.listnetworksresponse.count || 0 }).catch(error => { diff --git a/ui/src/views/infra/network/IpRangesTabPublic.vue b/ui/src/views/infra/network/IpRangesTabPublic.vue index 3d96b416f01..9564ea1683f 100644 --- a/ui/src/views/infra/network/IpRangesTabPublic.vue +++ b/ui/src/views/infra/network/IpRangesTabPublic.vue @@ -34,20 +34,20 @@ :rowKey="record => record.id" :pagination="false" > -