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

Vmware: vmware_guest can't clone a running VM to a new VM with more vCPU #56863

Closed
GrandeTartine opened this issue May 23, 2019 · 6 comments
Closed
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bot_closed bug This issue/PR relates to a bug. cloud collection:community.vmware collection Related to Ansible Collections work has_pr This issue has an associated PR. module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md python3 support:community This issue/PR relates to code supported by the Ansible community. vmware VMware community

Comments

@GrandeTartine
Copy link

GrandeTartine commented May 23, 2019

SUMMARY

With ansible 2.8.0, when I try to clone a running VM and the new VM have more vCPU, it's fail with : fatal: [created_vm]: FAILED! => {"changed": false, "msg": "Configured cpu number is more than the cpu number of the VM, cpuHotAdd is not enabled"}

My current workaround : cloning the VM and then modifying the CPU/RAM.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vmware_guest

ANSIBLE VERSION
2.8.0
CONFIGURATION

OS / ENVIRONMENT

Vcenter 6.5

STEPS TO REPRODUCE

ansible-playbook playbook.yml

---
- name: VM Creation
  hosts: localhost
  gather_facts: no
  connection: local

  # Need this hack with variables because we can't give specific
  # authentication informations for each vcenter in AWX
  vars_files:
  - vars/vault
  vars:
    vcenter_name: "vcmaq3-lyo.maquette.hosting.infra"

  pre_tasks:
  - name: Set login informations for the needed Vcenter.
    include_vars:
      file: vars/{{vcenter_name}}.yml

  tasks:
  - name: Clone template to new VM
    vmware_guest:
      # Vcenter needed informations
      hostname: "{{ vcenter_hostname }}"
      username: "{{ vcenter_username }}"
      password: "{{ vcenter_password }}"
      validate_certs: "{{ vcenter_validate_certs | default(True) }}"

      # VM identification
      datacenter: "{{ datacenter_name }}"
      cluster: "{{ cluster_name }}"
      folder: "{{ folder_name }}"
      name: "{{ vm_name }}"

      # Template to clone
      template: "/{{ datacenter_name }}/vm{{ template_folder }}/{{ template_name }}"

      # If the VM doesn't start in 1 minute
      # something wrong, we stop de deploiement here.
      state: "poweredoff"
      state_change_timeout: 60

      # Networks is empty, else VM started with unconnected nic...
      networks: []
      # Only clone the template disk, it'll be modify later
      disk: []
      convert: "{{ vm_disks[0].type }}"
      datastore: "{{ vm_disks[0].datastore }}"
      hardware:
        memory_mb: "{{ vm_memory | default(omit) }}"
        num_cpus: "{{ vm_cpu | default(omit) }}"
  delegate_to: localhost
EXPECTED RESULTS

VM cloned.

ACTUAL RESULTS
ansible-playbook 2.8.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /var/lib/awx/venv/vmware-2.8/lib/python3.6/site-packages/ansible
  executable location = /var/lib/awx/venv/vmware-2.8/bin/ansible-playbook
  python version = 3.6.6 (default, Jan 26 2019, 16:53:05) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
Using /etc/ansible/ansible.cfg as config file
Vault password:
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

Loading callback plugin default of type stdout, v2.0 from /var/lib/awx/venv/vmware-2.8/lib/python3.6/site-packages/ansible/plugins/callback/default.py

PLAYBOOK: test.yml **************************************************************************************************************************************************************************************************************************
Positional arguments: test.yml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/etc/ansible/hosts',)
ask_vault_pass: True
forks: 5
1 plays in test.yml
Read vars_file 'vars/vault.dev'
Read vars_file 'vars/vault.dev'
Read vars_file 'vars/vault.dev'

PLAY [VM Creation] **************************************************************************************************************************************************************************************************************************
Read vars_file 'vars/vault.dev'

TASK [Set login informations for the needed Vcenter.] ***************************************************************************************************************************************************************************************
task path: /tmp/_8__virt_vmware_portal/test.yml:14
ok: [localhost] => {
    "ansible_facts": {
        "vcenter_hostname": "vcmaq3-lyo.maquette.hosting.infra",
        "vcenter_password": "{{ vault_vcmaq3_password }}",
        "vcenter_username": "{{ vault_vcmaq3_username }}",
        "vcenter_validate_certs": false
    },
    "ansible_included_var_files": [
        "/tmp/_8__virt_vmware_portal/vars/vcmaq3-lyo.maquette.hosting.infra.yml"
    ],
    "changed": false
}
META: ran handlers
Read vars_file 'vars/vault.dev'
Read vars_file 'vars/vault.dev'

