VMware: Add vmware guest param - maxMkConnections (#33220)

This fix adds functionality to configure vmware guest parameter called
'maxMkconnections'. Also, added integration test for this change.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2017-12-05 22:33:50 +05:30 committed by GitHub
parent 94019e7050
commit 09b3b5305a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View file

@ -92,6 +92,7 @@ options:
- ' - C(memory_reservation) (integer): Amount of memory in MB to set resource limits for memory. version_added: 2.5'
- " - C(memory_reservation_lock) (boolean): If set true, memory resource reservation for VM
will always be equal to the VM's memory size. version_added: 2.5"
- ' - C(max_connections) (integer): Maximum number of active remote display connections for the virtual machines. version_added: 2.5.'
guest_id:
description:
- Set the guest ID (Debian, RHEL, Windows...).
@ -226,6 +227,7 @@ EXAMPLES = r'''
scsi: paravirtual
memory_reservation: 512
memory_reservation_lock: True
max_connections: 5
cdrom:
type: iso
iso_path: "[datastore1] livecd.iso"
@ -732,6 +734,19 @@ class PyVmomiHelper(PyVmomi):
self.change_detected = True
self.configspec.deviceChange.append(cdrom_spec)
def configure_hardware_params(self, vm_obj):
"""
Function to configure hardware related configuration of virtual machine
Args:
vm_obj: virtual machine object
"""
# maxMksConnections == max_connections
if 'hardware' in self.params:
if 'max_connections' in self.params['hardware']:
self.configspec.maxMksConnections = int(self.params['hardware']['max_connections'])
if vm_obj is None or self.configspec.maxMksConnections != vm_obj.config.hardware.maxMksConnections:
self.change_detected = True
def get_vm_cdrom_device(self, vm=None):
if vm is None:
return None
@ -1369,6 +1384,7 @@ class PyVmomiHelper(PyVmomi):
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)
self.configure_hardware_params(vm_obj=vm_obj)
self.configure_disks(vm_obj=vm_obj)
self.configure_network(vm_obj=vm_obj)
self.configure_cdrom(vm_obj=vm_obj)
@ -1487,6 +1503,7 @@ class PyVmomiHelper(PyVmomi):
self.configure_guestid(vm_obj=self.current_vm_obj)
self.configure_cpu_and_memory(vm_obj=self.current_vm_obj)
self.configure_hardware_params(vm_obj=self.current_vm_obj)
self.configure_disks(vm_obj=self.current_vm_obj)
self.configure_network(vm_obj=self.current_vm_obj)
self.configure_cdrom(vm_obj=self.current_vm_obj)

View file

@ -50,6 +50,7 @@
# till the time.
# memory_reservation: 512
# memory_reservation_lock: False
max_connections: 10
disk:
- size: 0gb
type: thin