vmware-haproxy icon indicating copy to clipboard operation
vmware-haproxy copied to clipboard

OVA doesn't get configured (e.g. no IP) with vSphere 8.0 U3

Open mhoshi-vm opened this issue 1 year ago • 5 comments

Not so confident but I think this OVA doesn't work properly on later releases of vSphere (atm 8.0 u3) It seems there is a problem with how it still (last update 2021 ... ) uses the VMwareGuestInfo cloud-init datasource, which I believe is deprecated.

The mechanism I have figured out is that this OVA first executes /var/lib/vmware/ovf-to-cloud-init.sh which is responsible of creating the userdata/metadata that is fed to cloud-init in the later phase (handled by systemd) This script will evoke, ovf-rpctool set userdata "$encoded_userdata" and ovf-rpctool set userdata.encoding "base64" which I guess its suppose to configure the guestinfo.userdata and metadata.

However during startup cloud-init doesn't find that userdata, and thus fails to configure anything. /var/log/cloud-init.log shows the following.

2024-11-14 20:57:18,725 - util.py[DEBUG]: Running command ['/usr/bin/vmware-rpctool', 'info-get guestinfo.metadata'] with allowed return codes [0] (shell=False, capture=True)
2024-11-14 20:57:18,729 - DataSourceVMwareGuestInfo.py[DEBUG]: No value found for key metadata
2024-11-14 20:57:18,729 - DataSourceVMwareGuestInfo.py[DEBUG]: loaded metadata {}
2024-11-14 20:57:18,729 - DataSourceVMwareGuestInfo.py[DEBUG]: Getting guestinfo value for key userdata
2024-11-14 20:57:18,729 - util.py[DEBUG]: Running command ['/usr/bin/vmware-rpctool', 'info-get guestinfo.userdata'] with allowed return codes [0] (shell=False, capture=True)
2024-11-14 20:57:18,731 - DataSourceVMwareGuestInfo.py[DEBUG]: No value found for key userdata
2024-11-14 20:57:18,731 - DataSourceVMwareGuestInfo.py[DEBUG]: Getting guestinfo value for key vendordata
2024-11-14 20:57:18,731 - util.py[DEBUG]: Running command ['/usr/bin/vmware-rpctool', 'info-get guestinfo.vendordata'] with allowed return codes [0] (shell=False, capture=True)
2024-11-14 20:57:18,733 - DataSourceVMwareGuestInfo.py[DEBUG]: No value found for key vendordata

Btw I get this permission error so it may be due to how no longer later vsphere versions don't allow to directly update this value.

root@localhost [ ~ ]# vmware-rpctool "info-set guestinfo.userdata aaa"
Permission denied

mhoshi-vm avatar Nov 15 '24 05:11 mhoshi-vm

Not elegant, but the current only workaround I found

[ Current workaround ]

  • Deploy this OVA and start as guided and expect to fail (no IP, and no password configured)
  • Force into shell using https://vmware.github.io/photon/assets/files/html/3.0/photon_troubleshoot/resetting-a-lost-root-password.html. Somehow get the IP address configured with sshd started from there.
  • Save contents of /var/lib/vmware/encoded_metadata.txt , /var/lib/vmware/encoded_userdata.txt
  • Destroy VM
  • Redeploy OVA with the exact same values.
  • Before starting the VM, check each mac address and match it to the values in /var/lib/vmware/encoded_metadata.txt (by decoding it)
  • Before starting add the following from Advanced Config in the edit VM option. Use the save contents on the previous procedure.
image

mhoshi-vm avatar Nov 15 '24 05:11 mhoshi-vm

maybe related to #34 ?

mhoshi-vm avatar Nov 15 '24 07:11 mhoshi-vm

Hi. I'm working right now with vSphere 8.0.3 with Tanzu and using HAProxy with this OVA... I think this OVA is no maintained too... but I've managed to upgrade to Photon OS 5.0, HAProxy 2.8.2 and dataplaneapi 2.7.1... all is working perfectly with vsphere v.8.0.3 with Tanzu. I have some PowerShell code to do it automatically, but it's simple:

  • You need to upgrade all packages in Photon OS 3.0 with "tdnf upgrade --nogpgcheck -y"
  • You need install Photon upgrade script: "tdnf -y install photon-upgrade"
  • Then upgrade to Photon 4.0: "photon-upgrade.sh --upgrade-os --assume-yes" and then reboot.
  • Then upgrade again to Photon 5.0: "photon-upgrade.sh --upgrade-os --assume-yes" and then reboot.
  • Your HAProxy and "dataplaneapi" will be upgraded to 2.8.2 and 2.71, but they will not work with your actual configuration.
  • HAProxy new configuration file doesn't work. It needs to be rewrited with "/etc/haproxy/haproxy.cfg.lkg" that it's the last backup from initial configuration.
  • "dataplaneapi" new version will not be in "/usr/local/bin", where is in the original OVA, but in "/usr/libexec/haproxy/", you can write the new one over the old one or modify the "/etc/systemd/system/dataplaneapi.service" file to point to the new one.
  • The dataplaneapi.service need to know how to "restart" HAProxy service (in old version not to)
  • You need to add line "RESTART_CMD=/usr/bin/systemctl restart haproxy" to "/etc/haproxy/dataplaneapi.cfg"
  • Then to the service in "/etc/systemd/system/dataplaneapi.service" file, add a line too: "--restart-cmd=${RESTART_CMD}"
  • There is another problem in the four services that do things with HAProxy service, that I don't know yet what is the cause, but I know how to solve. The need to add a line "DefaultDependencies=no" in the "[Unit]" Section, because, if not, they will not start on boot. Those services files are:
  • /etc/systemd/system/anyip-routes.service
  • /etc/systemd/system/route-tables.service
  • /etc/systemd/system/dataplaneapi.service
  • /lib/systemd/system/haproxy.service

With those modifications your HAProxy will work with Tanzu.

DaOs7 avatar Jan 26 '25 11:01 DaOs7

There is also a Broadcom KB regarding this issue. Is a much simpler workaround which worked for me. https://knowledge.broadcom.com/external/article/380676/haproxy-vm-deployed-on-esxi-80-u3b-fails.html

vrhinow avatar May 09 '25 13:05 vrhinow

@vrhinow This is the same fix that has been already merged into this repo: https://github.com/haproxytech/vmware-haproxy/pull/34

@akutz Can you publish a new release of the current state of this repo? Your fix is urgently needed :)

For people using Ansible, deploy the OVA as usual, but powered-off, then fix it as follows:

- name: Fix HAProxy
  community.vmware.vmware_guest:
    advanced_settings:
      - key: guest_rpc.auth.cloud-init.set
        value: 'FALSE'
    cluster: MyCluster
    datacenter: MyDatacenter
    folder: /MyDatacenter/vm/MyFolder
    name: HAProxy

- name: Boot HAProxy for the first time
  community.vmware.vmware_guest:
    cluster: MyCluster
    datacenter: MyDatacenter
    folder: /MyDatacenter/vm/MyFolder
    name: HAProxy
    state: poweredon
    wait_for_ip_address: true

mbx64 avatar May 13 '25 09:05 mbx64