Merge ~ack/maas:1988759-vmhost-deploy-3.2 into maas:3.2

Proposed by Alberto Donato
Status: Merged
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~ack/maas:1988759-vmhost-deploy-3.2
Merge into: maas:3.2
Diff against target: 53 lines (+6/-6)
3 files modified
src/metadataserver/tests/test_vendor_data.py (+1/-1)
src/metadataserver/vendor_data.py (+1/-1)
src/provisioningserver/drivers/pod/lxd.py (+4/-4)
Reviewer Review Type Date Requested Status
MAAS Lander Needs Fixing
Alberto Donato (community) Approve
Review via email: mp+431584@code.launchpad.net

Commit message

LP:1988759 don't restrict LXD credentials to the maas project on LXD deploy

This causes MAAS not to be able to read storage volumes and networks from LXD

(backport of 95c09efaf)

To post a comment you must log in.
Revision history for this message
Alberto Donato (ack) :
review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b 1988759-vmhost-deploy-3.2 lp:~ack/maas/+git/maas into -b 3.2 lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas-tester/1039/consoleText
COMMIT: a0449358cfa6dd7e6772f26a6e9cfe0b377ccbdc

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/metadataserver/tests/test_vendor_data.py b/src/metadataserver/tests/test_vendor_data.py
2index 74aed9e..54e3fd7 100644
3--- a/src/metadataserver/tests/test_vendor_data.py
4+++ b/src/metadataserver/tests/test_vendor_data.py
5@@ -450,7 +450,7 @@ class TestGenerateKVMPodConfiguration(MAASServerTestCase):
6 "lxd init --auto --network-address=[::]",
7 "lxc project create maas",
8 "sh -c 'lxc project edit maas </root/maas-project.yaml'",
9- "lxc config trust add /root/lxd.crt --restricted --projects maas",
10+ "lxc config trust add /root/lxd.crt",
11 "rm /root/lxd.crt /root/maas-project.yaml",
12 ],
13 ),
14diff --git a/src/metadataserver/vendor_data.py b/src/metadataserver/vendor_data.py
15index 1e69157..60b27f5 100644
16--- a/src/metadataserver/vendor_data.py
17+++ b/src/metadataserver/vendor_data.py
18@@ -232,7 +232,7 @@ def generate_kvm_pod_configuration(node):
19 "lxd init --auto --network-address=[::]",
20 f"lxc project create {maas_project}",
21 f"sh -c 'lxc project edit {maas_project} <{project_conf_file}'",
22- f"lxc config trust add {cert_file} --restricted --projects {maas_project}",
23+ f"lxc config trust add {cert_file}",
24 f"rm {cert_file} {project_conf_file}",
25 ]
26
27diff --git a/src/provisioningserver/drivers/pod/lxd.py b/src/provisioningserver/drivers/pod/lxd.py
28index 0265d4f..4131b8c 100644
29--- a/src/provisioningserver/drivers/pod/lxd.py
30+++ b/src/provisioningserver/drivers/pod/lxd.py
31@@ -876,7 +876,7 @@ class LXDPodDriver(PodDriver):
32 try:
33 client.authenticate(password)
34 except LXDAPIException as e:
35- raise Error(f"Password authentication failed: {e}")
36+ raise Error(f"Password authentication failed: {e}") from e
37 return client
38
39 try:
40@@ -899,10 +899,10 @@ class LXDPodDriver(PodDriver):
41 raise Error(
42 "Certificate is not trusted and no password was given"
43 )
44- except ClientConnectionFailed:
45+ except ClientConnectionFailed as e:
46 raise LXDPodError(
47- f"Pod {pod_id}: Failed to connect to the LXD REST API."
48- )
49+ f"Pod {pod_id}: Failed to connect to the LXD REST API: {e}"
50+ ) from e
51 else:
52 yield client
53 finally:

Subscribers

People subscribed via source and target branches