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

lcow: fix debug in startServiceVMIfNotRunning() #37446

Merged
merged 1 commit into from Jul 13, 2018
Merged

Conversation

kolyshkin
Copy link
Contributor

When go-1.11beta1 is used for building, the following error is reported:

14:56:20 daemon\graphdriver\lcow\lcow.go:236: Debugf format %s reads arg #2, but call has 1 arg

While fixing this, let's also fix a few other things in this very function (startServiceVMIfNotRunning()):

  1. Do not use fmt.Printf when not required.
  2. Use title whenever possible.
  3. Don't add id to messages as title already has it.
  4. Remove duplicated colons.
  5. Try to unify style of messages.
  6. s/startservicevmifnotrunning/startServiceVMIfNotRunning/
    ...

In general, logging/debugging here is a mess and requires much more love than I can give it at the moment. Ideas for improvement:

  1. Add a global var logger = logrus.WithField("storage-driver", "lcow") and use it everywhere else in the code.
  2. Use logger.WithField("id", id) whenever possible (same for "context" and other similar fields).
  3. Revise all the errors returned to be uniform.
  4. Make use of errors.Wrap[f] whenever possible.

When go-1.11beta1 is used for building, the following error is
reported:

> 14:56:20 daemon\graphdriver\lcow\lcow.go:236: Debugf format %s reads
> arg #2, but call has 1 arg

While fixing this, let's also fix a few other things in this
very function (startServiceVMIfNotRunning):

1. Do not use fmt.Printf when not required.
2. Use `title` whenever possible.
3. Don't add `id` to messages as `title` already has it.
4. Remove duplicated colons.
5. Try to unify style of messages.
6. s/startservicevmifnotrunning/startServiceVMIfNotRunning/
...

In general, logging/debugging here is a mess and requires much more
love than I can give it at the moment. Areas for improvement:

1. Add a global var logger = logrus.WithField("storage-driver", "lcow")
and use it everywhere else in the code.
2. Use logger.WithField("id", id) whenever possible (same for "context"
and other similar fields).
3. Revise all the errors returned to be uniform.
4. Make use of errors.Wrap[f] whenever possible.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin
Copy link
Contributor Author

@johnstep @ jhowardmsft PTAL

@kolyshkin
Copy link
Contributor Author

This is separated from #37358

@lowenna
Copy link
Member

lowenna commented Jul 12, 2018

Sure. LGTM

@kolyshkin
Copy link
Contributor Author

kolyshkin commented Jul 12, 2018

z and ppc failures are obviously unrelated (some glitch in javaJenkins).

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM, but left some suggestions; I'm ok to do that in a follow up (that is, of course, if you agree) or as part of this PR; let me know

@@ -219,21 +219,21 @@ func (d *Driver) startServiceVMIfNotRunning(id string, mvdToAdd []hcsshim.Mapped
// Use the global ID if in global mode
id = d.getVMID(id)

title := fmt.Sprintf("lcowdriver: startservicevmifnotrunning %s:", id)
title := "lcowdriver: startServiceVMIfNotRunning " + id
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps for a follow up, but we should logrus.WithFields for this information (similar to what we do for other storage drivers)

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 concur (see the patch description).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

...but I'd rather do it in a separate PR later as this fix is quite big already -- and initially it supposed to be a one-liner 🤣

Copy link
Member

Choose a reason for hiding this comment

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

D'oh!! Didn't read that far into your description 🤦‍♂️☺️😝

if err := svm.getStopError(); err != nil {
logrus.Debugf("%s: VM %s did not stop successfully: %s", title, id, err)
logrus.Debugf("%s: VM did not stop successfully: %s", title, err)
Copy link
Member

Choose a reason for hiding this comment

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

logrus.WithError(err).Debug(....)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto

@thaJeztah
Copy link
Member

PowerPC https://jenkins.dockerproject.org/job/Docker-PRs-powerpc/10507/console failure is unrelated, and tracked through #37408

01:09:07 FAIL: docker_api_swarm_service_test.go:311: DockerSwarmSuite.TestAPISwarmServicesFailedUpdate
01:09:07 
01:09:07 [d609c07d09b2c] waiting for daemon to start
01:09:07 [d609c07d09b2c] daemon started
01:09:07 
01:09:07 [d0e6e563a200d] waiting for daemon to start
01:09:07 [d0e6e563a200d] daemon started
01:09:07 
01:09:07 [d6ea22a0c99a1] waiting for daemon to start
01:09:07 [d6ea22a0c99a1] daemon started
01:09:07 
01:09:07 docker_api_swarm_service_test.go:347:
01:09:07     waitAndAssert(c, defaultReconciliationTimeout, daemons[0].CheckRunningTaskImages, checker.DeepEquals,
01:09:07         map[string]int{image1: instances})
01:09:07 docker_utils_test.go:435:
01:09:07     c.Assert(v, checker, args...)
01:09:07 ... obtained map[string]int = map[string]int{"busybox:latest":4}
01:09:07 ... expected map[string]int = map[string]int{"busybox:latest":5}
01:09:07 
01:09:07 [d609c07d09b2c] exiting daemon
01:09:07 [d0e6e563a200d] exiting daemon
01:09:07 [d6ea22a0c99a1] exiting daemon

@thaJeztah thaJeztah merged commit bd0a4ac into moby:master Jul 13, 2018
@kolyshkin kolyshkin deleted the lcow branch July 19, 2018 11:43
@thaJeztah thaJeztah added the area/lcow Issues and PR's related to the experimental LCOW feature label Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/lcow Issues and PR's related to the experimental LCOW feature platform/windows status/2-code-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants