Skip to content

Commit bda49ab

Browse files
committed
Merge remote-tracking branch 'shapeblue/merged-4-18' into 4.19
2 parents 1955d8f + a8028ee commit bda49ab

File tree

7 files changed

+90
-24
lines changed

7 files changed

+90
-24
lines changed

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,7 +2200,7 @@ public String toString() {
22002200

22012201
public static class WatchDogDef {
22022202
enum WatchDogModel {
2203-
I6300ESB("i6300esb"), IB700("ib700"), DIAG288("diag288");
2203+
I6300ESB("i6300esb"), IB700("ib700"), DIAG288("diag288"), ITCO("itco");
22042204
String model;
22052205

22062206
WatchDogModel(String model) {
@@ -2214,7 +2214,7 @@ public String toString() {
22142214
}
22152215

22162216
enum WatchDogAction {
2217-
RESET("reset"), SHUTDOWN("shutdown"), POWEROFF("poweroff"), PAUSE("pause"), NONE("none"), DUMP("dump");
2217+
RESET("reset"), SHUTDOWN("shutdown"), POWEROFF("poweroff"), PAUSE("pause"), NONE("none"), DUMP("dump"), INJECT_NMI("inject-nmi");
22182218
String action;
22192219

22202220
WatchDogAction(String action) {

server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import javax.inject.Inject;
2828
import javax.naming.ConfigurationException;
2929

30+
import org.apache.commons.collections.CollectionUtils;
3031
import org.apache.log4j.Logger;
3132
import org.springframework.stereotype.Component;
3233

@@ -294,7 +295,23 @@ public boolean finalizeVirtualMachineProfile(final VirtualMachineProfile profile
294295
}
295296
}
296297

297-
return super.finalizeVirtualMachineProfile(profile, dest, context);
298+
super.finalizeVirtualMachineProfile(profile, dest, context);
299+
appendSourceNatIpToBootArgs(profile);
300+
return true;
301+
}
302+
303+
private void appendSourceNatIpToBootArgs(final VirtualMachineProfile profile) {
304+
final StringBuilder buf = profile.getBootArgsBuilder();
305+
final DomainRouterVO router = _routerDao.findById(profile.getVirtualMachine().getId());
306+
if (router != null && router.getVpcId() != null) {
307+
List<IPAddressVO> vpcIps = _ipAddressDao.listByAssociatedVpc(router.getVpcId(), true);
308+
if (CollectionUtils.isNotEmpty(vpcIps)) {
309+
buf.append(String.format(" source_nat_ip=%s", vpcIps.get(0).getAddress().toString()));
310+
if (s_logger.isDebugEnabled()) {
311+
s_logger.debug("The final Boot Args for " + profile + ": " + buf);
312+
}
313+
}
314+
}
298315
}
299316

300317
@Override

systemvm/debian/opt/cloud/bin/cs/CsAddress.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,8 @@ def fw_router(self):
453453
["", "", "-A NETWORK_STATS_%s -o %s ! -i eth0 -p tcp" % (self.dev, self.dev)])
454454
self.fw.append(
455455
["", "", "-A NETWORK_STATS_%s -i %s ! -o eth0 -p tcp" % (self.dev, self.dev)])
456-
self.fw.append(["nat", "",
457-
"-A POSTROUTING -o %s -j SNAT --to-source %s" % (self.dev, self.cl.get_eth2_ip())])
456+
self.fw.append(
457+
["nat", "", "-A POSTROUTING -o %s -j SNAT --to-source %s" % (self.dev, self.cl.get_eth2_ip())])
458458
self.fw.append(["mangle", "",
459459
"-A PREROUTING -i %s -m state --state NEW " % self.dev +
460460
"-j CONNMARK --set-xmark %s/0xffffffff" % self.dnum])
@@ -695,6 +695,9 @@ def post_config_change(self, method):
695695
["filter", 3, "-A FORWARD -s %s ! -d %s -j ACCEPT" % (vpccidr, vpccidr)])
696696
self.fw.append(
697697
["nat", "", "-A POSTROUTING -j SNAT -o %s --to-source %s" % (self.dev, self.address['public_ip'])])
698+
elif cmdline.get_source_nat_ip() and not self.is_private_gateway():
699+
self.fw.append(
700+
["nat", "", "-A POSTROUTING -j SNAT -o %s --to-source %s" % (self.dev, cmdline.get_source_nat_ip())])
698701

699702
def list(self):
700703
self.iplist = {}

systemvm/debian/opt/cloud/bin/cs/CsDatabag.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ def get_dev_ip6prelen(self, devname):
181181
return False
182182
return "%s/%s" % (self.idata()[ipkey], self.idata()[prelenkey])
183183

184+
def get_source_nat_ip(self):
185+
if "source_nat_ip" in self.idata():
186+
return self.idata()['source_nat_ip']
187+
return False
188+
189+
184190
class CsGuestNetwork(CsDataBag):
185191
""" Get guestnetwork config parameters """
186192

ui/public/locales/en.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,7 +3055,8 @@
30553055
"message.remove.vpc": "Please confirm that you want to remove the VPC",
30563056
"message.request.failed": "Request failed.",
30573057
"message.required.add.least.ip": "Please add at least 1 IP Range",
3058-
"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.",
3058+
"message.required.traffic.type": "All required traffic types should be added and with multiple physical networks each network should have a label.",
3059+
"message.required.tagged.physical.network": "There can only be one untagged physical network with guest traffic type.",
30593060
"message.reset.vpn.connection": "Please confirm that you want to reset VPN connection.",
30603061
"message.resize.volume.failed": "Failed to resize volume.",
30613062
"message.resize.volume.processing": "Volume resize is in progress",
@@ -3091,7 +3092,7 @@
30913092
"message.set.default.nic": "Please confirm that you would like to make this NIC the default for this Instance.",
30923093
"message.set.default.nic.manual": "Please manually update the default NIC on the Instance now.",
30933094
"message.setting.updated": "Setting Updated:",
3094-
"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.",
3095+
"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.",
30953096
"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.",
30963097
"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.",
30973098
"message.shutdown.triggered": "A shutdown has been triggered. CloudStack will not accept new jobs",

ui/src/views/infra/zone/ZoneWizardLaunchZone.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@ export default {
466466
if (physicalNetwork.isolationMethod) {
467467
params.isolationmethods = physicalNetwork.isolationMethod
468468
}
469+
if (physicalNetwork.tags) {
470+
params.tags = physicalNetwork.tags
471+
}
469472
470473
try {
471474
if (!this.stepData.stepMove.includes('createPhysicalNetwork' + index)) {

ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue

Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
<a-select-option value="VSP"> VSP </a-select-option>
6767
<a-select-option value="VCS"> VCS </a-select-option>
6868
<a-select-option value="TF"> TF </a-select-option>
69-
7069
<template #suffixIcon>
7170
<a-tooltip
7271
v-if="tungstenNetworkIndex > -1 && tungstenNetworkIndex !== index"
@@ -78,14 +77,18 @@
7877
</template>
7978
<template v-if="column.key === 'traffics'">
8079
<div v-for="traffic in record.traffics" :key="traffic.type">
81-
<a-tag
82-
:color="trafficColors[traffic.type]"
83-
style="margin:2px"
84-
>
85-
{{ traffic.type.toUpperCase() }}
86-
<edit-outlined class="traffic-type-action" @click="editTraffic(record.key, traffic, $event)"/>
87-
<delete-outlined class="traffic-type-action" @click="deleteTraffic(record.key, traffic, $event)"/>
88-
</a-tag>
80+
<a-tooltip :title="traffic.type.toUpperCase() + ' (' + traffic.label + ')'">
81+
<a-tag
82+
:color="trafficColors[traffic.type]"
83+
style="margin:2px"
84+
>
85+
86+
{{ (traffic.type.toUpperCase() + ' (' + traffic.label + ')').slice(0, 20) }}
87+
{{ (traffic.type.toUpperCase() + ' (' + traffic.label + ')').length > 20 ? '...' : '' }}
88+
<edit-outlined class="traffic-type-action" @click="editTraffic(record.key, traffic, $event)"/>
89+
<delete-outlined class="traffic-type-action" @click="deleteTraffic(record.key, traffic, $event)"/>
90+
</a-tag>
91+
</a-tooltip>
8992
</div>
9093
<div v-if="isShowAddTraffic(record.traffics, index)">
9194
<div class="traffic-select-item" v-if="addingTrafficForKey === record.key">
@@ -143,6 +146,13 @@
143146
icon="delete-outlined"
144147
@onClick="onDelete(record)" />
145148
</template>
149+
<template v-if="column.key === 'tags'">
150+
<a-input
151+
:disabled="tungstenNetworkIndex > -1 && tungstenNetworkIndex !== index"
152+
:value="text"
153+
@change="e => onCellChange(record.key, 'tags', e.target.value)"
154+
/>
155+
</template>
146156
</template>
147157
<template #footer v-if="isAdvancedZone">
148158
<a-button
@@ -176,10 +186,18 @@
176186
@cancel="() => { showError = false }"
177187
centered
178188
>
179-
<div v-ctrl-enter="() => showError = false">
180-
<span>{{ $t('message.required.traffic.type') }}</span>
189+
<div v-ctrl-enter="() => showError = false" >
190+
<a-list item-layout="horizontal" :dataSource="errorList">
191+
<template #renderItem="{ item }">
192+
<a-list-item>
193+
<exclamation-circle-outlined
194+
:style="{ color: $config.theme['@error-color'], fontSize: '20px', marginRight: '10px' }"
195+
/>
196+
{{ item }}
197+
</a-list-item>
198+
</template>
199+
</a-list>
181200
<div :span="24" class="action-button">
182-
<a-button @click="showError = false">{{ $t('label.cancel') }}</a-button>
183201
<a-button type="primary" ref="submit" @click="showError = false">{{ $t('label.ok') }}</a-button>
184202
</div>
185203
</div>
@@ -290,6 +308,7 @@ export default {
290308
addingTrafficForKey: '-1',
291309
trafficLabelSelected: null,
292310
showError: false,
311+
errorList: [],
293312
defaultTrafficOptions: [],
294313
isChangeHyperv: false
295314
}
@@ -307,14 +326,20 @@ export default {
307326
key: 'isolationMethod',
308327
title: this.$t('label.isolation.method'),
309328
dataIndex: 'isolationMethod',
310-
width: 150
329+
width: 125
311330
})
312331
columns.push({
313332
key: 'traffics',
314333
title: this.$t('label.traffic.types'),
315334
dataIndex: 'traffics',
316335
width: 250
317336
})
337+
columns.push({
338+
title: this.$t('label.tags'),
339+
key: 'tags',
340+
dataIndex: 'tags',
341+
width: 175
342+
})
318343
if (this.isAdvancedZone) {
319344
columns.push({
320345
key: 'actions',
@@ -406,7 +431,7 @@ export default {
406431
return { type: item, label: '' }
407432
})
408433
this.count = 1
409-
this.physicalNetworks = [{ key: this.randomKeyTraffic(this.count), name: 'Physical Network 1', isolationMethod: 'VLAN', traffics: traffics }]
434+
this.physicalNetworks = [{ key: this.randomKeyTraffic(this.count), name: 'Physical Network 1', isolationMethod: 'VLAN', traffics: traffics, tags: null }]
410435
}
411436
if (this.isAdvancedZone) {
412437
this.availableTrafficToAdd.push('guest')
@@ -447,28 +472,32 @@ export default {
447472
key: this.randomKeyTraffic(count + 1),
448473
name: `Physical Network ${count + 1}`,
449474
isolationMethod: 'VLAN',
450-
traffics: []
475+
traffics: [],
476+
tags: null
451477
}
452478
this.physicalNetworks = [...physicalNetworks, newData]
453479
this.count = count + 1
454480
this.hasUnusedPhysicalNetwork = this.getHasUnusedPhysicalNetwork()
455481
},
456482
isValidSetup () {
483+
this.errorList = []
457484
let physicalNetworks = this.physicalNetworks
458485
if (this.tungstenNetworkIndex > -1) {
459486
physicalNetworks = [this.physicalNetworks[this.tungstenNetworkIndex]]
460487
}
461488
const shouldHaveLabels = physicalNetworks.length > 1
462489
let isValid = true
490+
let countPhysicalNetworkWithoutTags = 0
463491
this.requiredTrafficTypes.forEach(type => {
464-
if (!isValid) return false
465492
let foundType = false
466493
physicalNetworks.forEach(net => {
467494
net.traffics.forEach(traffic => {
468-
if (!isValid) return false
469495
if (traffic.type === type) {
470496
foundType = true
471497
}
498+
if (traffic.type === 'guest' && type === 'guest' && (!net.tags || net.tags.length === 0)) {
499+
countPhysicalNetworkWithoutTags++
500+
}
472501
if (this.hypervisor !== 'VMware') {
473502
if (shouldHaveLabels && (!traffic.label || traffic.label.length === 0)) {
474503
isValid = false
@@ -482,8 +511,15 @@ export default {
482511
})
483512
if (!foundType || !isValid) {
484513
isValid = false
514+
if (this.errorList.indexOf(this.$t('message.required.traffic.type')) === -1) {
515+
this.errorList.push(this.$t('message.required.traffic.type'))
516+
}
485517
}
486518
})
519+
if (countPhysicalNetworkWithoutTags > 1) {
520+
this.errorList.push(this.$t('message.required.tagged.physical.network'))
521+
isValid = false
522+
}
487523
return isValid
488524
},
489525
handleSubmit (e) {

0 commit comments

Comments
 (0)