ngine-io / ansible-collection-cloudstack

CloudStack Ansible Collections
https://galaxy.ansible.com/ngine_io/cloudstack
GNU General Public License v3.0
21 stars 27 forks source link

Allow passing cluster and pod details when deploying an VM #105

Closed Pearl1594 closed 2 years ago

Pearl1594 commented 2 years ago

Addresses; https://github.com/ngine-io/ansible-collection-cloudstack/issues/100

How was it tested:

Created a VM passing pod and cluster name / id and it successfully created the VM in the specified cluster / pod

---
- name: provision our VMs
  hosts: localhost
  become: yes
  tasks:
  - name: Test deploy VM in a host 
    ngine_io.cloudstack.cs_instance:    
      name: web-vm-3
      template: CentOS 5.6 (64-bit) no GUI (Simulator)
      hypervisor: Simulator
      service_offering: Small Instance
      zone: 2ee3462f-1c0c-4f9d-858e-c5f649fc5244
      host: SimulatedAgent.b1b58604-28c6-4729-9774-3f11bed0baa8
      cluster: C0
      pod: POD0
      networks: net1

Translated to the following request on ACS end:

cmd: org.apache.cloudstack.api.command.admin.vm.DeployVMCmdByAdmin, cmdInfo: {"expires":"2022-06-10T12:50:32+0000","apiKey":"XTMBzlbFgs5VLu_ZpCZVscP8bnMlnaGzvF9_u8gh-APFH5KxOpuftSsHkuqYiuhZlEYyFSh2eKx3M9YTcpnZfw","signature":"aY+fN9vOtBmuaSJMExXJ00NYIeQ\u003d","hostid":"4bc9774d-53ad-4e8c-b07f-c5e27b173360","httpmethod":"GET","clusterid":"fd81c970-0a36-4ab5-b664-39e07f3df1a4","templateid":"d0bbf662-e8a8-11ec-98d4-50eb7122da94","signatureVersion":"3","ctxAccountId":"2","uuid":"58c8fe78-b6f3-4bb5-b1f6-42c262b5e5e4","cmdEventType":"VM.CREATE","startvm":"True","networkids":"2f17c175-504f-4c9c-b066-6dc11caafd58","serviceofferingid":"c08a77c4-5ef5-4de2-9c85-3ebf046dfbf4","response":"json","ctxUserId":"2","displayname":"web-vm-3","name":"web-vm-3","zoneid":"2ee3462f-1c0c-4f9d-858e-c5f649fc5244","ctxStartEventId":"77","id":"6","ctxDetails":"{\"interface com.cloud.dc.Pod\":\"81f1bb5d-6e0d-48df-9145-d07bf42823d7\",\"interface com.cloud.network.Network\":\"2f17c175-504f-4c9c-b066-6dc11caafd58\",\"interface com.cloud.offering.ServiceOffering\":\"c08a77c4-5ef5-4de2-9c85-3ebf046dfbf4\",\"interface com.cloud.host.Host\":\"4bc9774d-53ad-4e8c-b07f-c5e27b173360\",\"interface com.cloud.dc.DataCenter\":\"2ee3462f-1c0c-4f9d-858e-c5f649fc5244\",\"interface com.cloud.org.Cluster\":\"fd81c970-0a36-4ab5-b664-39e07f3df1a4\",\"interface com.cloud.template.VirtualMachineTemplate\":\"d0bbf662-e8a8-11ec-98d4-50eb7122da94\",\"interface com.cloud.vm.VirtualMachine\":\"58c8fe78-b6f3-4bb5-b1f6-42c262b5e5e4\"}","podid":"81f1bb5d-6e0d-48df-9145-d07bf42823d7"}, cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: null, initMsid: 2484687444629, completeMsid: null, lastUpdated: null, lastPolled: null, created: null, removed: null}
resmo commented 2 years ago

Thanks @Pearl1594

Funtionality looks good, Your Python code uses 2 spaces as indentation. Please change this to 4 spaces.

Pearl1594 commented 2 years ago

Thanks @resmo for the review. I've updated the PR.

codecov[bot] commented 2 years ago

Codecov Report

Merging #105 (8010fda) into master (50e9bc5) will decrease coverage by 0.23%. The diff coverage is 32.00%.

@@            Coverage Diff             @@
##           master     #105      +/-   ##
==========================================
- Coverage   84.04%   83.81%   -0.24%     
==========================================
  Files          56       56              
  Lines        5616     5640      +24     
  Branches     1316     1324       +8     
==========================================
+ Hits         4720     4727       +7     
- Misses        454      468      +14     
- Partials      442      445       +3     
Impacted Files Coverage Δ
plugins/modules/cs_instance.py 69.24% <32.00%> (-1.96%) :arrow_down:
plugins/modules/cs_instance_nic.py 88.37% <0.00%> (-1.17%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 50e9bc5...8010fda. Read the comment docs.

resmo commented 2 years ago

the sanity error does not seem to be related to this PR.