Merge ~racb/ubuntu/+source/fence-agents:azure-sdk-15 into ubuntu/+source/fence-agents:ubuntu/jammy-devel

Proposed by Robie Basak
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merge reported by: Robie Basak
Merged at revision: fbccafd92d04e3e35e0b1fdc36e1638c80d1f35c
Proposed branch: ~racb/ubuntu/+source/fence-agents:azure-sdk-15
Merge into: ubuntu/+source/fence-agents:ubuntu/jammy-devel
Diff against target: 124 lines (+103/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/azure-sdk-15 (+94/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Lucas Kanashiro (community) Approve
Canonical Server Reporter Pending
Review via email: mp+433204@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

I am going to review this one.

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

I did not test the fence agent itself but I guess Robie did it. Going through the patch, it looks sane to me. I noticed part of this patch is also a backport of this other upstream commit:

https://github.com/ClusterLabs/fence-agents/commit/cb1ff52c14451482dc1faf9aa660a8c525097f94

Maybe it is a good idea to also mention it in the DEP-3 headers for future reference.

Other than that LGTM.

review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: racb, lucaskanashiro
Uploaders: racb, lucaskanashiro
MP auto-approved

review: Approve
Revision history for this message
Robie Basak (racb) wrote :

> I noticed part of this patch is also a backport of this other upstream commit:

> https://github.com/ClusterLabs/fence-agents/commit/cb1ff52c14451482dc1faf9aa660a8c525097f94

> Maybe it is a good idea to also mention it in the DEP-3 headers for future reference.

Thank you for noticing this! It looks like I neglected to mention this. Actually I think maybe I accidentally got the backport correct because I used a local diff, thinking that there was only one commit that the diff came from when in fact there were two. So I was a bit alarmed and wanted to be sure that I didn't miss anything.

I've checked carefully to confirm that the backport is exactly from these two commits, except for the unused code paths that I removed, and that there are no other commits involved. `git log upstream/main -- agents/azure_arm/fence_azure_arm.py lib/azure_fence.py.py` shows nothing else.

I will add the second commit to the dep3 headers as you suggested.

Thank you for the review!

Revision history for this message
Robie Basak (racb) wrote :

Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading fence-agents_4.7.1-1ubuntu8.1.dsc: done.
  Uploading fence-agents_4.7.1-1ubuntu8.1.debian.tar.xz: done.
  Uploading fence-agents_4.7.1-1ubuntu8.1_source.changes: done.
Successfully uploaded packages.

Revision history for this message
Robie Basak (racb) wrote :

This did land.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 1fcca07..f515edc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
1fence-agents (4.7.1-1ubuntu8.1) jammy; urgency=medium
2
3 * Update the Azure fencing agent (fence_azure_arm) to support Azure
4 SDK >=15, since this is required by python3-azure in Jammy and this
5 fence agent doesn't work without this update (LP: #1990316).
6
7 -- Robie Basak <robie.basak@ubuntu.com> Wed, 16 Nov 2022 12:11:57 +0000
8
1fence-agents (4.7.1-1ubuntu8) jammy; urgency=medium9fence-agents (4.7.1-1ubuntu8) jammy; urgency=medium
210
3 * d/curated-agents: add fence_ipmilan and fence_sbd to the -base package.11 * d/curated-agents: add fence_ipmilan and fence_sbd to the -base package.
diff --git a/debian/patches/azure-sdk-15 b/debian/patches/azure-sdk-15
4new file mode 10064412new file mode 100644
index 0000000..75ed29e
--- /dev/null
+++ b/debian/patches/azure-sdk-15
@@ -0,0 +1,94 @@
1Author: Eike Waldt <waldt@b1-systems.de>
2Author: Cleber Paiva de Souza <cleber@ssys.com.br>
3Author: Robie Basak <robie.basak@canonical.com>
4Origin: backport, https://github.com/ClusterLabs/fence-agents/commit/8d746be92f191aa289f13a3703031c122a5e6cf3
5Origin: backport, https://github.com/ClusterLabs/fence-agents/commit/cb1ff52c14451482dc1faf9aa660a8c525097f94
6Bug-Ubuntu: https://launchpad.net/bugs/1990316
7Description: fence_azure_arm: corrections to support Azure SDK >= 15
8 [Robie Basak]
9 A newer version of python3-azure requires changes in the way the API is used;
10 otherwise the fence agent doesn't work at all. This is a minimal backport of
11 those changes (two commits) to Jammy. I've removed the conditional code that
12 falls back to the old API, as we know that in Jammy the new API is available,
13 and this reduces the number of code paths for which QA may be necessary.
14Last-Update: 2022-11-16
15
16diff --git a/agents/azure_arm/fence_azure_arm.py b/agents/azure_arm/fence_azure_arm.py
17index 6b1a377..daa4cd0 100755
18--- a/agents/azure_arm/fence_azure_arm.py
19+++ b/agents/azure_arm/fence_azure_arm.py
20@@ -115,10 +115,10 @@ def set_power_status(clients, options):
21
22 if (options["--action"]=="off"):
23 logging.info("Poweroff " + vmName + " in resource group " + rgName)
24- compute_client.virtual_machines.power_off(rgName, vmName, skip_shutdown=True)
25+ compute_client.virtual_machines.begin_power_off(rgName, vmName, skip_shutdown=True)
26 elif (options["--action"]=="on"):
27 logging.info("Starting " + vmName + " in resource group " + rgName)
28- compute_client.virtual_machines.start(rgName, vmName)
29+ compute_client.virtual_machines.begin_start(rgName, vmName)
30
31
32 def define_new_opts():
33diff --git a/lib/azure_fence.py.py b/lib/azure_fence.py.py
34index 4e44ca9..87b2d3a 100644
35--- a/lib/azure_fence.py.py
36+++ b/lib/azure_fence.py.py
37@@ -286,25 +286,25 @@ def get_azure_credentials(config):
38 credentials = None
39 cloud_environment = get_azure_cloud_environment(config)
40 if config.UseMSI and cloud_environment:
41- from msrestazure.azure_active_directory import MSIAuthentication
42- credentials = MSIAuthentication(cloud_environment=cloud_environment)
43+ from azure.identity import ManagedIdentityCredential
44+ credentials = ManagedIdentityCredential(cloud_environment=cloud_environment)
45 elif config.UseMSI:
46- from msrestazure.azure_active_directory import MSIAuthentication
47- credentials = MSIAuthentication()
48+ from azure.identity import ManagedIdentityCredential
49+ credentials = ManagedIdentityCredential()
50 elif cloud_environment:
51- from azure.common.credentials import ServicePrincipalCredentials
52- credentials = ServicePrincipalCredentials(
53+ from azure.identity import ClientSecretCredential
54+ credentials = ClientSecretCredential(
55 client_id = config.ApplicationId,
56- secret = config.ApplicationKey,
57- tenant = config.Tenantid,
58+ client_secret = config.ApplicationKey,
59+ tenant_id = config.Tenantid,
60 cloud_environment=cloud_environment
61 )
62 else:
63- from azure.common.credentials import ServicePrincipalCredentials
64- credentials = ServicePrincipalCredentials(
65+ from azure.identity import ClientSecretCredential
66+ credentials = ClientSecretCredential(
67 client_id = config.ApplicationId,
68- secret = config.ApplicationKey,
69- tenant = config.Tenantid
70+ client_secret = config.ApplicationKey,
71+ tenant_id = config.Tenantid
72 )
73
74 return credentials
75@@ -319,7 +319,8 @@ def get_azure_compute_client(config):
76 compute_client = ComputeManagementClient(
77 credentials,
78 config.SubscriptionId,
79- base_url=cloud_environment.endpoints.resource_manager
80+ base_url=cloud_environment.endpoints.resource_manager,
81+ credential_scopes=[cloud_environment.endpoints.resource_manager + "/.default"]
82 )
83 else:
84 compute_client = ComputeManagementClient(
85@@ -338,7 +339,8 @@ def get_azure_network_client(config):
86 network_client = NetworkManagementClient(
87 credentials,
88 config.SubscriptionId,
89- base_url=cloud_environment.endpoints.resource_manager
90+ base_url=cloud_environment.endpoints.resource_manager,
91+ credential_scopes=[cloud_environment.endpoints.resource_manager + "/.default"]
92 )
93 else:
94 network_client = NetworkManagementClient(
diff --git a/debian/patches/series b/debian/patches/series
index 3ec598e..01c8c89 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
1disable-network-access1disable-network-access
2spelling2spelling
3azure-sdk-15

Subscribers

People subscribed via source and target branches