VMware: Check device type explicitly (#38729)

Check datatype of device instead of comparing them directly in
vmware_guest. Also, added testcases to check this behavior.

DPVG is not supported in current version vcsim

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2018-05-14 16:12:31 +05:30 committed by GitHub
parent 5cf61d7401
commit 79c7d462c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 100 additions and 1 deletions

View file

@ -1100,7 +1100,8 @@ class PyVmomiHelper(PyVmomi):
nic_change_detected = True
if 'device_type' in network_devices[key]:
device = self.device_helper.get_device(network_devices[key]['device_type'], network_name)
if nic.device != device:
device_class = type(device)
if not isinstance(nic.device, device_class):
self.module.fail_json(msg="Changing the device type is not possible when interface is already present. "
"The failing device type is %s" % network_devices[key]['device_type'])
# Changing mac address has no effect when editing interface