CLOUDSTACK-5654: Don't pass empty string to BroadcastDomainType.Vlan.toUri

when attempting to parse VLAN/VNI from bridge's physical ethernet device
This commit is contained in:
Marcus Sorensen 2013-12-26 16:44:09 -07:00
parent 6f800506fd
commit 8455a0677a
1 changed files with 13 additions and 4 deletions

View File

@ -1804,11 +1804,20 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
String pif = matchPifFileInDirectory(brName);
Pattern pattern = Pattern.compile("(\\D+)(\\d+)(\\D*)(\\d*)");
Matcher matcher = pattern.matcher(pif);
if (matcher.find()) {
if (brName.startsWith("brvx")) {
s_logger.debug("getting broadcast uri for pif " + pif + " and bridge " + brName);
if(matcher.find()) {
if (brName.startsWith("brvx")){
return BroadcastDomainType.Vxlan.toUri(matcher.group(2)).toString();
} else {
return BroadcastDomainType.Vlan.toUri(matcher.group(4)).toString();
}
else{
if (!matcher.group(4).isEmpty()) {
return BroadcastDomainType.Vlan.toUri(matcher.group(4)).toString();
} else {
//untagged or not matching (eth|bond)#.#
s_logger.debug("failed to get vNet id from bridge " + brName
+ "attached to physical interface" + pif + ", perhaps untagged interface");
return "";
}
}
} else {
s_logger.debug("failed to get vNet id from bridge " + brName + "attached to physical interface" + pif);