Merge ~raharper/cloud-init:fix/centos-wait-network-manager into cloud-init:master

Proposed by Ryan Harper
Status: Merged
Approved by: Ryan Harper
Approved revision: fbdd2273964a5aaee792e20ffa07b2b7b7eab704
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~raharper/cloud-init:fix/centos-wait-network-manager
Merge into: cloud-init:master
Diff against target: 12 lines (+1/-0)
1 file modified
systemd/cloud-init.service.tmpl (+1/-0)
Reviewer Review Type Date Requested Status
Scott Moser Needs Information
Server Team CI bot continuous-integration Approve
Dan Watkins Approve
Review via email: mp+372624@code.launchpad.net

Commit message

cloud-init.service: on centos/fedora/redhat wait on NetworkManager.service

In Centos/RHEL 8, NetworkManager is installed as the networking service.
cloud-init.service needs to run After this service to allow the OS to
bring networking up first.

LP: #1843334

To post a comment you must log in.
Revision history for this message
Dan Watkins (oddbloke) wrote :

After= won't pull NetworkManager.service into the boot graph (that would be Wants=), so this should only introduce a dependency on NetworkManager.service when it would already run during boot.

I can't think of a case where this would cause problems.

review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:fbdd2273964a5aaee792e20ffa07b2b7b7eab704
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1118/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1118//rebuild

review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :

| After= won't pull NetworkManager.service into the boot graph (that
| would be Wants=), so this should only introduce a dependency on
| NetworkManager.service when it would already run during boot.
|
| I can't think of a case where this would cause problems.

Then why not go all-in?
The default case should have it.

Just move it up to after the 'systemd-networkd-wait-online.service'

Revision history for this message
Scott Moser (smoser) :
review: Needs Information
Revision history for this message
Scott Moser (smoser) wrote :

moved to needs-review.
I'm ok if it is moved back to 'Approved' after response, but I jsut didn't want it to autoland.

Revision history for this message
Ryan Harper (raharper) wrote :

I stopped the autoland job; it was already in progress.

Yes, I suspect what we should instead use is:

NetworkManager-wait-online.service

much like the systemd-networkd-wait-online.service

For images which have both installed, it unfortunately adds no-zero amount of boot latency.

Here's networkd-only:

root@e1:~# systemd-analyze critical-chain cloud-init.service
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.

cloud-init.service +622ms
└─systemd-networkd-wait-online.service @1.476s +212ms
  └─systemd-networkd.service @1.263s +211ms
    └─network-pre.target @1.262s
      └─cloud-init-local.service @709ms +552ms
        └─systemd-journald.socket @145ms
          └─system.slice @143ms
            └─-.slice @143ms

Here's networkd with the After=NetworkManager-wait-online.service *but NM is not installed*
(no impact, as expected)

root@e1:~# systemd-analyze critical-chain cloud-init.service
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.

cloud-init.service +635ms
└─systemd-networkd-wait-online.service @1.510s +175ms
  └─systemd-networkd.service @1.289s +219ms
    └─network-pre.target @1.288s
      └─cloud-init-local.service @717ms +570ms
        └─systemd-journald.socket @97ms
          └─system.slice @96ms
            └─-.slice @96ms

After installing NetworkManager:

root@e1:~# systemd-analyze critical-chain cloud-init.service
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.

└─NetworkManager-wait-online.service @1.772s +700ms
  └─NetworkManager.service @1.488s +282ms
    └─network-pre.target @1.483s
      └─cloud-init-local.service @811ms +566ms
        └─systemd-journald.socket @152ms
          └─-.mount @150ms
            └─systemd-journald.socket @152ms
              └─...

Revision history for this message
Ryan Harper (raharper) wrote :

Taking this as-is.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
index 5cb0037..b08da1c 100644
--- a/systemd/cloud-init.service.tmpl
+++ b/systemd/cloud-init.service.tmpl
@@ -12,6 +12,7 @@ After=networking.service
12{% endif %}12{% endif %}
13{% if variant in ["centos", "fedora", "redhat"] %}13{% if variant in ["centos", "fedora", "redhat"] %}
14After=network.service14After=network.service
15After=NetworkManager.service
15{% endif %}16{% endif %}
16{% if variant in ["suse"] %}17{% if variant in ["suse"] %}
17Before=wicked.service18Before=wicked.service

Subscribers

People subscribed via source and target branches