Updated Branches: refs/heads/master a75cf9a79 -> 92ad6abab
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. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/92ad6aba Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/92ad6aba Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/92ad6aba Branch: refs/heads/master Commit: 92ad6abab0063771dffaabb7c9d6d8256083c5be Parents: a75cf9a Author: Sheng Yang <sheng.y...@citrix.com> Authored: Tue May 21 14:46:31 2013 -0700 Committer: Sheng Yang <sheng.y...@citrix.com> Committed: Tue May 21 14:51:35 2013 -0700 ---------------------------------------------------------------------- .../router/VirtualNetworkApplianceManagerImpl.java | 2 +- server/src/com/cloud/vm/UserVmManagerImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92ad6aba/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 64e412a..b969be2 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -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); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92ad6aba/server/src/com/cloud/vm/UserVmManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 71b4e3f..5e20656 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -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); }