Skip to content

Commit c02592e

Browse files
committed
Run moodifyvxlan script if broadcast domain type is Netris (#18)
1 parent 04f1182 commit c02592e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public class BridgeVifDriver extends VifDriverBase {
5151
private String _controlCidr = NetUtils.getLinkLocalCIDR();
5252
private Long libvirtVersion;
5353

54+
private static boolean isVxlanOrNetris(String protocol) {
55+
return protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme()) || protocol.equals(Networks.BroadcastDomainType.Netris.scheme());
56+
}
57+
5458
@Override
5559
public void configure(Map<String, Object> params) throws ConfigurationException {
5660

@@ -177,7 +181,7 @@ private String matchPifFileInDirectory(final String bridgeName) {
177181

178182
protected boolean isBroadcastTypeVlanOrVxlan(final NicTO nic) {
179183
return nic != null && (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan
180-
|| nic.getBroadcastType() == Networks.BroadcastDomainType.Vxlan);
184+
|| nic.getBroadcastType() == Networks.BroadcastDomainType.Vxlan || nic.getBroadcastType() == Networks.BroadcastDomainType.Netris);
181185
}
182186

183187
protected boolean isValidProtocolAndVnetId(final String vNetId, final String protocol) {
@@ -284,15 +288,15 @@ private String generateVxnetBrName(String pifName, String vnetId) {
284288

285289
private String createVnetBr(String vNetId, String pifKey, String protocol) throws InternalErrorException {
286290
String nic = _pifs.get(pifKey);
287-
if (nic == null || protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
291+
if (nic == null || isVxlanOrNetris(protocol)) {
288292
// if not found in bridge map, maybe traffic label refers to pif already?
289293
File pif = new File("/sys/class/net/" + pifKey);
290294
if (pif.isDirectory()) {
291295
nic = pifKey;
292296
}
293297
}
294298
String brName = "";
295-
if (protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
299+
if (isVxlanOrNetris(protocol)) {
296300
brName = generateVxnetBrName(nic, vNetId);
297301
} else {
298302
brName = generateVnetBrName(nic, vNetId);
@@ -304,7 +308,7 @@ private String createVnetBr(String vNetId, String pifKey, String protocol) throw
304308
private void createVnet(String vnetId, String pif, String brName, String protocol) throws InternalErrorException {
305309
synchronized (_vnetBridgeMonitor) {
306310
String script = _modifyVlanPath;
307-
if (protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
311+
if (isVxlanOrNetris(protocol)) {
308312
script = _modifyVxlanPath;
309313
}
310314
final Script command = new Script(script, _timeout, logger);
@@ -358,6 +362,7 @@ private void deleteVnetBr(String brName, boolean deleteBr) {
358362
}
359363

360364
String scriptPath = null;
365+
// TODO: check for netris as well
361366
if (cmdout != null && cmdout.contains("vxlan")) {
362367
scriptPath = _modifyVxlanPath;
363368
} else {

0 commit comments

Comments
 (0)