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

[cloud/vmware/vmware_guest_disk]: Add support for floating point for disk size #68990

Closed
deepakramanath opened this issue Apr 17, 2020 · 1 comment

Comments

@deepakramanath
Copy link

SUMMARY

The current module does not support floating point for disk size specification, in particular for size_tb, where in a value of 1.5 would translate to 1500 GB

The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_vmware_guest_disk_payload_Kf_wHm/ansible_vmware_guest_disk_payload.zip/ansible/modules/cloud/vmware/vmware_guest_disk.py", line 693, in main
  File "/tmp/ansible_vmware_guest_disk_payload_Kf_wHm/ansible_vmware_guest_disk_payload.zip/ansible/modules/cloud/vmware/vmware_guest_disk.py", line 344, in ensure_disks
  File "/usr/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 663, in __setattr__
    CheckField(self._GetPropertyInfo(name), val)
  File "/usr/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 1098, in CheckField
    % (info.name, info.type.__name__, valType.__name__))

fatal: [server -> localhost]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "datacenter": "datacenter", 
            "disk": [
                {
                    "datastore": "datastore", 
                    "scsi_controller": 1, 
                    "size_tb": 1.5, 
                    "state": "present", 
                    "type": "thin", 
                    "unit_number": 1
                }
            ], 
            "folder": null, 
            "hostname": "1.1.1.1", 
            "moid": null, 
            "name": "example.com", 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "port": 443, 
            "proxy_host": null, 
            "proxy_port": null, 
            "use_instance_uuid": false, 
            "username": "username@vsphere.local", 
            "uuid": null, 
            "validate_certs": false
        }
    }, 
    "msg": "Failed to manage disks for virtual machine 'example.com' with exception : For \"capacityInKB\" expected type long, but got float"
}
ISSUE TYPE
  • Bug Report
COMPONENT NAME

/usr/lib/python2.7/site-packages/ansible/modules/cloud/vmware/vmware_guest_disk.py

ANSIBLE VERSION
ansible 2.9.3
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug  7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

CONFIGURATION

OS / ENVIRONMENT
CentOS Linux release 7.7.1908
STEPS TO REPRODUCE
vmware_guest_disk:
  hostname: "{{ vcenter_host }}"
  username: "{{ vcenter_username }}"
  password: "{{ vcenter_password }}"
  datacenter: "{{ vcenter_datacenter }}"
  validate_certs: no
  name: "{{ ansible_host_name }}"
  disk:
    - size_tb: 1.5
      type: thick
      datastore: "{{ vcenter_datastore }}"
      state: present
      unit_number: 1
      scsi_controller: 1
delegate_to: localhost

EXPECTED RESULTS

Adds the disk successfully without complaining about the floating point error and, when the size is specified in TB, floating point should be allowed, for example (1.5 TB or 2.5 TB)

ACTUAL RESULTS

The module expects the size_<> should always be a non floating point integer, otherwise throws an error when say, size_tb: 1.5.

"msg": "Failed to manage disks for virtual machine 'example.com' with exception : For \"capacityInKB\" expected type long, but got float"
@Akasurde
Copy link
Member

Issue migrated to ansible-collections/community.vmware#123

@ansible ansible locked and limited conversation to collaborators May 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants