!266 sync some patches
From: @tong_1001 Reviewed-by: @znzjugod Signed-off-by: @znzjugod
This commit is contained in:
commit
db56d8e48f
@ -0,0 +1,30 @@
|
||||
From b3120f7fefbb772b8fd5f5e8d32ee5377d4aa5cf Mon Sep 17 00:00:00 2001
|
||||
From: sxt1001 <shixuantong1@huawei.com>
|
||||
Date: Wed, 13 Nov 2024 23:15:39 +0800
|
||||
Subject: [PATCH] chore: set recursive=False for ensure_dir if parent path is
|
||||
"/" (#5816)
|
||||
|
||||
---
|
||||
cloudinit/util.py | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cloudinit/util.py b/cloudinit/util.py
|
||||
index 8025f4d51..e2f04a402 100644
|
||||
--- a/cloudinit/util.py
|
||||
+++ b/cloudinit/util.py
|
||||
@@ -1884,7 +1884,11 @@ def ensure_dir(path, mode=None, user=None, group=None):
|
||||
# Get non existed parent dir first before they are created.
|
||||
non_existed_parent_dir = get_non_exist_parent_dir(path)
|
||||
# Make the dir and adjust the mode
|
||||
- with SeLinuxGuard(os.path.dirname(path), recursive=True):
|
||||
+ dir_name = os.path.dirname(path)
|
||||
+ selinux_recursive = True
|
||||
+ if dir_name == "/":
|
||||
+ selinux_recursive = False
|
||||
+ with SeLinuxGuard(dir_name, recursive=selinux_recursive):
|
||||
os.makedirs(path)
|
||||
chmod(path, mode)
|
||||
# Change the ownership
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
From 371b2362bbd78ce53cd1b8f69d55db5855434e61 Mon Sep 17 00:00:00 2001
|
||||
From: Curt Moore <curt.moore@garmin.com>
|
||||
Date: Tue, 4 Jun 2024 12:45:32 -0500
|
||||
Subject: [PATCH] fix: Ensure properties for bonded interfaces are properly
|
||||
translated (#5367)
|
||||
|
||||
There is a discrepancy between the properties key name formatting in
|
||||
the OpenStack network_data.json and cloudinit network-config.json
|
||||
specifications. Ensure `bond_` is translated to `bond-` when the
|
||||
OpenStack configuration is parsed by cloudinit.
|
||||
|
||||
Fixes GH-5366
|
||||
|
||||
Co-authored-by: Alberto Contreras <alberto.contreras@canonical.com>
|
||||
---
|
||||
cloudinit/sources/helpers/openstack.py | 9 ++++++++-
|
||||
tests/unittests/sources/helpers/test_openstack.py | 6 +++---
|
||||
2 files changed, 11 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/cloudinit/sources/helpers/openstack.py b/cloudinit/sources/helpers/openstack.py
|
||||
index 69a35db72..70998dda2 100644
|
||||
--- a/cloudinit/sources/helpers/openstack.py
|
||||
+++ b/cloudinit/sources/helpers/openstack.py
|
||||
@@ -672,7 +672,14 @@ def convert_net_json(network_json=None, known_macs=None):
|
||||
if k == "bond_links":
|
||||
continue
|
||||
elif k.startswith("bond"):
|
||||
- params.update({k: v})
|
||||
+ # There is a difference in key name formatting for
|
||||
+ # bond parameters in the cloudinit and OpenStack
|
||||
+ # network schemas. The keys begin with 'bond-' in the
|
||||
+ # cloudinit schema but 'bond_' in OpenStack
|
||||
+ # network_data.json schema. Translate them to what
|
||||
+ # is expected by cloudinit.
|
||||
+ translated_key = "bond-{}".format(k.split("bond_", 1)[-1])
|
||||
+ params.update({translated_key: v})
|
||||
|
||||
# openstack does not provide a name for the bond.
|
||||
# they do provide an 'id', but that is possibly non-sensical.
|
||||
diff --git a/tests/unittests/sources/helpers/test_openstack.py b/tests/unittests/sources/helpers/test_openstack.py
|
||||
index 312d66a01..663f6c2db 100644
|
||||
--- a/tests/unittests/sources/helpers/test_openstack.py
|
||||
+++ b/tests/unittests/sources/helpers/test_openstack.py
|
||||
@@ -192,9 +192,9 @@ class TestConvertNetJson:
|
||||
"name": "bond0",
|
||||
"mac_address": "xx:xx:xx:xx:xx:00",
|
||||
"params": {
|
||||
- "bond_miimon": 100,
|
||||
- "bond_mode": "802.3ad",
|
||||
- "bond_xmit_hash_policy": "layer3+4",
|
||||
+ "bond-miimon": 100,
|
||||
+ "bond-mode": "802.3ad",
|
||||
+ "bond-xmit_hash_policy": "layer3+4",
|
||||
},
|
||||
"subnets": [],
|
||||
"type": "bond",
|
||||
--
|
||||
2.27.0
|
||||
|
||||
140
backport-test-openstack-Test-bond-mac-address.patch
Normal file
140
backport-test-openstack-Test-bond-mac-address.patch
Normal file
@ -0,0 +1,140 @@
|
||||
From f8f9d19409fcbda32e119a5514fd5185bcd88b79 Mon Sep 17 00:00:00 2001
|
||||
From: Brett Holman <brett.holman@canonical.com>
|
||||
Date: Thu, 27 Jun 2024 11:56:58 -0600
|
||||
Subject: [PATCH] test(openstack): Test bond mac address (#5369)
|
||||
|
||||
---
|
||||
.../sources/helpers/test_openstack.py | 120 ++++++++++++++++++
|
||||
1 file changed, 120 insertions(+)
|
||||
|
||||
diff --git a/tests/unittests/sources/helpers/test_openstack.py b/tests/unittests/sources/helpers/test_openstack.py
|
||||
index 4d85ec3c6..312d66a01 100644
|
||||
--- a/tests/unittests/sources/helpers/test_openstack.py
|
||||
+++ b/tests/unittests/sources/helpers/test_openstack.py
|
||||
@@ -112,3 +112,123 @@ class TestConvertNetJson:
|
||||
assert expected == openstack.convert_net_json(
|
||||
network_json=net_json, known_macs=macs
|
||||
)
|
||||
+
|
||||
+ def test_bond_mac(self):
|
||||
+ """Verify the bond mac address is assigned correctly."""
|
||||
+ network_json = {
|
||||
+ "links": [
|
||||
+ {
|
||||
+ "id": "ens1f0np0",
|
||||
+ "name": "ens1f0np0",
|
||||
+ "type": "phy",
|
||||
+ "ethernet_mac_address": "xx:xx:xx:xx:xx:00",
|
||||
+ "mtu": 9000,
|
||||
+ },
|
||||
+ {
|
||||
+ "id": "ens1f1np1",
|
||||
+ "name": "ens1f1np1",
|
||||
+ "type": "phy",
|
||||
+ "ethernet_mac_address": "xx:xx:xx:xx:xx:01",
|
||||
+ "mtu": 9000,
|
||||
+ },
|
||||
+ {
|
||||
+ "id": "bond0",
|
||||
+ "name": "bond0",
|
||||
+ "type": "bond",
|
||||
+ "bond_links": ["ens1f0np0", "ens1f1np1"],
|
||||
+ "mtu": 9000,
|
||||
+ "ethernet_mac_address": "xx:xx:xx:xx:xx:00",
|
||||
+ "bond_mode": "802.3ad",
|
||||
+ "bond_xmit_hash_policy": "layer3+4",
|
||||
+ "bond_miimon": 100,
|
||||
+ },
|
||||
+ {
|
||||
+ "id": "bond0.123",
|
||||
+ "name": "bond0.123",
|
||||
+ "type": "vlan",
|
||||
+ "vlan_link": "bond0",
|
||||
+ "vlan_id": 123,
|
||||
+ "vlan_mac_address": "xx:xx:xx:xx:xx:00",
|
||||
+ },
|
||||
+ ],
|
||||
+ "networks": [
|
||||
+ {
|
||||
+ "id": "publicnet-ipv4",
|
||||
+ "type": "ipv4",
|
||||
+ "link": "bond0.123",
|
||||
+ "ip_address": "x.x.x.x",
|
||||
+ "netmask": "255.255.255.0",
|
||||
+ "routes": [
|
||||
+ {
|
||||
+ "network": "0.0.0.0",
|
||||
+ "netmask": "0.0.0.0",
|
||||
+ "gateway": "x.x.x.1",
|
||||
+ }
|
||||
+ ],
|
||||
+ "network_id": "00000000-0000-0000-0000-000000000000",
|
||||
+ }
|
||||
+ ],
|
||||
+ "services": [{"type": "dns", "address": "1.1.1.1"}],
|
||||
+ }
|
||||
+ expected = {
|
||||
+ "config": [
|
||||
+ {
|
||||
+ "mac_address": "xx:xx:xx:xx:xx:00",
|
||||
+ "mtu": 9000,
|
||||
+ "name": "ens1f0np0",
|
||||
+ "subnets": [],
|
||||
+ "type": "physical",
|
||||
+ },
|
||||
+ {
|
||||
+ "mac_address": "xx:xx:xx:xx:xx:01",
|
||||
+ "mtu": 9000,
|
||||
+ "name": "ens1f1np1",
|
||||
+ "subnets": [],
|
||||
+ "type": "physical",
|
||||
+ },
|
||||
+ {
|
||||
+ "bond_interfaces": ["ens1f0np0", "ens1f1np1"],
|
||||
+ "mtu": 9000,
|
||||
+ "name": "bond0",
|
||||
+ "mac_address": "xx:xx:xx:xx:xx:00",
|
||||
+ "params": {
|
||||
+ "bond_miimon": 100,
|
||||
+ "bond_mode": "802.3ad",
|
||||
+ "bond_xmit_hash_policy": "layer3+4",
|
||||
+ },
|
||||
+ "subnets": [],
|
||||
+ "type": "bond",
|
||||
+ },
|
||||
+ {
|
||||
+ "mac_address": "xx:xx:xx:xx:xx:00",
|
||||
+ "name": "bond0.123",
|
||||
+ "subnets": [
|
||||
+ {
|
||||
+ "address": "x.x.x.x",
|
||||
+ "ipv4": True,
|
||||
+ "netmask": "255.255.255.0",
|
||||
+ "routes": [
|
||||
+ {
|
||||
+ "gateway": "x.x.x.1",
|
||||
+ "netmask": "0.0.0.0",
|
||||
+ "network": "0.0.0.0",
|
||||
+ }
|
||||
+ ],
|
||||
+ "type": "static",
|
||||
+ }
|
||||
+ ],
|
||||
+ "type": "vlan",
|
||||
+ "vlan_id": 123,
|
||||
+ "vlan_link": "bond0",
|
||||
+ },
|
||||
+ {"address": "1.1.1.1", "type": "nameserver"},
|
||||
+ ],
|
||||
+ "version": 1,
|
||||
+ }
|
||||
+ macs = {
|
||||
+ "xx:xx:xx:xx:xx:00": "ens1f0np0",
|
||||
+ "xx:xx:xx:xx:xx:01": "ens1f1np1",
|
||||
+ }
|
||||
+ assert expected == openstack.convert_net_json(
|
||||
+ network_json=network_json, known_macs=macs
|
||||
+ )
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: cloud-init
|
||||
Version: 23.4.1
|
||||
Release: 10
|
||||
Release: 11
|
||||
Summary: the defacto multi-distribution package that handles early initialization of a cloud instance.
|
||||
License: ASL 2.0 or GPLv3
|
||||
URL: http://launchpad.net/cloud-init
|
||||
@ -32,6 +32,9 @@ Patch6014: backport-fix-net-klibc-ipconfig-PROTO-compatibility-5437.patch
|
||||
Patch6015: backport-feat-Ensure-random-passwords-contain-multiple-charac.patch
|
||||
Patch6016: backport-test-Fix-duplicate-judgment-conditions-in-password-g.patch
|
||||
Patch6017: backport-fix-properly-handle-blank-lines-in-fstab-5643.patch
|
||||
Patch6018: backport-chore-set-recursive-False-for-ensure_dir-if-parent-p.patch
|
||||
Patch6019: backport-test-openstack-Test-bond-mac-address.patch
|
||||
Patch6020: backport-fix-Ensure-properties-for-bonded-interfaces-are-prop.patch
|
||||
|
||||
Patch9000: do-not-generate-dsa.patch
|
||||
|
||||
@ -164,6 +167,14 @@ fi
|
||||
%exclude /usr/share/doc/*
|
||||
|
||||
%changelog
|
||||
* Fri Dec 06 2024 shixuantong <shixuantong1@huawei.com> - 23.4.1-11
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:chore: set recursive=False for ensure_dir if parent path is "/"
|
||||
test(openstack): Test bond mac address
|
||||
fix: Ensure properties for bonded interfaces are properly translated
|
||||
|
||||
* Thu Nov 14 2024 shixuantong <shixuantong1@huawei.com> - 23.4.1-10
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user