VMware: Refactor disc logic (#39285)

* Refactoring related to network device
* Assign unique random temporary key while creating SCSI or/and IDE controller devices
* Add testcase for this change

Fixes: #38679

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2018-09-07 17:04:02 +05:30 committed by GitHub
commit fd985db72d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 112 additions and 42 deletions

View file

@ -125,3 +125,83 @@
that:
- "cdrom_vm.failed == false"
- "cdrom_vm.changed == true"
- name: Create VM with multiple disks and a CDROM - GitHub issue 38679
vmware_guest:
validate_certs: False
hostname: "{{ vcsim }}"
username: "{{ vcsim_instance['json']['username'] }}"
password: "{{ vcsim_instance['json']['password'] }}"
folder: "/{{ (clusterlist['json'][0]|basename).split('_')[0] }}/vm"
name: CDROM-Test-38679
datacenter: "{{ (clusterlist['json'][0]|basename).split('_')[0] }}"
cluster: "{{ clusterlist['json'][0] }}"
resource_pool: Resources
guest_id: centos64Guest
hardware:
memory_mb: 512
num_cpus: 1
scsi: paravirtual
disk:
- size_mb: 128
type: thin
datastore: LocalDS_0
- size_mb: 128
type: thin
datastore: LocalDS_0
- size_mb: 128
type: thin
datastore: LocalDS_0
cdrom:
type: iso
iso_path: "[LocalDS_0] base.iso"
register: cdrom_vm
- debug: var=cdrom_vm
- name: assert the VM was created
assert:
that:
- "cdrom_vm.failed == false"
- "cdrom_vm.changed == true"
# VCSIM fails with invalidspec exception but real vCenter PASS testcase
# Commenting this testcase till the time
#- name: Again create VM with multiple disks and a CDROM - GitHub issue 38679
# vmware_guest:
# validate_certs: False
# hostname: "{{ vcsim }}"
# username: "{{ vcsim_instance['json']['username'] }}"
# password: "{{ vcsim_instance['json']['password'] }}"
# folder: "/{{ (clusterlist['json'][0]|basename).split('_')[0] }}/vm"
# name: CDROM-Test-38679
# datacenter: "{{ (clusterlist['json'][0]|basename).split('_')[0] }}"
# cluster: "{{ clusterlist['json'][0] }}"
# resource_pool: Resources
# guest_id: centos64Guest
# hardware:
# memory_mb: 512
# num_cpus: 1
# scsi: paravirtual
# disk:
# - size_mb: 128
# type: thin
# datastore: LocalDS_0
# - size_mb: 128
# type: thin
# datastore: LocalDS_0
# - size_mb: 128
# type: thin
# datastore: LocalDS_0
# cdrom:
# type: iso
# iso_path: "[LocalDS_0] base.iso"
# register: cdrom_vm
#- debug: var=cdrom_vm
#- name: assert the VM was created
# assert:
# that:
# - "cdrom_vm.failed == false"
# - "cdrom_vm.changed == false"