CLOUDSTACK-9475: Attaching to PVLAN on VMware dvSwtich fails on VR reboot

handle casting VmwareDistributedVirtualSwitchVlanSpec, to appropriate class
corresponding to vlan and pvlan. For pvvlan cast to VmwareDistributedVirtualSwitchPvlanSpec
for vlan cast to VmwareDistributedVirtualSwitchVlanIdSpec
This commit is contained in:
Murali Reddy 2016-09-28 01:19:27 +05:30 committed by Rohit Yadav
parent 63fe32e78f
commit 2cc3efbdd1
1 changed files with 15 additions and 6 deletions

View File

@ -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 + "]");