remove cpuHotAddEnabled, memoryHotAddEnabled defaults from configSpec (#25202)
* add hardware.hotadd_cpu, hardware.hotadd_memory parameters * use hotadd_{cpu,memory} paramters on create integration testspull/4420/head
parent
4756b392ea
commit
8a21fa2c07
|
@ -82,6 +82,8 @@ options:
|
||||||
description:
|
description:
|
||||||
- Manage some VM hardware attributes.
|
- Manage some VM hardware attributes.
|
||||||
- 'Valid attributes are:'
|
- '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(memory_mb) (integer): Amount of memory in MB.'
|
||||||
- ' - C(num_cpus) (integer): Number of CPUs.'
|
- ' - C(num_cpus) (integer): Number of CPUs.'
|
||||||
- ' - C(scsi) (string): Valid values are C(buslogic), C(lsilogic), C(lsilogicsas) and C(paravirtual) (default).'
|
- ' - 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']:
|
elif vm_creation and not self.params['template']:
|
||||||
self.module.fail_json(msg="hardware.memory_mb attribute is mandatory for VM creation")
|
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):
|
def configure_cdrom(self, vm_obj):
|
||||||
# Configure the VM CD-ROM
|
# Configure the VM CD-ROM
|
||||||
if "cdrom" in self.params and self.params["cdrom"]:
|
if "cdrom" in self.params and self.params["cdrom"]:
|
||||||
|
@ -1274,7 +1286,7 @@ class PyVmomiHelper(PyVmomi):
|
||||||
# set the destination datastore for VM & disks
|
# set the destination datastore for VM & disks
|
||||||
(datastore, datastore_name) = self.select_datastore(vm_obj)
|
(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.configspec.deviceChange = []
|
||||||
self.configure_guestid(vm_obj=vm_obj, vm_creation=True)
|
self.configure_guestid(vm_obj=vm_obj, vm_creation=True)
|
||||||
self.configure_cpu_and_memory(vm_obj=vm_obj, vm_creation=True)
|
self.configure_cpu_and_memory(vm_obj=vm_obj, vm_creation=True)
|
||||||
|
|
|
@ -72,6 +72,8 @@
|
||||||
hardware:
|
hardware:
|
||||||
num_cpus: 1
|
num_cpus: 1
|
||||||
memory_mb: 512
|
memory_mb: 512
|
||||||
|
hotadd_memory: true
|
||||||
|
hotadd_cpu: false
|
||||||
disk:
|
disk:
|
||||||
- size: 0gb
|
- size: 0gb
|
||||||
type: thin
|
type: thin
|
||||||
|
|
Loading…
Reference in New Issue