Merge remote-tracking branch 'origin/4.18' into 4.19

This commit is contained in:
Vishesh 2024-02-13 11:44:20 +05:30
commit a8028eecbd
No known key found for this signature in database
GPG Key ID: 4E395186CBFA790B
7 changed files with 90 additions and 24 deletions

View File

@ -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) {

View File

@ -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<IPAddressVO> 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

View File

@ -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 = {}

View File

@ -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 """

View File

@ -3054,7 +3054,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",
@ -3090,7 +3091,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.<br/><br/>You may also <strong>add</strong> 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",

View File

@ -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)) {

View File

@ -66,7 +66,6 @@
<a-select-option value="VSP"> VSP </a-select-option>
<a-select-option value="VCS"> VCS </a-select-option>
<a-select-option value="TF"> TF </a-select-option>
<template #suffixIcon>
<a-tooltip
v-if="tungstenNetworkIndex > -1 && tungstenNetworkIndex !== index"
@ -78,14 +77,18 @@
</template>
<template v-if="column.key === 'traffics'">
<div v-for="traffic in record.traffics" :key="traffic.type">
<a-tooltip :title="traffic.type.toUpperCase() + ' (' + traffic.label + ')'">
<a-tag
:color="trafficColors[traffic.type]"
style="margin:2px"
>
{{ traffic.type.toUpperCase() }}
{{ (traffic.type.toUpperCase() + ' (' + traffic.label + ')').slice(0, 20) }}
{{ (traffic.type.toUpperCase() + ' (' + traffic.label + ')').length > 20 ? '...' : '' }}
<edit-outlined class="traffic-type-action" @click="editTraffic(record.key, traffic, $event)"/>
<delete-outlined class="traffic-type-action" @click="deleteTraffic(record.key, traffic, $event)"/>
</a-tag>
</a-tooltip>
</div>
<div v-if="isShowAddTraffic(record.traffics, index)">
<div class="traffic-select-item" v-if="addingTrafficForKey === record.key">
@ -143,6 +146,13 @@
icon="delete-outlined"
@onClick="onDelete(record)" />
</template>
<template v-if="column.key === 'tags'">
<a-input
:disabled="tungstenNetworkIndex > -1 && tungstenNetworkIndex !== index"
:value="text"
@change="e => onCellChange(record.key, 'tags', e.target.value)"
/>
</template>
</template>
<template #footer v-if="isAdvancedZone">
<a-button
@ -177,9 +187,17 @@
centered
>
<div v-ctrl-enter="() => showError = false" >
<span>{{ $t('message.required.traffic.type') }}</span>
<a-list item-layout="horizontal" :dataSource="errorList">
<template #renderItem="{ item }">
<a-list-item>
<exclamation-circle-outlined
:style="{ color: $config.theme['@error-color'], fontSize: '20px', marginRight: '10px' }"
/>
{{ item }}
</a-list-item>
</template>
</a-list>
<div :span="24" class="action-button">
<a-button @click="showError = false">{{ $t('label.cancel') }}</a-button>
<a-button type="primary" ref="submit" @click="showError = false">{{ $t('label.ok') }}</a-button>
</div>
</div>
@ -290,6 +308,7 @@ export default {
addingTrafficForKey: '-1',
trafficLabelSelected: null,
showError: false,
errorList: [],
defaultTrafficOptions: [],
isChangeHyperv: false
}
@ -307,7 +326,7 @@ export default {
key: 'isolationMethod',
title: this.$t('label.isolation.method'),
dataIndex: 'isolationMethod',
width: 150
width: 125
})
columns.push({
key: 'traffics',
@ -315,6 +334,12 @@ export default {
dataIndex: 'traffics',
width: 250
})
columns.push({
title: this.$t('label.tags'),
key: 'tags',
dataIndex: 'tags',
width: 175
})
if (this.isAdvancedZone) {
columns.push({
key: 'actions',
@ -406,7 +431,7 @@ export default {
return { type: item, label: '' }
})
this.count = 1
this.physicalNetworks = [{ key: this.randomKeyTraffic(this.count), name: 'Physical Network 1', isolationMethod: 'VLAN', traffics: traffics }]
this.physicalNetworks = [{ key: this.randomKeyTraffic(this.count), name: 'Physical Network 1', isolationMethod: 'VLAN', traffics: traffics, tags: null }]
}
if (this.isAdvancedZone) {
this.availableTrafficToAdd.push('guest')
@ -447,28 +472,32 @@ export default {
key: this.randomKeyTraffic(count + 1),
name: `Physical Network ${count + 1}`,
isolationMethod: 'VLAN',
traffics: []
traffics: [],
tags: null
}
this.physicalNetworks = [...physicalNetworks, newData]
this.count = count + 1
this.hasUnusedPhysicalNetwork = this.getHasUnusedPhysicalNetwork()
},
isValidSetup () {
this.errorList = []
let physicalNetworks = this.physicalNetworks
if (this.tungstenNetworkIndex > -1) {
physicalNetworks = [this.physicalNetworks[this.tungstenNetworkIndex]]
}
const shouldHaveLabels = physicalNetworks.length > 1
let isValid = true
let countPhysicalNetworkWithoutTags = 0
this.requiredTrafficTypes.forEach(type => {
if (!isValid) return false
let foundType = false
physicalNetworks.forEach(net => {
net.traffics.forEach(traffic => {
if (!isValid) return false
if (traffic.type === type) {
foundType = true
}
if (traffic.type === 'guest' && type === 'guest' && (!net.tags || net.tags.length === 0)) {
countPhysicalNetworkWithoutTags++
}
if (this.hypervisor !== 'VMware') {
if (shouldHaveLabels && (!traffic.label || traffic.label.length === 0)) {
isValid = false
@ -482,8 +511,15 @@ export default {
})
if (!foundType || !isValid) {
isValid = false
if (this.errorList.indexOf(this.$t('message.required.traffic.type')) === -1) {
this.errorList.push(this.$t('message.required.traffic.type'))
}
}
})
if (countPhysicalNetworkWithoutTags > 1) {
this.errorList.push(this.$t('message.required.tagged.physical.network'))
isValid = false
}
return isValid
},
handleSubmit (e) {