From 439e64256f8037c5d4283fcc50b06ecfffd537eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Sun, 7 Jan 2018 17:21:56 +0100 Subject: [PATCH] cloudstack: rename new module to cs_service_offering (#34555) * cloudstack: rename cs_serviceoffer to cs_service_offering * adjust references to old name * cs_service_offering: fix limitcpuuse not handled * minor docs fix * update changelog --- CHANGELOG.md | 2 +- ...serviceoffer.py => cs_service_offering.py} | 38 ++++++++++--------- .../aliases | 0 .../meta/main.yml | 0 .../tasks/guest_vm_service_offering.yml | 20 +++++----- .../tasks/main.yml | 0 .../tasks/system_vm_service_offering.yml | 16 ++++---- 7 files changed, 39 insertions(+), 37 deletions(-) rename lib/ansible/modules/cloud/cloudstack/{cs_serviceoffer.py => cs_service_offering.py} (96%) rename test/integration/targets/{cs_serviceoffer => cs_service_offering}/aliases (100%) rename test/integration/targets/{cs_serviceoffer => cs_service_offering}/meta/main.yml (100%) rename test/integration/targets/{cs_serviceoffer => cs_service_offering}/tasks/guest_vm_service_offering.yml (94%) rename test/integration/targets/{cs_serviceoffer => cs_service_offering}/tasks/main.yml (100%) rename test/integration/targets/{cs_serviceoffer => cs_service_offering}/tasks/system_vm_service_offering.yml (95%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 911ecf88c55..1f47022b090 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,7 +100,7 @@ Ansible Changes By Release - cloudscale * cloudscale_floating_ip - cloudstack - * cs_serviceoffer + * cs_service_offering - digital_ocean * digital_ocean_certificate * digital_ocean_sshkey_facts diff --git a/lib/ansible/modules/cloud/cloudstack/cs_serviceoffer.py b/lib/ansible/modules/cloud/cloudstack/cs_service_offering.py similarity index 96% rename from lib/ansible/modules/cloud/cloudstack/cs_serviceoffer.py rename to lib/ansible/modules/cloud/cloudstack/cs_service_offering.py index 7a0177e6aed..add6f07147b 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_serviceoffer.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_service_offering.py @@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', DOCUMENTATION = ''' --- -module: cs_serviceoffer +module: cs_service_offering description: - Create and delete service offerings for guest and system VMs. - Update display_text of existing service offering. @@ -36,7 +36,7 @@ options: limit_cpu_usage: description: - Restrict the CPU usage to committed service offering. - type: bool + choices: [ yes, no ] deployment_planner: description: - The deployment planner heuristics used to deploy a VM of this offering. @@ -77,12 +77,14 @@ options: is_system: description: - Whether it is a system VM offering or not. - default: false + choices: [ yes, no ] + default: no is_volatile: description: - Whether the virtual machine needs to be volatile or not. - Every reboot of VM the root disk is detached then destroyed and a fresh root disk is created and attached to VM. - default: false + choices: [ yes, no ] + default: no memory: description: - The total memory of the service offering in MB. @@ -97,7 +99,8 @@ options: offer_ha: description: - Whether HA is set for the service offering. - default: false + choices: [ yes, no ] + default: no provisioning_type: description: - Provisioning type used to create volumes. @@ -140,7 +143,7 @@ extends_documentation_fragment: cloudstack EXAMPLES = ''' - name: Create a non-volatile compute service offering with local storage local_action: - module: cs_serviceoffer + module: cs_service_offering name: Micro display_text: Micro 512mb 1cpu cpu_number: 1 @@ -151,7 +154,7 @@ EXAMPLES = ''' - name: Create a volatile compute service offering with shared storage local_action: - module: cs_serviceoffer + module: cs_service_offering name: Tiny display_text: Tiny 1gb 1cpu cpu_number: 1 @@ -164,29 +167,29 @@ EXAMPLES = ''' - name: Create or update a volatile compute service offering with shared storage local_action: - module: cs_serviceoffer + module: cs_service_offering name: Tiny display_text: Tiny 1gb 1cpu cpu_number: 1 cpu_speed: 2198 memory: 1024 storage_type: shared - is_volatile: true + is_volatile: yes host_tags: eco storage_tags: eco - name: Remove a compute service offering local_action: - module: cs_serviceoffer + module: cs_service_offering name: Tiny state: absent - name: Create or update a system offering for the console proxy local_action: - module: cs_serviceoffer + module: cs_service_offering name: System Offering for Console Proxy 2GB display_text: System Offering for Console Proxy 2GB RAM - is_system: true + is_system: yes system_vm_type: consoleproxy cpu_number: 1 cpu_speed: 2198 @@ -196,9 +199,9 @@ EXAMPLES = ''' - name: Remove a system offering local_action: - module: cs_serviceoffer - name: "System Offering for Console Proxy 2GB" - is_system: true + module: cs_service_offering + name: System Offering for Console Proxy 2GB + is_system: yes state: absent ''' @@ -328,8 +331,7 @@ service_offering_details: description: Additioanl service offering details returned: success type: dict - sample: "{'vgpuType': 'GRID K180Q','pciDevice':'Group of NVIDIA Corporation GK107GL -[GRID K1] GPUs'}" + sample: "{'vgpuType': 'GRID K180Q','pciDevice':'Group of NVIDIA Corporation GK107GL [GRID K1] GPUs'}" network_rate: description: Data transfer rate in megabits per second allowed returned: success @@ -443,7 +445,7 @@ class AnsibleCloudStackServiceOffering(AnsibleCloudStack): 'storagetype': self.module.params.get('storage_type'), 'systemvmtype': system_vm_type, 'tags': self.module.params.get('storage_tags'), - 'limit_cpu_use': self.module.params.get('limit_cpu_usage') + 'limitcpuuse': self.module.params.get('limit_cpu_usage') } if not self.module.check_mode: res = self.query_api('createServiceOffering', **args) diff --git a/test/integration/targets/cs_serviceoffer/aliases b/test/integration/targets/cs_service_offering/aliases similarity index 100% rename from test/integration/targets/cs_serviceoffer/aliases rename to test/integration/targets/cs_service_offering/aliases diff --git a/test/integration/targets/cs_serviceoffer/meta/main.yml b/test/integration/targets/cs_service_offering/meta/main.yml similarity index 100% rename from test/integration/targets/cs_serviceoffer/meta/main.yml rename to test/integration/targets/cs_service_offering/meta/main.yml diff --git a/test/integration/targets/cs_serviceoffer/tasks/guest_vm_service_offering.yml b/test/integration/targets/cs_service_offering/tasks/guest_vm_service_offering.yml similarity index 94% rename from test/integration/targets/cs_serviceoffer/tasks/guest_vm_service_offering.yml rename to test/integration/targets/cs_service_offering/tasks/guest_vm_service_offering.yml index 61292c71638..ea24b823c58 100644 --- a/test/integration/targets/cs_serviceoffer/tasks/guest_vm_service_offering.yml +++ b/test/integration/targets/cs_service_offering/tasks/guest_vm_service_offering.yml @@ -1,6 +1,6 @@ --- - name: setup service offering - cs_serviceoffer: + cs_service_offering: name: Micro state: absent register: so @@ -10,7 +10,7 @@ - so is successful - name: create service offering in check mode - cs_serviceoffer: + cs_service_offering: name: Micro display_text: Micro 512mb 1cpu cpu_number: 1 @@ -29,7 +29,7 @@ - so is changed - name: create service offering - cs_serviceoffer: + cs_service_offering: name: Micro display_text: Micro 512mb 1cpu cpu_number: 1 @@ -55,7 +55,7 @@ - so.storage_type == "local" - name: create service offering idempotence - cs_serviceoffer: + cs_service_offering: name: Micro display_text: Micro 512mb 1cpu cpu_number: 1 @@ -81,7 +81,7 @@ - so.storage_type == "local" - name: update service offering in check mode - cs_serviceoffer: + cs_service_offering: name: Micro display_text: Micro RAM 512MB 1vCPU register: so @@ -100,7 +100,7 @@ - so.storage_type == "local" - name: update service offering - cs_serviceoffer: + cs_service_offering: name: Micro display_text: Micro RAM 512MB 1vCPU register: so @@ -118,7 +118,7 @@ - so.storage_type == "local" - name: update service offering idempotence - cs_serviceoffer: + cs_service_offering: name: Micro display_text: Micro RAM 512MB 1vCPU register: so @@ -136,7 +136,7 @@ - so.storage_type == "local" - name: remove service offering in check mode - cs_serviceoffer: + cs_service_offering: name: Micro state: absent check_mode: true @@ -155,7 +155,7 @@ - so.storage_type == "local" - name: remove service offering - cs_serviceoffer: + cs_service_offering: name: Micro state: absent register: so @@ -173,7 +173,7 @@ - so.storage_type == "local" - name: remove service offering idempotence - cs_serviceoffer: + cs_service_offering: name: Micro state: absent register: so diff --git a/test/integration/targets/cs_serviceoffer/tasks/main.yml b/test/integration/targets/cs_service_offering/tasks/main.yml similarity index 100% rename from test/integration/targets/cs_serviceoffer/tasks/main.yml rename to test/integration/targets/cs_service_offering/tasks/main.yml diff --git a/test/integration/targets/cs_serviceoffer/tasks/system_vm_service_offering.yml b/test/integration/targets/cs_service_offering/tasks/system_vm_service_offering.yml similarity index 95% rename from test/integration/targets/cs_serviceoffer/tasks/system_vm_service_offering.yml rename to test/integration/targets/cs_service_offering/tasks/system_vm_service_offering.yml index 17cbed0fa09..4c63a4b9c85 100644 --- a/test/integration/targets/cs_serviceoffer/tasks/system_vm_service_offering.yml +++ b/test/integration/targets/cs_service_offering/tasks/system_vm_service_offering.yml @@ -1,6 +1,6 @@ --- - name: setup system offering - cs_serviceoffer: + cs_service_offering: name: System Offering for Ansible is_system: true state: absent @@ -11,7 +11,7 @@ - so is successful - name: fail missing storage type and is_system - cs_serviceoffer: + cs_service_offering: name: System Offering for Ansible cpu_number: 1 cpu_speed: 500 @@ -31,7 +31,7 @@ - so.msg.startswith('missing required arguments:') - name: create system service offering in check mode - cs_serviceoffer: + cs_service_offering: name: System Offering for Ansible cpu_number: 1 cpu_speed: 500 @@ -51,7 +51,7 @@ - so is changed - name: create system service offering - cs_serviceoffer: + cs_service_offering: name: System Offering for Ansible cpu_number: 1 cpu_speed: 500 @@ -82,7 +82,7 @@ - so.is_system == true - name: create system service offering idempotence - cs_serviceoffer: + cs_service_offering: name: System Offering for Ansible cpu_number: 1 cpu_speed: 500 @@ -113,7 +113,7 @@ - so.is_system == true - name: remove system service offering in check mode - cs_serviceoffer: + cs_service_offering: name: System Offering for Ansible is_system: true state: absent @@ -127,7 +127,7 @@ - so.is_system == true - name: remove system service offering - cs_serviceoffer: + cs_service_offering: name: System Offering for Ansible is_system: true state: absent @@ -140,7 +140,7 @@ - so.is_system == true - name: remove system service offering idempotence - cs_serviceoffer: + cs_service_offering: name: System Offering for Ansible is_system: true state: absent