Skip to content

Commit b42f3f5

Browse files
author
Marcus Sorensen
committed
Summary: Fix empty traffic labels causing NullPointerExceptions on KVM
Detail: In com.cloud.hypervisor.kvm.resource.BridgeVifDriver.java, in 2 places an if block should have evaluated to true if trafficLabel was null, however it was causing a NullPointerException instead. BUG-ID : NONE Bugfix-for: 4.0 Reviewed-by: Marcus Sorensen Reported-by: Dave Cahill Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1352307750 -0700
1 parent 6c411fb commit b42f3f5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public LibvirtVMDef.InterfaceDef plug(NicTO nic, String guestOsType)
8989
if (nic.getType() == Networks.TrafficType.Guest) {
9090
if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan
9191
&& !vlanId.equalsIgnoreCase("untagged")) {
92-
if(trafficLabel != null || !trafficLabel.isEmpty()) {
92+
if(trafficLabel != null && !trafficLabel.isEmpty()) {
9393
s_logger.debug("creating a vlan dev and bridge for guest traffic per traffic label " + trafficLabel);
9494
String brName = createVlanBr(vlanId, _pifs.get(trafficLabel));
9595
intf.defBridgeNet(brName, null, nic.getMac(), getGuestNicModel(guestOsType));
@@ -107,7 +107,7 @@ public LibvirtVMDef.InterfaceDef plug(NicTO nic, String guestOsType)
107107
} else if (nic.getType() == Networks.TrafficType.Public) {
108108
if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan
109109
&& !vlanId.equalsIgnoreCase("untagged")) {
110-
if(trafficLabel != null || !trafficLabel.isEmpty()){
110+
if(trafficLabel != null && !trafficLabel.isEmpty()){
111111
s_logger.debug("creating a vlan dev and bridge for public traffic per traffic label " + trafficLabel);
112112
String brName = createVlanBr(vlanId, _pifs.get(trafficLabel));
113113
intf.defBridgeNet(brName, null, nic.getMac(), getGuestNicModel(guestOsType));

0 commit comments

Comments
 (0)