diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java index 6b5fac0e942..1165556d5f4 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java @@ -2200,7 +2200,7 @@ public class LibvirtVMDef { public static class WatchDogDef { enum WatchDogModel { - I6300ESB("i6300esb"), IB700("ib700"), DIAG288("diag288"); + I6300ESB("i6300esb"), IB700("ib700"), DIAG288("diag288"), ITCO("itco"); String model; WatchDogModel(String model) { @@ -2214,7 +2214,7 @@ public class LibvirtVMDef { } enum WatchDogAction { - RESET("reset"), SHUTDOWN("shutdown"), POWEROFF("poweroff"), PAUSE("pause"), NONE("none"), DUMP("dump"); + RESET("reset"), SHUTDOWN("shutdown"), POWEROFF("poweroff"), PAUSE("pause"), NONE("none"), DUMP("dump"), INJECT_NMI("inject-nmi"); String action; WatchDogAction(String action) { diff --git a/server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java index 18801eb01fd..aebeb5c9398 100644 --- a/server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java +++ b/server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java @@ -27,6 +27,7 @@ import java.util.Map; import javax.inject.Inject; import javax.naming.ConfigurationException; +import org.apache.commons.collections.CollectionUtils; import org.apache.log4j.Logger; import org.springframework.stereotype.Component; @@ -294,7 +295,23 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian } } - return super.finalizeVirtualMachineProfile(profile, dest, context); + super.finalizeVirtualMachineProfile(profile, dest, context); + appendSourceNatIpToBootArgs(profile); + return true; + } + + private void appendSourceNatIpToBootArgs(final VirtualMachineProfile profile) { + final StringBuilder buf = profile.getBootArgsBuilder(); + final DomainRouterVO router = _routerDao.findById(profile.getVirtualMachine().getId()); + if (router != null && router.getVpcId() != null) { + List vpcIps = _ipAddressDao.listByAssociatedVpc(router.getVpcId(), true); + if (CollectionUtils.isNotEmpty(vpcIps)) { + buf.append(String.format(" source_nat_ip=%s", vpcIps.get(0).getAddress().toString())); + if (s_logger.isDebugEnabled()) { + s_logger.debug("The final Boot Args for " + profile + ": " + buf); + } + } + } } @Override diff --git a/systemvm/debian/opt/cloud/bin/cs/CsAddress.py b/systemvm/debian/opt/cloud/bin/cs/CsAddress.py index a8634a75ae3..3cb782daf7a 100755 --- a/systemvm/debian/opt/cloud/bin/cs/CsAddress.py +++ b/systemvm/debian/opt/cloud/bin/cs/CsAddress.py @@ -453,8 +453,8 @@ class CsIP: ["", "", "-A NETWORK_STATS_%s -o %s ! -i eth0 -p tcp" % (self.dev, self.dev)]) self.fw.append( ["", "", "-A NETWORK_STATS_%s -i %s ! -o eth0 -p tcp" % (self.dev, self.dev)]) - self.fw.append(["nat", "", - "-A POSTROUTING -o %s -j SNAT --to-source %s" % (self.dev, self.cl.get_eth2_ip())]) + self.fw.append( + ["nat", "", "-A POSTROUTING -o %s -j SNAT --to-source %s" % (self.dev, self.cl.get_eth2_ip())]) self.fw.append(["mangle", "", "-A PREROUTING -i %s -m state --state NEW " % self.dev + "-j CONNMARK --set-xmark %s/0xffffffff" % self.dnum]) @@ -695,6 +695,9 @@ class CsIP: ["filter", 3, "-A FORWARD -s %s ! -d %s -j ACCEPT" % (vpccidr, vpccidr)]) self.fw.append( ["nat", "", "-A POSTROUTING -j SNAT -o %s --to-source %s" % (self.dev, self.address['public_ip'])]) + elif cmdline.get_source_nat_ip() and not self.is_private_gateway(): + self.fw.append( + ["nat", "", "-A POSTROUTING -j SNAT -o %s --to-source %s" % (self.dev, cmdline.get_source_nat_ip())]) def list(self): self.iplist = {} diff --git a/systemvm/debian/opt/cloud/bin/cs/CsDatabag.py b/systemvm/debian/opt/cloud/bin/cs/CsDatabag.py index c000611af48..f2de92304ea 100755 --- a/systemvm/debian/opt/cloud/bin/cs/CsDatabag.py +++ b/systemvm/debian/opt/cloud/bin/cs/CsDatabag.py @@ -181,6 +181,12 @@ class CsCmdLine(CsDataBag): return False return "%s/%s" % (self.idata()[ipkey], self.idata()[prelenkey]) + def get_source_nat_ip(self): + if "source_nat_ip" in self.idata(): + return self.idata()['source_nat_ip'] + return False + + class CsGuestNetwork(CsDataBag): """ Get guestnetwork config parameters """ diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json index ddb4aeac64c..39e12a9517e 100644 --- a/ui/public/locales/en.json +++ b/ui/public/locales/en.json @@ -3055,7 +3055,8 @@ "message.remove.vpc": "Please confirm that you want to remove the VPC", "message.request.failed": "Request failed.", "message.required.add.least.ip": "Please add at least 1 IP Range", -"message.required.traffic.type": "Error in configuration! All required traffic types should be added and with multiple physical Networks each Network should have a label.", +"message.required.traffic.type": "All required traffic types should be added and with multiple physical networks each network should have a label.", +"message.required.tagged.physical.network": "There can only be one untagged physical network with guest traffic type.", "message.reset.vpn.connection": "Please confirm that you want to reset VPN connection.", "message.resize.volume.failed": "Failed to resize volume.", "message.resize.volume.processing": "Volume resize is in progress", @@ -3091,7 +3092,7 @@ "message.set.default.nic": "Please confirm that you would like to make this NIC the default for this Instance.", "message.set.default.nic.manual": "Please manually update the default NIC on the Instance now.", "message.setting.updated": "Setting Updated:", -"message.setup.physical.network.during.zone.creation": "When adding a zone, you need to set up one or more physical Networks. Each Network corresponds to a NIC on the hypervisor. Each physical Network can carry one or more types of traffic, with certain restrictions on how they may be combined. Add or remove one or more traffic types onto each physical Network.", +"message.setup.physical.network.during.zone.creation": "When adding a zone, you need to set up one or more physical networks. Each physical network can carry one or more types of traffic, with certain restrictions on how they may be combined. Add or remove one or more traffic types onto each physical network.", "message.setup.physical.network.during.zone.creation.basic": "When adding a basic zone, you can set up one physical Network, which corresponds to a NIC on the hypervisor. The Network carries several types of traffic.

You may also add other traffic types onto the physical Network.", "message.shared.network.offering.warning": "Domain admins and regular Users can only create shared Networks from Network offering with the setting specifyvlan=false. Please contact an administrator to create a Network offering if this list is empty.", "message.shutdown.triggered": "A shutdown has been triggered. CloudStack will not accept new jobs", diff --git a/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue b/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue index ce8769801cf..929b0bf02cd 100644 --- a/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue +++ b/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue @@ -466,6 +466,9 @@ export default { if (physicalNetwork.isolationMethod) { params.isolationmethods = physicalNetwork.isolationMethod } + if (physicalNetwork.tags) { + params.tags = physicalNetwork.tags + } try { if (!this.stepData.stepMove.includes('createPhysicalNetwork' + index)) { diff --git a/ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue b/ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue index e424ddccc16..55bf1ebd663 100644 --- a/ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue +++ b/ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue @@ -66,7 +66,6 @@ VSP VCS TF -