From 083d2a6ad7ad28c23f7445e9416c1450b4b86c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Wed, 10 Oct 2018 03:22:07 +0200 Subject: [PATCH] [2.7] backport cs_instance fixes (#46274) * cs_instance: doc: fix typo in examples (#46035) (cherry picked from commit c09b785a663f3bc6bd481d67b48e3a95a945f9aa) * cs_instance: fix host migration without volume (#46115) (cherry picked from commit e7926cf9f450359e711ba545bec1cfb5f24be27b) * add changelog fragment --- changelogs/fragments/46115-46035-cs_instance-fixes.yml | 3 +++ lib/ansible/modules/cloud/cloudstack/cs_instance.py | 10 +++++----- test/sanity/validate-modules/ignore.txt | 1 - 3 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/46115-46035-cs_instance-fixes.yml diff --git a/changelogs/fragments/46115-46035-cs_instance-fixes.yml b/changelogs/fragments/46115-46035-cs_instance-fixes.yml new file mode 100644 index 00000000000..68599a07ab1 --- /dev/null +++ b/changelogs/fragments/46115-46035-cs_instance-fixes.yml @@ -0,0 +1,3 @@ +bugfixes: +- cs_instance - Fix host migration without volume (https://github.com/ansible/ansible/pull/46115). +- cs_instance - Fix docs and typo in examples (https://github.com/ansible/ansible/pull/46035). diff --git a/lib/ansible/modules/cloud/cloudstack/cs_instance.py b/lib/ansible/modules/cloud/cloudstack/cs_instance.py index 5289ab8eca9..c6a9a58bb72 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_instance.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_instance.py @@ -77,11 +77,11 @@ options: - Name the hypervisor to be used for creating the new instance. - Relevant when using I(state=present), but only considered if not set on ISO/template. - If not set or found on ISO/template, first found hypervisor will be used. - choices: [ KVM, VMware, BareMetal, XenServer, LXC, HyperV, UCS, OVM, Simulator ] + choices: [ KVM, kvm, VMware, vmware, BareMetal, baremetal, XenServer, xenserver, LXC, lxc, HyperV, hyperv, UCS, ucs, OVM, ovm, Simulator, simulator ] keyboard: description: - Keyboard device type for the instance. - choices: [ de, de-ch, es, fi, fr, fr-be, fr-ch, is, it, jp, nl-be, no, pt, uk, us ] + choices: [ 'de', 'de-ch', 'es', 'fi', 'fr', 'fr-be', 'fr-ch', 'is', 'it', 'jp', 'nl-be', 'no', 'pt', 'uk', 'us' ] networks: description: - List of networks to use for the new instance. @@ -189,7 +189,7 @@ EXAMPLES = ''' delegate_to: localhost - name: for changing a running instance, use the 'force' parameter -- cs_instance: + cs_instance: name: web-vm-1 display_name: web-vm-01.example.com iso: Linux Debian 7 64-bit @@ -840,7 +840,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack): 'hostid': self.get_host_id(), } if not self.module.check_mode: - res = self.query_api('migrateVirtualMachineWithVolume', **args_host) + res = self.query_api('migrateVirtualMachine', **args_host) instance = self.poll_job(res, 'virtualmachine') return instance @@ -1004,7 +1004,7 @@ def main(): disk_offering=dict(), disk_size=dict(type='int'), root_disk_size=dict(type='int'), - keyboard=dict(choices=['de', 'de-ch', 'es', 'fi', 'fr', 'fr-be', 'fr-ch', 'is', 'it', 'jp', 'nl-be', 'no', 'pt', 'uk', 'us']), + keyboard=dict(type='str', choices=['de', 'de-ch', 'es', 'fi', 'fr', 'fr-be', 'fr-ch', 'is', 'it', 'jp', 'nl-be', 'no', 'pt', 'uk', 'us']), hypervisor=dict(choices=CS_HYPERVISORS), host=dict(), security_groups=dict(type='list', aliases=['security_group']), diff --git a/test/sanity/validate-modules/ignore.txt b/test/sanity/validate-modules/ignore.txt index 005b2576f8b..369e6f76729 100644 --- a/test/sanity/validate-modules/ignore.txt +++ b/test/sanity/validate-modules/ignore.txt @@ -149,7 +149,6 @@ lib/ansible/modules/cloud/cloudscale/cloudscale_server.py E325 lib/ansible/modules/cloud/cloudstack/cs_cluster.py E326 lib/ansible/modules/cloud/cloudstack/cs_domain.py E325 lib/ansible/modules/cloud/cloudstack/cs_host.py E326 -lib/ansible/modules/cloud/cloudstack/cs_instance.py E326 lib/ansible/modules/cloud/cloudstack/cs_instance_nic_secondaryip.py E325 lib/ansible/modules/cloud/cloudstack/cs_iso.py E323 lib/ansible/modules/cloud/cloudstack/cs_iso.py E325