-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Implementation of SQL-backed state #26
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
Conversation
libpod/container.go
Outdated
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.
logrus.Wrapf
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 don't think there is such a function?
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 was thinking about this.
func (c *Container) Create() (err error) {
But you already have it, so all set.
libpod/container.go
Outdated
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 belive you need to pass in err
defer func() err error
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.
Not necessary - the error returned by Create() is named err, so this will always be the error returned by the function
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 agree.
libpod/container.go
Outdated
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.
Do we need these lines?
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 is cleanup - it ensures the state knows the container is unmounted
libpod/sql_state.go
Outdated
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.
Put on single line.
if err := s.db.Close()
|
@nalind @mitrmac ptal |
|
@mheon Please cleanup gofmt and lint errors. |
|
Wired the SQL backed state into the rest of libpod. Still needs unit tests. |
|
Tests are segfaulting. Looks like a combination of errors (initializing the SQL-backed state is erroring, and then the deferred function to clean up the store on an error is segfaulting. I really don't understand how that segfault is happening, but I'll try and dig into this. |
854e011 to
f676180
Compare
libpod/container.go
Outdated
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 agree.
libpod/options.go
Outdated
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.
nit: remove line.
libpod/runtime.go
Outdated
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.
Why not defer it?
libpod/sql_state.go
Outdated
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.
Don't you need to use err error for defer func below?
libpod/runtime.go
Outdated
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.
Nit: Can you do this in a single line?
if _, err2 := store.Shutdwon(false); err2 != nil
libpod/runtime_ctr.go
Outdated
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.
Should this be c.pod?
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.
c is probably going to be nil when this is called, because we always return nil, err when an error occurs. If I could, I wouldn't have a variable assigned to the container we return at all, only the error, but I think Go won't let me do that.
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.
Ok I guess this works, as long as this function is always called after ctr is created. I don't think go should require you to name the variable, or does it do this, because if you name one return you have to name them all?
TomSweeneyRedHat
left a comment
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. I would like to see this one go in at least a week or more before then next release. I'd like to see us run with it internally quite a bit before it gets put into an official kit. I'd also like Sebastian to run a perf run before making a kit too.
Nice chunk of work @mheon.
|
Well Sebastion has not tested perf on kpod at all yet, and I am pretty sure it would be really bad. :^( |
|
@rhatdan, I'd thought kpd was being used in some of the calls that Sebastian was doing. If not, then yeah, no need to tie him in. |
|
☔ The latest upstream changes (presumably #47) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@mheon Rebase. |
Signed-off-by: Matthew Heon <[email protected]>
Signed-off-by: Matthew Heon <[email protected]>
Signed-off-by: Matthew Heon <[email protected]>
Signed-off-by: Matthew Heon <[email protected]>
Signed-off-by: Matthew Heon <[email protected]>
Signed-off-by: Matthew Heon <[email protected]>
This one cleans up after container creation fails Signed-off-by: Matthew Heon <[email protected]>
If StopSignal is 0, it is assumed that the default signal will be used. Signed-off-by: Matthew Heon <[email protected]>
Signed-off-by: Matthew Heon <[email protected]>
Signed-off-by: Matthew Heon <[email protected]>
|
Tests can land in another PR. @rhatdan this should be ready to merge. |
|
Ok lets merge and we can start testing as we merge components in. |
vendor.conf has been pinned at containerd/cgroups@7a5fdd83 (Merge pull request containers#26 from onorua/error-ignore-example, 2017-08-24) since libpod forked from CRI-O with a031b83 (Initial checkin from CRI-O repo, 2017-11-01). The content in vendor/github.com/containerd/cgroups was bumped to containerd/cgroups@77e62851 (Use /proc/diskstats to get device names, 2018-01-31) in ae89dc2 (Update containerd/cgroups repo fix perf issue, 2018-02-01, containers#284), but ae89dc2 forgot to update vendor.conf. With this commit: $ vndr github.com/containerd/cgroups no longer changes anything under vendor/github.com/containerd/cgroups. Signed-off-by: W. Trevor King <[email protected]>
vendor.conf has been pinned at containerd/cgroups@7a5fdd83 (Merge pull request #26 from onorua/error-ignore-example, 2017-08-24) since libpod forked from CRI-O with a031b83 (Initial checkin from CRI-O repo, 2017-11-01). The content in vendor/github.com/containerd/cgroups was bumped to containerd/cgroups@77e62851 (Use /proc/diskstats to get device names, 2018-01-31) in ae89dc2 (Update containerd/cgroups repo fix perf issue, 2018-02-01, #284), but ae89dc2 forgot to update vendor.conf. With this commit: $ vndr github.com/containerd/cgroups no longer changes anything under vendor/github.com/containerd/cgroups. Signed-off-by: W. Trevor King <[email protected]> Closes: #749 Approved by: mheon
linting our content
Still not wired into the rest of the project