mirror of https://github.com/apache/cloudstack.git
PVLAN: Fix NPE when VM are in allocated state
If vlan is not assigned for VM, nic.getBroadcastUri() would be null. Then just ignore it.
This commit is contained in:
parent
a75cf9a79d
commit
92ad6abab0
|
|
@ -2609,7 +2609,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
|||
List<? extends Nic> routerNics = _nicDao.listByVmId(profile.getId());
|
||||
for (Nic nic : routerNics) {
|
||||
Network network = _networkModel.getNetwork(nic.getNetworkId());
|
||||
if (network.getTrafficType() == TrafficType.Guest && nic.getBroadcastUri().getScheme().equals("pvlan")) {
|
||||
if (network.getTrafficType() == TrafficType.Guest && nic.getBroadcastUri() != null && nic.getBroadcastUri().getScheme().equals("pvlan")) {
|
||||
NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic");
|
||||
setupDhcpForPvlan(false, domR, domR.getHostId(), nicProfile);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3059,7 +3059,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
for (NicVO nic : nics) {
|
||||
NetworkVO network = _networkDao.findById(nic.getNetworkId());
|
||||
if (network.getTrafficType() == TrafficType.Guest) {
|
||||
if (nic.getBroadcastUri().getScheme().equals("pvlan")) {
|
||||
if (nic.getBroadcastUri() != null && nic.getBroadcastUri().getScheme().equals("pvlan")) {
|
||||
NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic");
|
||||
setupVmForPvlan(false, vm.getHostId(), nicProfile);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue