Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Moves runc logs to per container id #139

Merged
merged 1 commit into from
Sep 21, 2017
Merged

Conversation

jterry75
Copy link
Contributor

Resolves: #130

@msftclas
Copy link

@jterry75,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

beweedon
beweedon previously approved these changes Sep 15, 2017
Copy link
Contributor

@beweedon beweedon left a comment

Choose a reason for hiding this comment

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

Just a couple comments! They're minor, so I'm just going to mark this as approved and you can decide what to do with them :)

BeforeEach(func() {
expectedPath = "/var/run/gcsrunc/log.log"
expectedPath = "/tmp/gcs/" + id + "runc.log"
Copy link
Contributor

Choose a reason for hiding this comment

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

You'll probably notice this when the tests are done, but I think there should be a slash before runc.log here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ha. Yea your right. I wish I could run these locally

func (r *runcRuntime) getLogPath() string {
return filepath.Join(containerFilesDir, "log.log")
func (r *runcRuntime) getLogPath(id string) string {
return filepath.Join("/tmp/gcs", id, "runc.log")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: It would be nice to have "/tmp/gcs" in some constant somewhere, either by having an actual constant or using getStorageRootPath()

@rn
Copy link
Contributor

rn commented Sep 16, 2017

doesn't this require changes to https://github.com/Microsoft/opengcs/blob/master/client/process.go#L139 as well?

@jterry75
Copy link
Contributor Author

@rn - good point
@beweedon - I'm not sure this change makes sense given the debugging work. We either need to T the logs to a global and a per container log or just leave them as global (ie: revert this and close the issue). Otherwise we wont be able to get the full picture from a debug call. You would need to call it once per container id.

@beweedon
Copy link
Contributor

My reasoning for this change was that it would be good to have runc logs separated out by container because when debugging a failure, you'd probably want to localize your search to individual containers at a time rather than every piece of logging done by runc for all containers. This is less relevant now, and more useful when we support multiple containers per uvm. Also, this change allows all logs to be coalesced a bit under /tmp, rather than spread out to /var/run/gcsrunc.

@jhowardmsft, I know you were also enthusiastic about this change :). You know a lot more about this from the docker end than I do, so I'm not sure what your thoughts are.

@lowenna
Copy link
Contributor

lowenna commented Sep 18, 2017

If I'm understanding the comments above correctly, it should be a straightforward change to the debug code to just cat the right log. Remember the daemon only runs a single container in a utility VM (even though we support >1 through HCS).

@jterry75
Copy link
Contributor Author

@jhowardmsft - The issue is that we don't actually know the container id in the debug code. If we move it from a global location we could certainly cat them all (I get that it is just 1 for now) but I don't know how you would specify the actual id your interested in.

@lowenna
Copy link
Contributor

lowenna commented Sep 18, 2017

I'm already one step ahead of you :) Spoke in person.....

@jterry75
Copy link
Contributor Author

Added an extra call to make the container dir for the tests but in most cases this won't do anything. Now the tests are passing and the PR should be good for final review.

@@ -136,7 +136,8 @@ func (config *Config) DebugGCS() {
cmd += debugCommand("ls -l /tmp/gcs/*")
cmd += debugCommand("cat /tmp/gcs/*/config.json")
cmd += debugCommand("ls -lR /var/run/gcsrunc")
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably change too now.... (I don't think /var/run/gcs* is used anymore)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It still is used. We write the pid file there for create container/process

Copy link
Contributor

Choose a reason for hiding this comment

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

It isn't used for logs anymore, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree but isn't it usefully to get an output of all the pid files? IE: all the running process in runc?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure. The more the merrier :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alternatively I can move the use of this dir to be /tmp/gcs/(id)/ too?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we don't care about the runc wrapper being a generic wrapper that can be used outside of this project, I think it makes sense to merge it as much as possible with the GCS. Also, I guess in addition to pid files there are also process.json files under /var/run/gcsrunc, which could definitely be useful for logging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@beweedon - Want to open an issue for merging the two then? I don't see any use cases for a runc wrapper library. Its primarily just for us and how we use runc

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure thing!

Copy link
Contributor

Choose a reason for hiding this comment

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

@jterry75
Copy link
Contributor Author

@soccerGB - anything left for me to do here?

@soccerGB soccerGB merged commit e9838ce into microsoft:master Sep 21, 2017
@jterry75 jterry75 deleted the 130 branch September 22, 2017 19:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants