diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java index 67b4c5e6901..76a303768b2 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java @@ -833,12 +833,21 @@ public class HypervisorHostHelper { } } - VmwareDistributedVirtualSwitchVlanIdSpec oldVlanSpec = (VmwareDistributedVirtualSwitchVlanIdSpec)(( - VMwareDVSPortSetting)currentDvPortgroupInfo.getDefaultPortConfig()).getVlan(); - VmwareDistributedVirtualSwitchVlanIdSpec newVlanSpec = (VmwareDistributedVirtualSwitchVlanIdSpec)(( - VMwareDVSPortSetting)newDvPortGroupSpec.getDefaultPortConfig()).getVlan(); - int oldVlanId = oldVlanSpec.getVlanId(); - int newVlanId = newVlanSpec.getVlanId(); + int oldVlanId, newVlanId; + VmwareDistributedVirtualSwitchVlanSpec oldVlanSpec = (VmwareDistributedVirtualSwitchVlanSpec)((VMwareDVSPortSetting)currentDvPortgroupInfo.getDefaultPortConfig()).getVlan(); + VmwareDistributedVirtualSwitchVlanSpec newVlanSpec = (VmwareDistributedVirtualSwitchVlanSpec)((VMwareDVSPortSetting)newDvPortGroupSpec.getDefaultPortConfig()).getVlan(); + if (oldVlanSpec instanceof VmwareDistributedVirtualSwitchPvlanSpec && newVlanSpec instanceof VmwareDistributedVirtualSwitchPvlanSpec) { + VmwareDistributedVirtualSwitchPvlanSpec oldpVlanSpec = (VmwareDistributedVirtualSwitchPvlanSpec) oldVlanSpec; + VmwareDistributedVirtualSwitchPvlanSpec newpVlanSpec = (VmwareDistributedVirtualSwitchPvlanSpec) newVlanSpec; + oldVlanId = oldpVlanSpec.getPvlanId(); + newVlanId = newpVlanSpec.getPvlanId(); + } else { + VmwareDistributedVirtualSwitchVlanIdSpec oldVlanIdSpec = (VmwareDistributedVirtualSwitchVlanIdSpec) oldVlanSpec; + VmwareDistributedVirtualSwitchVlanIdSpec newVlanIdSpec = (VmwareDistributedVirtualSwitchVlanIdSpec) newVlanSpec; + oldVlanId = oldVlanIdSpec.getVlanId(); + newVlanId = newVlanIdSpec.getVlanId(); + } + if (oldVlanId != newVlanId) { s_logger.info("Detected that new VLAN [" + newVlanId + "] of dvPortGroup [" + dvPortGroupName + "] is different from current VLAN [" + oldVlanId + "]");