summaryrefslogtreecommitdiff
path: root/lib/ansible/modules/cloud/ovirt
diff options
context:
space:
mode:
authorOndra Machacek <omachace@redhat.com>2019-10-08 17:12:14 +0200
committeransibot <ansibot@users.noreply.github.com>2019-10-08 11:12:14 -0400
commit35c3d831fb81fc4f7bddd2d5251d046e8c8a7727 (patch)
tree71a3f3595243c0711f7553d1984736eafe566511 /lib/ansible/modules/cloud/ovirt
parent67d9cc45bde602b43c93ede4fe0bf5bb2b51a184 (diff)
downloadansible-35c3d831fb81fc4f7bddd2d5251d046e8c8a7727.tar.gz
ovirt_vm: Add new suboptions to graphical_console (#63230)
Fixes: https://github.com/ansible/ansible/issues/63225 This PR add following new suboptions to graphical_console param: - keyboard_layout - monitors - disconnect_action
Diffstat (limited to 'lib/ansible/modules/cloud/ovirt')
-rw-r--r--lib/ansible/modules/cloud/ovirt/ovirt_vm.py54
1 files changed, 50 insertions, 4 deletions
diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py
index d7f9aa2d9c..47abe608d3 100644
--- a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py
+++ b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py
@@ -783,6 +783,30 @@ options:
protocol:
description:
- Graphical protocol, a list of I(spice), I(vnc), or both.
+ disconnect_action:
+ description:
+ - "Returns the action that will take place when the graphic console(SPICE only) is disconnected. The options are:"
+ - I(none) No action is taken.
+ - I(lock_screen) Locks the currently active user session.
+ - I(logout) Logs out the currently active user session.
+ - I(reboot) Initiates a graceful virtual machine reboot.
+ - I(shutdown) Initiates a graceful virtual machine shutdown.
+ type: str
+ version_added: "2.10"
+ keyboard_layout:
+ description:
+ - The keyboard layout to use with this graphic console.
+ - This option is only available for the VNC console type.
+ - If no keyboard is enabled then it won't be reported.
+ type: str
+ version_added: "2.10"
+ monitors:
+ description:
+ - The number of monitors opened for this graphic console.
+ - This option is only available for the SPICE protocol.
+ - Possible values are 1, 2 or 4.
+ type: int
+ version_added: "2.10"
version_added: "2.5"
exclusive:
description:
@@ -1363,6 +1387,7 @@ class VmsModule(BaseModule):
template = self.__get_template_with_version()
cluster = self.__get_cluster()
snapshot = self.__get_snapshot()
+ display = self.param('graphical_console', dict())
disk_attachments = self.__get_storage_domain_and_all_template_disks(template)
@@ -1489,8 +1514,16 @@ class VmsModule(BaseModule):
) if self.param('placement_policy') else None,
soundcard_enabled=self.param('soundcard_enabled'),
display=otypes.Display(
- smartcard_enabled=self.param('smartcard_enabled')
- ) if self.param('smartcard_enabled') is not None else None,
+ smartcard_enabled=self.param('smartcard_enabled'),
+ disconnect_action=display.get('disconnect_action'),
+ keyboard_layout=display.get('keyboard_layout'),
+ monitors=display.get('monitors'),
+ ) if (
+ self.param('smartcard_enabled') is not None or
+ display.get('disconnect_action') is not None or
+ display.get('keyboard_layout') is not None or
+ display.get('monitors') is not None
+ ) else None,
io=otypes.Io(
threads=self.param('io_threads'),
) if self.param('io_threads') is not None else None,
@@ -1559,6 +1592,7 @@ class VmsModule(BaseModule):
cpu_mode = getattr(entity.cpu, 'mode')
vm_display = entity.display
+ provided_vm_display = self.param('graphical_console', {})
return (
check_cpu_pinning() and
check_custom_properties() and
@@ -1602,7 +1636,10 @@ class VmsModule(BaseModule):
equal(self.param('serial_policy_value'), getattr(entity.serial_number, 'value', None)) and
equal(self.param('placement_policy'), str(entity.placement_policy.affinity) if entity.placement_policy else None) and
equal(self.param('numa_tune_mode'), str(entity.numa_tune_mode)) and
- equal(self.param('rng_device'), str(entity.rng_device.source) if entity.rng_device else None)
+ equal(self.param('rng_device'), str(entity.rng_device.source) if entity.rng_device else None) and
+ equal(provided_vm_display.get('monitors'), getattr(vm_display, 'monitors', None)) and
+ equal(provided_vm_display.get('keyboard_layout'), getattr(vm_display, 'keyboard_layout', None)) and
+ equal(provided_vm_display.get('disconnect_action'), getattr(vm_display, 'disconnect_action', None), ignore_case=True)
)
def pre_create(self, entity):
@@ -2396,7 +2433,16 @@ def main():
custom_properties=dict(type='list'),
watchdog=dict(type='dict'),
host_devices=dict(type='list'),
- graphical_console=dict(type='dict'),
+ graphical_console=dict(
+ type='dict',
+ options=dict(
+ headless_mode=dict(type='bool'),
+ protocol=dict(),
+ disconnect_action=dict(type='str'),
+ keyboard_layout=dict(type='str'),
+ monitors=dict(type='int'),
+ )
+ ),
exclusive=dict(type='bool'),
export_domain=dict(default=None),
export_ova=dict(type='dict'),