ansible-collections / vmware.vmware

Ansible VMWare Collection
GNU General Public License v3.0
7 stars 10 forks source link

vmware.vmware.cluster_drs has drs_vmotion_rate inverted #68

Closed MallocArray closed 1 month ago

MallocArray commented 1 month ago
SUMMARY

vmware.vmware.cluster_drs documentation shows that drs_vmotion_rate is 1 (lowest) to 5 (highest), but setting value 2 results in vCenter 8.0 U3 setting the DRS Migration Threshold to 4 which is toward the Aggressive (More Frequent vMotions) side of the slider.

The previous community.vmware.vmware_cluster_drs module handled this as expected, with a value of 2 resulting in a Migration Threshold of 2 which is toward the Conservative end of the slider.

ISSUE TYPE
COMPONENT NAME

vmware.vmware.cluster_drs

ANSIBLE VERSION
ansible [core 2.16.11]
  config file = /runner/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.11/site-packages/ansible
  ansible collection location = /runner/collections
  executable location = /usr/local/bin/ansible
  python version = 3.11.9 (main, Aug 23 2024, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] (/usr/bin/python3.11)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
Collection    Version
------------- -------
vmware.vmware 1.5.0  
CONFIGURATION
COLLECTIONS_PATHS(/runner/ansible.cfg) = ['/runner/collections']
CONFIG_FILE() = /runner/ansible.cfg
DEFAULT_FILTER_PLUGIN_PATH(/runner/ansible.cfg) = ['/runner/custom_filters']
DEFAULT_ROLES_PATH(/runner/ansible.cfg) = ['/runner/roles']
DEFAULT_STRATEGY_PLUGIN_PATH(/runner/ansible.cfg) = ['/runner/custom_plugins/mitogen-0.3.4/ansible_mitogen/plugins/strategy']
DEFAULT_TIMEOUT(/runner/ansible.cfg) = 40
HOST_KEY_CHECKING(/runner/ansible.cfg) = False
PARAMIKO_LOOK_FOR_KEYS(/runner/ansible.cfg) = False
OS / ENVIRONMENT

Execution Environment based on Stream9

STEPS TO REPRODUCE
  vars:
    drs_settings:
      enable_drs: true
      drs_default_vm_behavior: "fullyAutomated"
      drs_vmotion_rate: 2  # Slightly Conservative. Make Recommendations but do not automatically move except for Rules and Maintenance Mode
      predictive_drs: true
      drs_enable_vm_behavior_overrides: true

  tasks:
    - name: Cluster DRS Settings
      vmware.vmware.cluster_drs:
        hostname: "{{ vcenter }}"
        username: "{{ vcenter_user }}"
        password: "{{ vcenter_password }}"
        validate_certs: "{{ vmware_validate_certs }}"
        datacenter: "{{ datacenter }}"
        cluster: "{{ inventory_hostname }}"
        enable: "{{ drs_settings.enable_drs }}"
        drs_default_vm_behavior: "{{ drs_settings.drs_default_vm_behavior | default(omit) }}"
        drs_vmotion_rate: "{{ drs_settings.drs_vmotion_rate | default(omit) }}"
        drs_enable_vm_behavior_overrides: "{{ drs_settings.drs_enable_vm_behavior_overrides | default(omit) }}"
        advanced_settings: "{{ drs_settings.advanced_settings | default(omit) }}"
        predictive_drs: "{{ drs_settings.predictive_drs | default(omit) }}"
      delegate_to: localhost
      when: drs_skip is not defined
      tags:
        - drs
        - 
EXPECTED RESULTS

Migration Threshold for the cluster in vCenter would be set to 2, which is one notch to the left of center on the slider

ACTUAL RESULTS

Migration Threshold for the cluster in vCenter is set to 4, which is one notch to the right of center on the slider image

changed: [MyCluster -> localhost] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "advanced_settings": {},
            "cluster": "MyCluster",
            "datacenter": "MyDatacenter",
            "drs_default_vm_behavior": "fullyAutomated",
            "drs_enable_vm_behavior_overrides": true,
            "drs_vmotion_rate": 2,
            "enable": true,
            "hostname": "MyVcenter.domain.com",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 443,
            "predictive_drs": true,
            "proxy_host": null,
            "proxy_port": null,
            "username": "domain\\username",
            "validate_certs": false
        }
    },
    "result": {
        "completion_time": "2024-09-19T17:21:38.782943+00:00",
        "entity_name": "MyCluster",
        "error": null,
        "result": null,
        "state": "success"
    }
}