Merge pull request #2011 from ustcweizhou/fix-issue-p55p1

CLOUDSTACK-9811: fix duplicated nics on VR caused by nic name p<slot_number>p<port_number>

* pr/2011:
  CLOUDSTACK-9811: fix duplicated nics on VR caused by nic name p<slot_number>p<port_number>

Signed-off-by: Rajani Karuturi <rajani.karuturi@accelerite.com>
This commit is contained in:
Rajani Karuturi 2017-03-23 15:18:54 +05:30
commit 9bf428162d

View File

@ -1464,7 +1464,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
private String getBroadcastUriFromBridge(final String brName) { private String getBroadcastUriFromBridge(final String brName) {
final String pif = matchPifFileInDirectory(brName); final String pif = matchPifFileInDirectory(brName);
final Pattern pattern = Pattern.compile("(\\D+)(\\d+)(\\D*)(\\d*)"); final Pattern pattern = Pattern.compile("(\\D+)(\\d+)(\\D*)(\\d*)(\\D*)(\\d*)");
final Matcher matcher = pattern.matcher(pif); final Matcher matcher = pattern.matcher(pif);
s_logger.debug("getting broadcast uri for pif " + pif + " and bridge " + brName); s_logger.debug("getting broadcast uri for pif " + pif + " and bridge " + brName);
if(matcher.find()) { if(matcher.find()) {
@ -1472,7 +1472,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
return BroadcastDomainType.Vxlan.toUri(matcher.group(2)).toString(); return BroadcastDomainType.Vxlan.toUri(matcher.group(2)).toString();
} }
else{ else{
if (!matcher.group(4).isEmpty()) { if (!matcher.group(6).isEmpty()) {
return BroadcastDomainType.Vlan.toUri(matcher.group(6)).toString();
} else if (!matcher.group(4).isEmpty()) {
return BroadcastDomainType.Vlan.toUri(matcher.group(4)).toString(); return BroadcastDomainType.Vlan.toUri(matcher.group(4)).toString();
} else { } else {
//untagged or not matching (eth|bond|team)#.# //untagged or not matching (eth|bond|team)#.#