Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ovirt_vm: Add new suboptions to graphical_console #63230

Merged
merged 1 commit into from
Oct 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
54 changes: 50 additions & 4 deletions lib/ansible/modules/cloud/ovirt/ovirt_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,30 @@
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:
Expand Down Expand Up @@ -1358,6 +1382,7 @@ def build_entity(self):
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)

Expand Down Expand Up @@ -1483,8 +1508,16 @@ def build_entity(self):
) 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,
Expand Down Expand Up @@ -1553,6 +1586,7 @@ def check_custom_compatibility_version():

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
Expand Down Expand Up @@ -1595,7 +1629,10 @@ def check_custom_compatibility_version():
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):
Expand Down Expand Up @@ -2386,7 +2423,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'),
Expand Down