ansible/test/integration/targets/vmware_vmotion/tasks/main.yml
Pavan Bidkar d4c4c92c97 Fix issue 64503. Added pool to relocate spec (#64544)
VM relocate to destination host works without pool param when hosts are part of same cluster. but spec.pool is required when hosts are part different clusters.

Closes: #64503
2019-11-22 16:42:41 -05:00

79 lines
2.1 KiB
YAML

# Test code for the vmware_vmotion module.
# Copyright: (c) 2019, Pavan Bidkar <pbidkar@vmware.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
- import_role:
name: prepare_vmware_tests
vars:
setup_attach_host: true
setup_datastore: true
- name: Create VMs
vmware_guest:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ dc1 }}"
validate_certs: no
name: test_vm1
folder: vm
esxi_hostname: "{{ esxi1 }}"
state: present
guest_id: centos7_64Guest
disk:
- size_gb: 1
type: thin
datastore: '{{ rw_datastore }}'
hardware:
version: latest
memory_mb: 1024
num_cpus: 1
scsi: paravirtual
register: vm_create
- name: Perform vMotion of virtual machine
vmware_vmotion:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: no
vm_name: test_vm1
destination_host: '{{ esxi2 }}'
register: vm_vmotion
- name: assert that changes were made
assert:
that:
- vm_vmotion is changed
- name: Perform vMotion of virtual machine to resource_pool
vmware_vmotion:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: no
vm_name: DC0_C0_RP0_VM0
destination_host: '{{ esxi1 }}'
destination_resourcepool: Resources
register: vm_vmotion_to_rp
- name: assert that changes were made
assert:
that:
- vm_vmotion_to_rp is changed
- name: Perform storage vMotion of of virtual machine
vmware_vmotion:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
validate_certs: no
vm_name: DC0_C0_RP0_VM1
destination_host: '{{ esxi3 }}'
destination_datastore: '{{ ro_datastore }}'
register: vm_vmotion_to_datastore
- name: assert that changes were made
assert:
that:
- vm_vmotion_to_datastore is changed