saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.09k stars 5.47k forks source link

[BUG] vsphere.add_host_to_dvs fails to migrate vmnics/vmks with 'Failed to migrate adapters (A specified parameter was not correct: )' #62040

Open ggiesen opened 2 years ago

ggiesen commented 2 years ago

Description When executing the vsphere.add_host_to_dvs module, the host is added to the DVS but the vmnic/vmk migration fails with Failed to migrate adapters (A specified parameter was not correct: ) on vSphere 7.0U3:

someminion:
    ----------
    hv01:
        ----------
        dvs:
            DVS-STORAGE
        message:
            Failed to migrate adapters (A specified parameter was not correct: )
        portgroup:
           DPG-STORAGE
        status:
            False
        uplink:
            DVS-STORAGE-DVUplinks-01
        vmknic:
            vmk1
        vmnic:
            vmnic1
    message:
    success:
        True

Setup New vSphere install with hosts with the following setup:

Host Networking: vSwitch vSwitch0 Port Group: HV-MGMT Physical NICs: vmnic0 VMKernel NICs: vmk0 vSwitch vSwitch1 Port Group: STORAGE Physical NICs: vmnic1 VMKernel NICs: vmk1

vCenter: DVS: DVS-Storage Distributed Port Group: DPG-STORAGE Uplink Port Group: DVS-STORAGE-DVUplinks-01

Steps to Reproduce the behavior salt someminion vsphere.add_host_to_dvs host='vcenter01.example.com' username='Administrator@vsphere.local' password='CorrectHorseBatteryStaple' vmknic_name='vmk1' vmnic_name='vmnic1' dvs_name='DVS-STORAGE' target_portgroup_name='DPG-STORAGE' uplink_portgroup_name='DVS-STORAGE-DVUplinks-01' protocol='https' port='443' verify_ssl=False host_names="['hv01']"

Expected behavior Host is added to DVS (DVS-STORAGE), and physical adapter (vmnic1) and VMKernel adapter (vmk1) are migrated to the DVS

Screenshots If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) ```yaml salt --versions-report Salt Version: Salt: 3004.1 Dependency Versions: cffi: 1.11.5 cherrypy: unknown dateutil: 2.6.1 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 2.10.1 libgit2: 0.26.8 M2Crypto: 0.35.2 Mako: Not Installed msgpack: 0.6.2 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.14 pycrypto: Not Installed pycryptodome: Not Installed pygit2: 0.26.4 Python: 3.6.8 (default, Nov 17 2021, 16:10:06) python-gnupg: Not Installed PyYAML: 3.12 PyZMQ: 19.0.0 smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.3.4 System Versions: dist: almalinux 8.5 Arctic Sphynx locale: UTF-8 machine: x86_64 release: 4.18.0-348.20.1.el8_5.x86_64 system: Linux version: AlmaLinux 8.5 Arctic Sphynx ```

Additional context Tried with pyVmomi versions 7.0.2 and 7.0.3. Tried both through proxy minion and regular minion. Tried with host both in and out of maintenance mode.

ggiesen commented 2 years ago

For what it's worth, the Ansible module seems to work:


salt someminion vsphere.add_host_to_dvs host='vcenter01.example.com' username='Administrator@vsphere.local' password='CorrectHorseBatteryStaple' vmknic_name='vmk1' vmnic_name='vmnic1' dvs_name='DVS-STORAGE' target_portgroup_name='DPG-STORAGE' uplink_portgroup_name='DVS-STORAGE-DVUplinks-01' protocol='https' port='443' verify_ssl=False host_names="['hv01']"

someminion:
    ----------
    hv01:
        ----------
        dvs:
            DVS-STORAGE
        message:
            Failed to migrate adapters (A specified parameter was not correct: )
        portgroup:
           DPG-STORAGE
        status:
            False
        uplink:
            DVS-STORAGE-DVUplinks-01
        vmknic:
            vmk1
        vmnic:
            vmnic1
    message:
    success:
        True

salt someminion ansible.call vmware_migrate_vmk current_portgroup_name='STORAGE' current_switch_name='vSwitch1' device='vmk1' esxi_hostname='hv01' hostname='vcenter01.example.com' migrate_portgroup_name='DPG-STORAGE' migrate_switch_name='DVS-STORAGE' password='CorrectHorseBatteryStaple' port='443' username='Administrator@vsphere.local' validate_certs='no'

someminion:
    ----------