Skip to content
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

[switchdev 4/x] split systemd service to two parts #602

Merged

Conversation

ykulazhenkov
Copy link
Collaborator

@ykulazhenkov ykulazhenkov commented Jan 30, 2024

split systemd service to two parts:
The first part is executed before the
NeworkManager or systemd-networkd
starts on the host.
The second part is triggered after the
network configuration is complete.

This change is required to support hw offload
use-case with systemd service.

cc @adrianchiris @zeeke @SchSeba

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

Description=Configures SRIOV NIC - pre network configuration
DefaultDependencies=no
After=network-pre.target systemd-udev-settle.service systemd-sysusers.service systemd-sysctl.service
Before=network.target NetworkManager.service systemd-networkd.service ovs-vswitchd.service ovsdb-server.service
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: If a service defined in After or Before section is not exist it will be simply ignored.

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@coveralls
Copy link

coveralls commented Jan 31, 2024

Pull Request Test Coverage Report for Build 7842844986

  • -72 of 259 (72.2%) changed or added relevant lines in 5 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+4.4%) to 30.252%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/daemon/daemon.go 0 6 0.0%
pkg/plugins/k8s/k8s_plugin.go 55 63 87.3%
pkg/systemd/systemd.go 17 44 38.64%
cmd/sriov-network-config-daemon/service.go 112 143 78.32%
Files with Coverage Reduction New Missed Lines %
pkg/daemon/daemon.go 1 38.0%
Totals Coverage Status
Change from base Build 7827672350: 4.4%
Covered Lines: 3557
Relevant Lines: 11758

💛 - Coveralls

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

Copy link

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

Copy link

github-actions bot commented Feb 1, 2024

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

Signed-off-by: Yury Kulazhenkov <ykulazhenkov@nvidia.com>
Copy link

github-actions bot commented Feb 1, 2024

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@ykulazhenkov
Copy link
Collaborator Author

PR updated to add tests for systemd service

Copy link

github-actions bot commented Feb 1, 2024

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

Copy link
Collaborator

@adrianchiris adrianchiris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@zeeke zeeke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments. I'm finding a little bit difficult to read the service.go file with that phase variable read in many places.
Have you considered the option of creating two functions runServiceCmdPre() and runServiceCmdPost() called at the very beginning of runServiceCmd()? That way we have a bunch of duplicated code, but we'd get rid of many if/else statments. WDYT?

cmd/sriov-network-config-daemon/service.go Outdated Show resolved Hide resolved
cmd/sriov-network-config-daemon/service.go Outdated Show resolved Hide resolved
The service has required argument "phase"
Two phases are supported now:
 * pre - before the NetworkManager or systemd-networkd
* post - after the NetworkManager or systemd-networkd
"sriov-config" systemd unit is responsible for starting the service in the "pre" phase mode.
"sriov-config-post-network" systemd unit starts the service in the "post" phase mode.
The service may use different plugins for each phase and call different initialization flows.
The "post" phase checks the completion status of the "pre" phase by reading the sriov result file.
The "pre" phase should set "InProgress" status if it succeeds or "Failed" otherwise.
If the result of the "pre" phase is different than "InProgress", then the "post" phase will not be executed
and the execution result will be forcefully set to "Failed".

Signed-off-by: Yury Kulazhenkov <ykulazhenkov@nvidia.com>
The first part is executed before the
NeworkManager or systemd-networkd
starts on the host.
The second part is triggered after the
network configuration is complete.

This change is required to support hw offload
use-case with systemd service.

Signed-off-by: Yury Kulazhenkov <ykulazhenkov@nvidia.com>
Copy link

github-actions bot commented Feb 9, 2024

Thanks for your PR,
To run vendors CIs use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@ykulazhenkov
Copy link
Collaborator Author

Left a few comments. I'm finding a little bit difficult to read the service.go file with that phase variable read in many places. Have you considered the option of creating two functions runServiceCmdPre() and runServiceCmdPost() called at the very beginning of runServiceCmd()? That way we have a bunch of duplicated code, but we'd get rid of many if/else statments. WDYT?

Thanks for the review @zeeke.
I removed usage of the global phase variable, also I rearranged code a bit to handle phases in a more explicit manner.

Copy link
Member

@zeeke zeeke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zeeke zeeke merged commit 97e82b4 into k8snetworkplumbingwg:master Feb 9, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants