2019-09-05 17:52:12 +02:00
|
|
|
# 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:
|
2019-11-13 16:37:31 +01:00
|
|
|
- datastore: "{{ rw_datastore }}"
|
2019-09-05 17:52:12 +02:00
|
|
|
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:
|
2019-11-13 16:37:31 +01:00
|
|
|
- datastore: "{{ rw_datastore }}"
|
2019-09-05 17:52:12 +02:00
|
|
|
disk_mode: "independent_persistent"
|
|
|
|
scsi_controller: 0
|
|
|
|
scsi_type: 'paravirtual'
|
2019-11-13 21:23:58 +01:00
|
|
|
size_gb: 1
|
2019-09-05 17:52:12 +02:00
|
|
|
state: present
|
|
|
|
type: eagerzeroedthick
|
|
|
|
unit_number: 2
|
2019-11-13 16:37:31 +01:00
|
|
|
- datastore: "{{ rw_datastore }}"
|
2019-09-05 17:52:12 +02:00
|
|
|
disk_mode: "independent_nonpersistent"
|
|
|
|
scsi_controller: 0
|
|
|
|
scsi_type: 'paravirtual'
|
2019-11-13 21:23:58 +01:00
|
|
|
size_gb: 1
|
2019-09-05 17:52:12 +02:00
|
|
|
state: present
|
|
|
|
type: eagerzeroedthick
|
|
|
|
unit_number: 3
|
2019-11-13 16:37:31 +01:00
|
|
|
- datastore: "{{ rw_datastore }}"
|
2019-09-05 17:52:12 +02:00
|
|
|
disk_mode: "persistent"
|
|
|
|
scsi_controller: 0
|
|
|
|
scsi_type: 'paravirtual'
|
2019-11-13 21:23:58 +01:00
|
|
|
size_gb: 1
|
2019-09-05 17:52:12 +02:00
|
|
|
state: present
|
|
|
|
type: eagerzeroedthick
|
|
|
|
unit_number: 4
|
|
|
|
register: test_create_disk2
|
|
|
|
|
2019-11-13 21:23:58 +01:00
|
|
|
- debug:
|
2019-09-05 17:52:12 +02:00
|
|
|
msg: "{{ test_create_disk2 }}"
|
|
|
|
|
|
|
|
- name: assert that changes were made
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- test_create_disk2 is changed
|
2020-01-29 15:22:35 +01:00
|
|
|
|
|
|
|
- name: create new disk with custom shares
|
|
|
|
vmware_guest_disk:
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
validate_certs: no
|
|
|
|
name: "{{ virtual_machines[0].name }}"
|
|
|
|
disk:
|
|
|
|
- size_gb: 1
|
|
|
|
type: eagerzeroedthick
|
|
|
|
datastore: "{{ rw_datastore }}"
|
|
|
|
disk_mode: "independent_nonpersistent"
|
|
|
|
scsi_controller: 1
|
|
|
|
state: present
|
|
|
|
unit_number: 4
|
|
|
|
shares:
|
|
|
|
level: custom
|
|
|
|
level_value: 1300
|
|
|
|
register: test_custom_shares
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
msg: "{{ test_custom_shares }}"
|
|
|
|
|
|
|
|
- name: assert that changes were made
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- test_custom_shares is changed
|
|
|
|
|
|
|
|
- name: create new disk with custom IO limits and shares in IO Limits
|
|
|
|
vmware_guest_disk:
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
validate_certs: no
|
|
|
|
name: "{{ virtual_machines[0].name }}"
|
|
|
|
disk:
|
|
|
|
- size_gb: 1
|
|
|
|
type: eagerzeroedthick
|
|
|
|
datastore: "{{ rw_datastore }}"
|
|
|
|
disk_mode: "independent_nonpersistent"
|
|
|
|
scsi_controller: 2
|
|
|
|
state: present
|
|
|
|
unit_number: 4
|
|
|
|
iolimit:
|
|
|
|
limit: 1506
|
|
|
|
shares:
|
|
|
|
level: custom
|
|
|
|
level_value: 1305
|
|
|
|
register: test_custom_IoLimit_shares
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
msg: "{{ test_custom_IoLimit_shares }}"
|
|
|
|
|
|
|
|
- name: assert that changes were made
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- test_custom_IoLimit_shares is changed
|
|
|
|
|
|
|
|
- name: Update disk for custom IO limits in IO Limits
|
|
|
|
vmware_guest_disk:
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
validate_certs: no
|
|
|
|
name: "{{ virtual_machines[0].name }}"
|
|
|
|
disk:
|
|
|
|
- size_gb: 2
|
|
|
|
type: eagerzeroedthick
|
|
|
|
datastore: "{{ rw_datastore }}"
|
|
|
|
disk_mode: "independent_nonpersistent"
|
|
|
|
scsi_controller: 2
|
|
|
|
state: present
|
|
|
|
unit_number: 4
|
|
|
|
iolimit:
|
|
|
|
limit: 1500
|
|
|
|
shares:
|
|
|
|
level: custom
|
|
|
|
level_value: 1305
|
|
|
|
register: test_custom_IoLimit
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
msg: "{{ test_custom_IoLimit }}"
|
|
|
|
|
|
|
|
- name: assert that changes were made
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- test_custom_IoLimit is changed
|
|
|
|
|
|
|
|
- name: Update disk for shares of IO limits
|
|
|
|
vmware_guest_disk:
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
validate_certs: no
|
|
|
|
name: "{{ virtual_machines[0].name }}"
|
|
|
|
disk:
|
|
|
|
- size_gb: 3
|
|
|
|
type: eagerzeroedthick
|
|
|
|
datastore: "{{ rw_datastore }}"
|
|
|
|
disk_mode: "independent_nonpersistent"
|
|
|
|
scsi_controller: 2
|
|
|
|
state: present
|
|
|
|
unit_number: 4
|
|
|
|
iolimit:
|
|
|
|
limit: 1500
|
|
|
|
shares:
|
|
|
|
level: low
|
|
|
|
level_value: 650
|
|
|
|
register: test_shares_IoLimit
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
msg: "{{ test_shares_IoLimit }}"
|
|
|
|
|
|
|
|
- name: assert that changes were made
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- test_shares_IoLimit is changed
|
|
|
|
|
|
|
|
- name: Update disk for shares and IoLimits of IO limits
|
|
|
|
vmware_guest_disk:
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
validate_certs: no
|
|
|
|
name: "{{ virtual_machines[0].name }}"
|
|
|
|
disk:
|
|
|
|
- size_gb: 4
|
|
|
|
type: eagerzeroedthick
|
|
|
|
datastore: "{{ rw_datastore }}"
|
|
|
|
disk_mode: "independent_nonpersistent"
|
|
|
|
scsi_controller: 2
|
|
|
|
state: present
|
|
|
|
unit_number: 4
|
|
|
|
iolimit:
|
|
|
|
limit: 1507
|
|
|
|
shares:
|
|
|
|
level: high
|
|
|
|
level_value: 1200
|
|
|
|
register: test_shares_IoLimits
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
msg: "{{ test_shares_IoLimits }}"
|
|
|
|
|
|
|
|
- name: assert that changes were made
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- test_shares_IoLimits is changed
|