|
|
|
@ -82,6 +82,8 @@ options:
|
|
|
|
|
description:
|
|
|
|
|
- Manage some VM hardware attributes.
|
|
|
|
|
- 'Valid attributes are:'
|
|
|
|
|
- ' - C(hotadd_cpu) (boolean): Allow cpus to be added while the VM is running.'
|
|
|
|
|
- ' - C(hotadd_memory) (boolean): Allow memory to be added while the VM is running.'
|
|
|
|
|
- ' - C(memory_mb) (integer): Amount of memory in MB.'
|
|
|
|
|
- ' - C(num_cpus) (integer): Number of CPUs.'
|
|
|
|
|
- ' - C(scsi) (string): Valid values are C(buslogic), C(lsilogic), C(lsilogicsas) and C(paravirtual) (default).'
|
|
|
|
@ -605,6 +607,16 @@ class PyVmomiHelper(PyVmomi):
|
|
|
|
|
elif vm_creation and not self.params['template']:
|
|
|
|
|
self.module.fail_json(msg="hardware.memory_mb attribute is mandatory for VM creation")
|
|
|
|
|
|
|
|
|
|
if 'hotadd_memory' in self.params['hardware']:
|
|
|
|
|
self.configspec.memoryHotAddEnabled = bool(self.params['hardware']['hotadd_memory'])
|
|
|
|
|
if vm_obj is None or self.configspec.memoryHotAddEnabled != vm_obj.config.memoryHotAddEnabled:
|
|
|
|
|
self.change_detected = True
|
|
|
|
|
|
|
|
|
|
if 'hotadd_cpu' in self.params['hardware']:
|
|
|
|
|
self.configspec.cpuHotAddEnabled = bool(self.params['hardware']['hotadd_cpu'])
|
|
|
|
|
if vm_obj is None or self.configspec.cpuHotAddEnabled != vm_obj.config.cpuHotAddEnabled:
|
|
|
|
|
self.change_detected = True
|
|
|
|
|
|
|
|
|
|
def configure_cdrom(self, vm_obj):
|
|
|
|
|
# Configure the VM CD-ROM
|
|
|
|
|
if "cdrom" in self.params and self.params["cdrom"]:
|
|
|
|
@ -1274,7 +1286,7 @@ class PyVmomiHelper(PyVmomi):
|
|
|
|
|
# set the destination datastore for VM & disks
|
|
|
|
|
(datastore, datastore_name) = self.select_datastore(vm_obj)
|
|
|
|
|
|
|
|
|
|
self.configspec = vim.vm.ConfigSpec(cpuHotAddEnabled=True, memoryHotAddEnabled=True)
|
|
|
|
|
self.configspec = vim.vm.ConfigSpec()
|
|
|
|
|
self.configspec.deviceChange = []
|
|
|
|
|
self.configure_guestid(vm_obj=vm_obj, vm_creation=True)
|
|
|
|
|
self.configure_cpu_and_memory(vm_obj=vm_obj, vm_creation=True)
|
|
|
|
|