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

systemd "unit already exists" error is not ignored during startUnit #2996

Closed
kolyshkin opened this issue Jun 3, 2021 · 1 comment · Fixed by #2997
Closed

systemd "unit already exists" error is not ignored during startUnit #2996

kolyshkin opened this issue Jun 3, 2021 · 1 comment · Fixed by #2997

Comments

@kolyshkin
Copy link
Contributor

This seems like a recent regression (in rc95 maybe).

Test case:

func TestUnitExistsIgnored(t *testing.T) {
       if !IsRunningSystemd() {
               t.Skip("Test requires systemd.")
       }
       if os.Geteuid() != 0 {
               t.Skip("Test requires root.")
       }

       podConfig := &configs.Cgroup{
               Parent: "system.slice",
               Name:   "system-runc_test_exists.slice",
       }
       pm := newManager(podConfig)
       defer pm.Destroy() //nolint:errcheck

       // create twice to make sure "UnitExists" error is ignored.
       for i := 0; i < 2; i++ {
               if err := pm.Apply(-1); err != nil {
                       t.Fatal(err)
               }
       }
}

fails on my system with:

[kir@kir-rhat systemd]$ sudo ./systemd.test -test.v -test.run Exis
=== RUN   TestUnitExistsIgnored
    systemd_test.go:192: error while starting unit "system-runc_test_exists.slice" with properties [{Name:Description Value:"libcontainer container system-runc_test_exists.slice"} {Name:Wants Value:["system.slice"]} {Name:MemoryAccounting Value:true} {Name:CPUAccounting Value:true} {Name:IOAccounting Value:true} {Name:TasksAccounting Value:true} {Name:DefaultDependencies Value:false}]: Unit system-runc_test_exists.slice already exists.
--- FAIL: TestUnitExistsIgnored (0.04s)
FAIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant