-
Notifications
You must be signed in to change notification settings - Fork 880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ubuntu/jammy] revert single process #5589
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
||
# This could throw errors, but the user told us to do it | ||
# so if errors are raised, let them raise | ||
- md_seed, ud, vd, network = util.read_seeded(seedfrom, timeout=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't actually stop cloud-init from trying to continue reaching out and blocking on remote I/O network-config requests which could lead to errors in worst case, but in best case still spends cloud-init cycles during boot requesting a network-config file and then ignoring it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what I was hoping is that we minimally avoid reaching out to request network-config from any nocloud endpoint to avoid exposure to error conditions, and avoid the cost of that round-trip only to ignore that network-config value at all callsites
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--- a/debian/patches/no-nocloud-network.patch
+++ b/debian/patches/no-nocloud-network.patch
@@ -7,7 +7,7 @@ Last-Update: 2024-08-02
--- a/cloudinit/sources/DataSourceNoCloud.py
+++ b/cloudinit/sources/DataSourceNoCloud.py
-@@ -190,7 +190,7 @@
+@@ -190,7 +190,7 @@ class DataSourceNoCloud(sources.DataSour
# This could throw errors, but the user told us to do it
# so if errors are raised, let them raise
@@ -16,7 +16,7 @@ Last-Update: 2024-08-02
LOG.debug("Using seeded cache data from %s", seedfrom)
# Values in the command line override those from the seed
-@@ -199,7 +199,6 @@
+@@ -199,7 +199,6 @@ class DataSourceNoCloud(sources.DataSour
)
mydata["user-data"] = ud
mydata["vendor-data"] = vd
@@ -24,3 +24,100 @@ Last-Update: 2024-08-02
found.append(seedfrom)
# Now that we have exhausted any other places merge in the defaults
+--- a/cloudinit/util.py
++++ b/cloudinit/util.py
+@@ -1059,7 +1059,6 @@ def read_seeded(base="", ext="", timeout
+ ud_url = base.replace("%s", "user-data" + ext)
+ vd_url = base.replace("%s", "vendor-data" + ext)
+ md_url = base.replace("%s", "meta-data" + ext)
+- network_url = base.replace("%s", "network-config" + ext)
+ else:
+ if features.NOCLOUD_SEED_URL_APPEND_FORWARD_SLASH:
+ if base[-1] != "/" and parse.urlparse(base).query == "":
+@@ -1068,17 +1067,7 @@ def read_seeded(base="", ext="", timeout
+ ud_url = "%s%s%s" % (base, "user-data", ext)
+ vd_url = "%s%s%s" % (base, "vendor-data", ext)
+ md_url = "%s%s%s" % (base, "meta-data", ext)
+- network_url = "%s%s%s" % (base, "network-config", ext)
+ network = None
+- try:
+- network_resp = url_helper.read_file_or_url(
+- network_url, timeout=timeout, retries=retries
+- )
+- except url_helper.UrlError as e:
+- LOG.debug("No network config provided: %s", e)
+- else:
+- if network_resp.ok():
+- network = load_yaml(network_resp.contents)
+ md_resp = url_helper.read_file_or_url(
+ md_url, timeout=timeout, retries=retries
+ )
+--- a/tests/unittests/test_util.py
++++ b/tests/unittests/test_util.py
+@@ -2476,7 +2476,7 @@ class TestReadSeeded:
+ assert found_md == {"key1": "val1"}
+ assert found_ud == ud
+ assert found_vd == vd
+- assert found_network == {"test": "true"}
++ assert found_network is None
+
+ @pytest.mark.parametrize(
+ "base, feature_flag, req_urls",
+@@ -2485,7 +2485,6 @@ class TestReadSeeded:
+ "http://10.0.0.1/%s?qs=1",
+ True,
+ [
+- "http://10.0.0.1/network-config?qs=1",
+ "http://10.0.0.1/meta-data?qs=1",
+ "http://10.0.0.1/user-data?qs=1",
+ "http://10.0.0.1/vendor-data?qs=1",
+@@ -2496,7 +2495,6 @@ class TestReadSeeded:
+ "https://10.0.0.1:8008/",
+ True,
+ [
+- "https://10.0.0.1:8008/network-config",
+ "https://10.0.0.1:8008/meta-data",
+ "https://10.0.0.1:8008/user-data",
+ "https://10.0.0.1:8008/vendor-data",
+@@ -2507,7 +2505,6 @@ class TestReadSeeded:
+ "https://10.0.0.1:8008",
+ True,
+ [
+- "https://10.0.0.1:8008/network-config",
+ "https://10.0.0.1:8008/meta-data",
+ "https://10.0.0.1:8008/user-data",
+ "https://10.0.0.1:8008/vendor-data",
+@@ -2518,7 +2515,6 @@ class TestReadSeeded:
+ "https://10.0.0.1:8008",
+ False,
+ [
+- "https://10.0.0.1:8008network-config",
+ "https://10.0.0.1:8008meta-data",
+ "https://10.0.0.1:8008user-data",
+ "https://10.0.0.1:8008vendor-data",
+@@ -2529,7 +2525,6 @@ class TestReadSeeded:
+ "https://10.0.0.1:8008?qs=",
+ True,
+ [
+- "https://10.0.0.1:8008?qs=network-config",
+ "https://10.0.0.1:8008?qs=meta-data",
+ "https://10.0.0.1:8008?qs=user-data",
+ "https://10.0.0.1:8008?qs=vendor-data",
+@@ -2568,7 +2563,7 @@ class TestReadSeeded:
+ # user-data, vendor-data read raw. It could be scripts or other format
+ assert found_ud == "/user-data: 1"
+ assert found_vd == "/vendor-data: 1"
+- assert found_network == {"/network-config": 1}
++ assert found_network is None
+ assert [
+ mock.call(req_url, timeout=5, retries=10) for req_url in req_urls
+ ] == m_read.call_args_list
+@@ -2598,7 +2593,7 @@ class TestReadSeededWithoutVendorData(he
+ self.assertEqual(found_md, {"key1": "val1"})
+ self.assertEqual(found_ud, ud)
+ self.assertEqual(found_vd, vd)
+- self.assertEqual(found_network, {"test": "true"})
++ self.assertIsNone(found_network)
+
+
+ class TestEncode(helpers.TestCase):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll propose a followup PR to address this issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposed #5594 to avoid network-config requests for nocloud
* d/p/no-single-process.patch: Remove single process optimization | ||
* d/p/no-nocloud-network.patch: Remove nocloud network feature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops we also added this to the already released d/changelog entry, not the UNRELEASED entry. Will followup with a fix PR including both of these comments.
Context
See #5581