diff options
Diffstat (limited to 'lib/ansible/modules/cloud/ovirt')
-rw-r--r-- | lib/ansible/modules/cloud/ovirt/ovirt_vm.py | 54 |
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'), |