ClusterLabs / fence-agents

Fence agents
104 stars 160 forks source link

fence_azure: fix pinning client api versions for compatibility across different azure sdk versions #585

Closed devanshjainms closed 5 months ago

devanshjainms commented 5 months ago

fence_azure: fix pinning client api versions for compatibility across different azure sdk versions

knet-jenkins[bot] commented 5 months ago

Can one of the admins check and authorise this run please: https://ci.kronosnet.org/job/fence-agents/job/fence-agents-pipeline/job/PR-585/1/input

oalbrigt commented 5 months ago

Thanks.

oalbrigt commented 3 weeks ago

This patch is causing issues when trying to use the latest upstream version with the RHEL8 provided python3-azure-sdk-4.0.0-9.el8.noarch (see output below).

It works fine when I remove api_version= lines, so why did we have to hard-code it to a specific version?

[root@rhel8-1 ~]# fence_azure_arm.test --resourceGroup=oalbrigt-rhel8-rg --msi -o list -vvv
2024-10-29 13:50:35,941 INFO: subscriptionId not provided. Using metadata service
2024-10-29 13:50:36,004 DEBUG: Starting new HTTP connection (1): 169.254.169.254:80
2024-10-29 13:50:36,014 DEBUG: http://169.254.169.254:80 "GET /metadata/instance?api-version=2017-08-01 HTTP/1.1" 200 623
2024-10-29 13:50:36,015 DEBUG: metadata: {'compute': {'location': 'eastus', 'name': 'oalbrigt-rhel8-1', 'offer': 'rhel-byos', 'osType': 'Linux', 'placementGroupId': '', 'platformFaultDomain': '0', 'platformUpdateDomain': '0', 'publisher': 'redhat', 'resourceGroupName': 'oalbrigt-rhel8-rg', 'sku': 'rhel-lvm87-gen2', 'subscriptionId': '59376b83-e5f7-462b-b6bf-bbdafec09d21', 'tags': '', 'version': '8.7.2023021503', 'vmId': '6f871daa-92b6-4bd7-9eae-faf4bf641768', 'vmSize': 'Standard_B2s'}, 'network': {'interface': [{'ipv4': {'ipAddress': [{'privateIpAddress': '10.0.0.4', 'publicIpAddress': ''}], 'subnet': [{'address': '10.0.0.0', 'prefix': '24'}]}, 'ipv6': {'ipAddress': []}, 'macAddress': '6045BDF0CC8A'}]}}
2024-10-29 13:50:36,237 DEBUG: Starting new HTTP connection (1): 169.254.169.254:80
2024-10-29 13:50:36,246 DEBUG: http://169.254.169.254:80 "GET /metadata/identity/oauth2/token?resource=https%3A%2F%2Fmanagement.core.windows.net%2F&api-version=2018-02-01 HTTP/1.1" 200 1776
2024-10-29 13:50:36,247 DEBUG: MSI: Retrieving a token from http://169.254.169.254/metadata/identity/oauth2/token, with payload {'resource': 'https://management.core.windows.net/', 'api-version': '2018-02-01'}
2024-10-29 13:50:36,247 DEBUG: MSI: Token retrieved
2024-10-29 13:50:36,252 DEBUG: Configuring retry: max_retries=4, backoff_factor=0.8, max_backoff=90
2024-10-29 13:50:36,253 DEBUG: Configuring retry: max_retries=4, backoff_factor=0.8, max_backoff=90
Traceback (most recent call last):
  File "/usr/sbin/fence_azure_arm.test", line 272, in <module>
    main()
  File "/usr/sbin/fence_azure_arm.test", line 268, in main
    result = fence_action([compute_client, network_client], options, set_power_status, get_power_status, get_nodes_list)
  File "/usr/share/fence/fencing.py", line 947, in fence_action
    outlets = get_outlet_list(connection, options)
  File "/usr/sbin/fence_azure_arm.test", line 20, in get_nodes_list
    vms = compute_client.virtual_machines.list(rgName)
  File "/usr/lib/python3.6/site-packages/azure/mgmt/compute/compute_management_client.py", line 799, in virtual_machines
    raise NotImplementedError("APIVersion {} is not available".format(api_version))
NotImplementedError: APIVersion 2021-11-01 is not available
[root@rhel8-1 ~]#
devanshjainms commented 3 weeks ago

Hi Oyvind, I was able to repro this issue in one of my systems, and I am working on a fix for this. Will share an update soon.