Merging conflicts and updating PR

Signed-off-by: Anusha Hegde
pull/64809/head
Anusha Hegde 5 years ago committed by Gonéri Le Bouder
parent 4e7c0b3e21
commit 3a9650df98

@ -177,6 +177,21 @@ EXAMPLES = '''
- state: absent - state: absent
mac: "00:50:56:44:55:77" mac: "00:50:56:44:55:77"
delegate_to: localhost delegate_to: localhost
- name: Enable DirectPath I/O on a Vmxnet3 adapter
vmware_guest_network:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
validate_certs: no
name: test-vm
gather_network_info: false
networks:
- state: present
mac: "aa:50:56:58:59:61"
directpath_io: True
delegate_to: localhost
''' '''
RETURN = """ RETURN = """
@ -303,6 +318,12 @@ class PyVmomiHelper(PyVmomi):
nic.device.macAddress = device_info['manual_mac'] nic.device.macAddress = device_info['manual_mac']
else: else:
nic.device.addressType = 'generated' nic.device.addressType = 'generated'
if 'directpath_io' in device_info:
if isinstance(nic.device, vim.vm.device.VirtualVmxnet3):
nic.device.uptCompatibilityEnabled = device_info['directpath_io']
else:
self.module.fail_json(msg='UPT is only compatible for Vmxnet3 adapter.'
+ ' Clients can set this property enabled or disabled if ethernet virtual device is Vmxnet3.')
return nic return nic
@ -321,7 +342,7 @@ class PyVmomiHelper(PyVmomi):
nic_type = 'VMXNET2' nic_type = 'VMXNET2'
elif isinstance(nic, vim.vm.device.VirtualVmxnet3): elif isinstance(nic, vim.vm.device.VirtualVmxnet3):
nic_type = 'VMXNET3' nic_type = 'VMXNET3'
directpath_io = True directpath_io = nic.uptCompatibilityEnabled
elif isinstance(nic, vim.vm.device.VirtualE1000): elif isinstance(nic, vim.vm.device.VirtualE1000):
nic_type = 'E1000' nic_type = 'E1000'
elif isinstance(nic, vim.vm.device.VirtualE1000e): elif isinstance(nic, vim.vm.device.VirtualE1000e):

@ -169,10 +169,10 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
name: "{{ virtual_machines[0].name }}" name: "test_vm1"
networks: networks:
- state: present - state: present
mac: "00:50:56:58:59:61" mac: "aa:50:56:58:59:61"
directpath_io: False directpath_io: False
register: disable_directpath_io register: disable_directpath_io
@ -184,10 +184,10 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
name: "{{ virtual_machines[0].name }}" name: "test_vm1"
networks: networks:
- state: present - state: present
mac: "00:50:56:58:59:61" mac: "aa:50:56:58:59:61"
directpath_io: True directpath_io: True
register: enable_directpath_io register: enable_directpath_io

Loading…
Cancel
Save