!268 [sync] PR-265: sync some patches
From: @openeuler-sync-bot Reviewed-by: @dillon_chen Signed-off-by: @dillon_chen
This commit is contained in:
commit
5979562c69
@ -0,0 +1,33 @@
|
||||
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)
|
||||
|
||||
Reference:https://github.com/canonical/cloud-init/commit/b3120f7fefbb772b8fd5f5e8d32ee5377d4aa5cf
|
||||
Conflict:NA
|
||||
---
|
||||
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.33.0
|
||||
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
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)
|
||||
|
||||
Reference:https://github.com/canonical/cloud-init/commit/371b2362bbd78ce53cd1b8f69d55db5855434e61
|
||||
Conflict:test_openstack.py in cloudinit/sources/helpers/tests dir not
|
||||
tests/unittests/sources/helpers.
|
||||
|
||||
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 ++++++++-
|
||||
cloudinit/sources/helpers/tests/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 bd5714f..51e491f 100644
|
||||
--- a/cloudinit/sources/helpers/openstack.py
|
||||
+++ b/cloudinit/sources/helpers/openstack.py
|
||||
@@ -637,7 +637,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/cloudinit/sources/helpers/tests/test_openstack.py b/cloudinit/sources/helpers/tests/test_openstack.py
|
||||
index 8468cc3..2dfab85 100644
|
||||
--- a/cloudinit/sources/helpers/tests/test_openstack.py
|
||||
+++ b/cloudinit/sources/helpers/tests/test_openstack.py
|
||||
@@ -128,9 +128,9 @@ class TestConvertNetJson(test_helpers.CiTestCase):
|
||||
"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.33.0
|
||||
|
||||
|
||||
144
backport-test-openstack-Test-bond-mac-address.patch
Normal file
144
backport-test-openstack-Test-bond-mac-address.patch
Normal file
@ -0,0 +1,144 @@
|
||||
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)
|
||||
|
||||
Reference:https://github.com/canonical/cloud-init/commit/f8f9d19409fcbda32e119a5514fd5185bcd88b79
|
||||
Conflict:NA
|
||||
---
|
||||
.../sources/helpers/tests/test_openstack.py | 121 ++++++++++++++++++
|
||||
1 file changed, 121 insertions(+)
|
||||
|
||||
diff --git a/cloudinit/sources/helpers/tests/test_openstack.py b/cloudinit/sources/helpers/tests/test_openstack.py
|
||||
index 95fb974..8468cc3 100644
|
||||
--- a/cloudinit/sources/helpers/tests/test_openstack.py
|
||||
+++ b/cloudinit/sources/helpers/tests/test_openstack.py
|
||||
@@ -47,3 +47,124 @@ class TestConvertNetJson(test_helpers.CiTestCase):
|
||||
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.33.0
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: cloud-init
|
||||
Version: 21.4
|
||||
Release: 31
|
||||
Release: 32
|
||||
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
|
||||
@ -84,6 +84,9 @@ Patch6049: backport-fix-net-klibc-ipconfig-PROTO-compatibility-5437.patch
|
||||
Patch6050: backport-feat-Ensure-random-passwords-contain-multiple-charac.patch
|
||||
Patch6051: backport-test-Fix-duplicate-judgment-conditions-in-password-g.patch
|
||||
Patch6052: backport-fix-properly-handle-blank-lines-in-fstab-5643.patch
|
||||
Patch6053: backport-chore-set-recursive-False-for-ensure_dir-if-parent-p.patch
|
||||
Patch6054: backport-test-openstack-Test-bond-mac-address.patch
|
||||
Patch6055: backport-fix-Ensure-properties-for-bonded-interfaces-are-prop.patch
|
||||
|
||||
BuildRequires: pkgconfig(systemd) python3-devel python3-setuptools systemd
|
||||
BuildRequires: iproute python3-configobj python3-httpretty >= 0.8.14-2
|
||||
@ -194,6 +197,14 @@ fi
|
||||
%exclude /usr/share/doc/*
|
||||
|
||||
%changelog
|
||||
* Fri Dec 06 2024 shixuantong <shixuantong1@huawei.com> - 21.4-32
|
||||
- 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> - 21.4-31
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user