mirror of https://github.com/ansible/ansible.git
VMware: Add disk_mode parameter in vmware_guest_disk (#60406)
* Solve issue 58592 Added support to select disk_mode.pull/61875/head
parent
1aca1f86b6
commit
513bddb44a
@ -0,0 +1,3 @@
|
||||
cloud/vcenter
|
||||
shippable/vcenter/group1
|
||||
needs/target/prepare_vmware_tests
|
@ -0,0 +1,79 @@
|
||||
# Test code for the vmware_guest_disk_disk module.
|
||||
|
||||
- import_role:
|
||||
name: prepare_vmware_tests
|
||||
vars:
|
||||
setup_attach_host: true
|
||||
setup_datastore: true
|
||||
setup_virtualmachines: true
|
||||
|
||||
- name: create new disk with invalid disk mode
|
||||
vmware_guest_disk:
|
||||
hostname: "{{ vcenter_hostname }}"
|
||||
username: "{{ vcenter_username }}"
|
||||
password: "{{ vcenter_password }}"
|
||||
datacenter: "{{ dc1 }}"
|
||||
validate_certs: no
|
||||
name: "{{ virtual_machines[0].name }}"
|
||||
disk:
|
||||
- datastore: "{{ ds1 }}"
|
||||
disk_mode: "invalid_disk_mode"
|
||||
scsi_controller: 0
|
||||
scsi_type: 'paravirtual'
|
||||
size_gb: 10
|
||||
state: present
|
||||
type: eagerzeroedthick
|
||||
unit_number: 2
|
||||
register: test_create_disk1
|
||||
ignore_errors: True
|
||||
|
||||
- debug:
|
||||
msg: "{{ test_create_disk1 }}"
|
||||
|
||||
- name: assert that changes were not made
|
||||
assert:
|
||||
that:
|
||||
- not(test_create_disk1 is changed)
|
||||
|
||||
- name: create new disk(s) with valid disk mode
|
||||
vmware_guest_disk:
|
||||
hostname: "{{ vcenter_hostname }}"
|
||||
username: "{{ vcenter_username }}"
|
||||
password: "{{ vcenter_password }}"
|
||||
datacenter: "{{ dc1 }}"
|
||||
validate_certs: no
|
||||
name: "{{ virtual_machines[0].name }}"
|
||||
disk:
|
||||
- datastore: "{{ ds1 }}"
|
||||
disk_mode: "independent_persistent"
|
||||
scsi_controller: 0
|
||||
scsi_type: 'paravirtual'
|
||||
size_gb: 10
|
||||
state: present
|
||||
type: eagerzeroedthick
|
||||
unit_number: 2
|
||||
- datastore: "{{ ds1 }}"
|
||||
disk_mode: "independent_nonpersistent"
|
||||
scsi_controller: 0
|
||||
scsi_type: 'paravirtual'
|
||||
size_gb: 10
|
||||
state: present
|
||||
type: eagerzeroedthick
|
||||
unit_number: 3
|
||||
- datastore: "{{ ds1 }}"
|
||||
disk_mode: "persistent"
|
||||
scsi_controller: 0
|
||||
scsi_type: 'paravirtual'
|
||||
size_gb: 10
|
||||
state: present
|
||||
type: eagerzeroedthick
|
||||
unit_number: 4
|
||||
register: test_create_disk2
|
||||
|
||||
- debug:
|
||||
msg: "{{ test_create_disk2 }}"
|
||||
|
||||
- name: assert that changes were made
|
||||
assert:
|
||||
that:
|
||||
- test_create_disk2 is changed
|
Loading…
Reference in New Issue