TASK [Clone template to new VM] *************************************************************************************************************************************************************************************************************
task path: /tmp/_8__virt_vmware_portal/test.yml:19
Trying secret <ansible.parsing.vault.PromptVaultSecret object at 0x7f4b111eb978> for vault_id=default
Trying secret <ansible.parsing.vault.PromptVaultSecret object at 0x7f4b111eb978> for vault_id=default
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1558630383.2937143-84446595937036 `" && echo ansible-tmp-1558630383.2937143-84446595937036="` echo /root/.ansible/tmp/ansible-tmp-1558630383.2937143-84446595937036 `" ) && sleep 0'
Using module file /var/lib/awx/venv/vmware-2.8/lib/python3.6/site-packages/ansible/modules/cloud/vmware/vmware_guest.py
<localhost> PUT /root/.ansible/tmp/ansible-local-17196cng8hcb_/tmpk765_yjk TO /root/.ansible/tmp/ansible-tmp-1558630383.2937143-84446595937036/AnsiballZ_vmware_guest.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1558630383.2937143-84446595937036/ /root/.ansible/tmp/ansible-tmp-1558630383.2937143-84446595937036/AnsiballZ_vmware_guest.py && sleep 0'
<localhost> EXEC /bin/sh -c '/var/lib/awx/venv/vmware-2.8/bin/python3.6 /root/.ansible/tmp/ansible-tmp-1558630383.2937143-84446595937036/AnsiballZ_vmware_guest.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1558630383.2937143-84446595937036/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "annotation": null,
            "cdrom": {},
            "cluster": "MAQ-ESX6.5",
            "convert": null,
            "customization": {},
            "customization_spec": null,
            "customvalues": [],
            "datacenter": "DC-MAQ6",
            "datastore": null,
            "disk": [],
            "esxi_hostname": null,
            "folder": "/test",
            "force": false,
            "guest_id": null,
            "hardware": {
                "memory_mb": "2048",
                "num_cpus": "4"
            },
            "hostname": "vcmaq3-lyo.maquette.hosting.infra",
            "is_template": false,
            "linked_clone": false,
            "name": "test-2019052309",
            "name_match": "first",
            "networks": [],
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 443,
            "resource_pool": null,
            "snapshot_src": null,
            "state": "poweredoff",
            "state_change_timeout": 60,
            "template": "/DC-MAQ6/vm/test/Template/MOD_DEBIAN9_FR",
            "use_instance_uuid": false,
            "username": "administrator@vsphere.local",
            "uuid": null,
            "validate_certs": false,
            "vapp_properties": [],
            "wait_for_customization": false,
            "wait_for_ip_address": false
        }
    },
    "msg": "Configured cpu number is more than the cpu number of the VM, cpuHotAdd is not enabled"
}

PLAY RECAP **********************************************************************************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
@ansibot
Copy link
Contributor

ansibot commented May 23, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented May 23, 2019

@ansibot
Copy link
Contributor

ansibot commented May 23, 2019

@GrandeTartine, just so you are aware we have a dedicated Working Group for vmware.
You can find other people interested in this in #ansible-vmware on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. cloud module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. python3 support:community This issue/PR relates to code supported by the Ansible community. vmware VMware community labels May 23, 2019
@ansibot
Copy link
Contributor

ansibot commented May 31, 2019

@Akasurde Akasurde added needs_verified This issue needs to be verified/reproduced by maintainer and removed needs_triage Needs a first human triage before being processed. labels Jun 25, 2019
@Tomorrow9
Copy link
Contributor

From the fail message I may know where the problem is. I'll take a look at this. Thanks.

@ansibot ansibot added the has_pr This issue has an associated PR. label Jul 27, 2019
@ansibot ansibot added collection Related to Ansible Collections work collection:community.vmware needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md labels Apr 29, 2020
@ansibot
Copy link
Contributor

ansibot commented Aug 16, 2020

Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.

For further information, please see:
https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md

@ansibot ansibot closed this as completed Aug 16, 2020
@ansible ansible locked and limited conversation to collaborators Sep 13, 2020
@sivel sivel removed the needs_verified This issue needs to be verified/reproduced by maintainer label Feb 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bot_closed bug This issue/PR relates to a bug. cloud collection:community.vmware collection Related to Ansible Collections work has_pr This issue has an associated PR. module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md python3 support:community This issue/PR relates to code supported by the Ansible community. vmware VMware community
Projects
None yet
5 participants