check that StartTransientUnit/StopUnit succeeds#2331
check that StartTransientUnit/StopUnit succeeds#2331kolyshkin merged 1 commit intoopencontainers:masterfrom
Conversation
|
@kolyshkin PTAL |
613c712 to
28fc3f3
Compare
kolyshkin
left a comment
There was a problem hiding this comment.
Thank you for working on that! Left a couple of nits.
Can you also add the same code (wait for the operation to complete, check it's "done", return an error if not) to the Destroy() method. Currently it does not even wait.
Oh, finally, could you please wait until #2299 is merged and then rebase? It is mostly code refactoring in there.
|
@lifubang have you tested that the fix works? I have described the repro in details here: containers/crun#331 (comment), should take 10-15 minutes to check it (mostly waiting for vagrant up). |
OK |
I have tested it in vmware. |
bb47d24 to
c0b435d
Compare
I add it in #2329 |
|
Needs rebase |
c0b435d to
3edc556
Compare
77d1669 to
b47cad6
Compare
2aa85d6 to
a5d5d89
Compare
libcontainer/cgroups/systemd/v2.go
Outdated
| select { | ||
| case s := <-statusChan: | ||
| if DbusJobCompletionResultType(s) != DbusJobDone { | ||
| logrus.Warnf("error stopping unit `%s`: got `%s`. Continuing...", unitName, s) |
There was a problem hiding this comment.
I think s/stopping/removing/ is better.
|
|
||
| const ( | ||
| DbusJobDone DbusJobCompletionResultType = "done" | ||
| DbusJobCanceled DbusJobCompletionResultType = "canceled" |
There was a problem hiding this comment.
Are you using any of those (I mean, except for DbusJobDone)?
| ) | ||
|
|
||
| // Refer to https://github.com/coreos/go-systemd/blob/5a0db84d3dc459ccdc6ffcc44b1c452bf9f171cb/dbus/methods.go#L78-L101 | ||
| // or https://godoc.org/github.com/coreos/go-systemd/dbus#Conn.StartUnit |
There was a problem hiding this comment.
these two are the same: one is the source code, another is godoc extracted from it.
And we only need "done", let's not overcomplicate things.
There was a problem hiding this comment.
In v1, shall we need to add this?
If yes, I'll add a const string DbusJobDone.
8fcd201 to
ac366bc
Compare
@kolyshkin this code also can fix #2344 |
libcontainer/cgroups/systemd/v2.go
Outdated
| // Please refer to https://godoc.org/github.com/coreos/go-systemd/dbus#Conn.StartUnit | ||
| if s != "done" { | ||
| logrus.Warnf("error removing unit `%s`: got `%s`. Continuing...", unitName, s) | ||
| } |
There was a problem hiding this comment.
The channel can be closed here?
There was a problem hiding this comment.
I think we should not close the channel, because if someone send string to this closed channel, it will cause goroutine panic. Although I guess there is nobody would send sth to this channel.
There was a problem hiding this comment.
I checked the github.com/coreos/go-systemd/dbus code.
Looks like once it sends a string over the channel it forgets it. So yes we should close the channel -- unless we hit the timeout!
|
So, I guess this code should be moved to |
0da17ed to
59912cd
Compare
|
Both v1 and v2 are using the same |
| return false | ||
| } | ||
|
|
||
| func startJob(unitName string, properties []systemdDbus.Property) error { |
There was a problem hiding this comment.
Job is a very misleading term here.
| return nil | ||
| } | ||
|
|
||
| func stopJob(unitName string) error { |
kolyshkin
left a comment
There was a problem hiding this comment.
Nit wrt functions naming. Otherwise, it's perfecto!
59912cd to
2b91a2d
Compare
|
needs rebase |
2b91a2d to
b0fffaa
Compare
|
@kolyshkin LGTY? |
Signed-off-by: lifubang <lifubang@acmcoder.com>
b0fffaa to
bfa1b2a
Compare
fix #2313(relate to #2310) #2344
To fix #2313
We can check whether
StartTransientUnitsucceeds or not with the value from the channel.If we got
failed, we should runResetFailedUnitand return the error.The error
ERRO[0000] cannot detect unified pathrelates to #2329 .To fix #2344
We should wait
StopUnitsucceeds.Signed-off-by: lifubang lifubang@acmcoder.com