Skip to content

LCOW: Support most operations excluding remote filesystem#33241

Merged
johnstep merged 27 commits intomoby:masterfrom
microsoft:jjh/multi-layerstore
Jun 21, 2017
Merged

LCOW: Support most operations excluding remote filesystem#33241
johnstep merged 27 commits intomoby:masterfrom
microsoft:jjh/multi-layerstore

Conversation

@lowenna
Copy link
Member

@lowenna lowenna commented May 17, 2017

Signed-off-by: John Howard jhoward@microsoft.com

This is the start of the Linux Containers on Windows changes and implements a significant chunk of it.

This PR enables pull of a Linux image on Windows, committing a layer, basics of build, import and export. It does NOT include the remote filesystem work that is being tracked separately to allow things such as COPY or ADD to work (which need remoting to a service VM as Windows can't directly read or perform operations on a Linux filesystem).

This PR has been updated based on feedback from @crosbymichael so that when LCOW is enabled, the daemon assumes Linux-mode, and won't be able to run/see Windows containers, or see any Windows images. This update means that no API changes are required while the UX changes are being investigated separately. This is an artificial crippling with no technical reason.

park
(In memory of Guide Dogs for the Blind puppy-in-training "Park", front left. He sadly passed too young. 1st Jan 2016 - 16th June 2017. Rest in peace, sweet boy 🐶 💛

My two guys in the background, another former GDB puppy-in-training, "Palmetto" front-right )

@lowenna lowenna force-pushed the jjh/multi-layerstore branch 3 times, most recently from 5507b5d to 931c67d Compare May 17, 2017 04:36
@lowenna lowenna changed the title IGNORE - WIP LCOW: IGNORE - WIP May 17, 2017
@lowenna lowenna force-pushed the jjh/multi-layerstore branch 10 times, most recently from 4c5b3fe to fc8301b Compare May 19, 2017 18:11
@lowenna lowenna changed the title LCOW: IGNORE - WIP [WIP] LCOW: Initial implementation May 19, 2017
@lowenna
Copy link
Member Author

lowenna commented May 19, 2017

@lowenna lowenna force-pushed the jjh/multi-layerstore branch 3 times, most recently from 64e06c6 to f694446 Compare May 31, 2017 19:00
@lowenna lowenna force-pushed the jjh/multi-layerstore branch 2 times, most recently from 0e77baf to 7f63c2b Compare May 31, 2017 23:33
@lowenna lowenna force-pushed the jjh/multi-layerstore branch 4 times, most recently from 21718fb to 88b47e2 Compare June 2, 2017 02:40
John Howard added 12 commits June 20, 2017 19:49
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: John Howard <jhoward@microsoft.com>
…face

Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: John Howard <jhoward@microsoft.com>
@lowenna
Copy link
Member Author

lowenna commented Jun 21, 2017

Update: #33757 should fix the docker-py failures currently on master affecting janky and experimental

@lowenna
Copy link
Member Author

lowenna commented Jun 21, 2017

Short of a rebase once 33757 is merged to alleviate the docker-py failures, this is fully reviewable in its current state. @crosbymichael @stevvooe @dmcgowan PTAL

@friism, @thaJeztah FYI

@lowenna
Copy link
Member Author

lowenna commented Jun 21, 2017

Yay, green again 💚

@crosbymichael
Copy link
Contributor

LGTM

Copy link
Member

@johnstep johnstep left a comment

Choose a reason for hiding this comment

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

LGTM

type ImageComponent interface {
SquashImage(from string, to string) (string, error)
TagImageWithReference(image.ID, reference.Named) error
TagImageWithReference(image.ID, string, reference.Named) error
Copy link
Member

Choose a reason for hiding this comment

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

platform string?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, just string is correct :)

func NewDefaultDirective() *Directive {
directive := Directive{}
directive.setEscapeToken(string(DefaultEscapeToken))
directive.setPlatformToken(runtime.GOOS)
Copy link
Member

Choose a reason for hiding this comment

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

DefaultPlatformToken instead of runtime.GOOS

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, fixing in a nits PR shortly


var defaultShell = []string{"cmd", "/S", "/C"}
func defaultShellForPlatform(platform string) []string {
if platform == "linux" {
Copy link
Member

Choose a reason for hiding this comment

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

What about moving defaultShellForPlatform to builder.go, rather than duplicating the Unix shell?

if err := bt.imageComponent.TagImageWithReference(imageID, rt); err != nil {
// TODO @jhowardmsft LCOW support. Will need revisiting.
platform := runtime.GOOS
if platform == "windows" && system.LCOWSupported() {
Copy link
Member

Choose a reason for hiding this comment

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

Remove redundant platform == "windows" check since implicit in system.LCOWSupported? Since this check is duplicated in many places, it might not be worth the effort. It would be nice to have a common function.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in nits PR about to be submitted

// we need to replace the 'env' keys where they match and append anything
// else.
//return ReplaceOrAppendEnvValues(linkedEnv, container.Config.Env)
foo := ReplaceOrAppendEnvValues(env, container.Config.Env)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Remove the commented out return line, and change foo := to env = .

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in nits PR about to be submitted

// Make sure layers are created with the correct ACL so that VMs can access them.
layerPath := d.dir(id)
logrus.Debugf("lcowdriver: create: id %s: creating layerPath %s", id, layerPath)
// Make sure the layers are created with the correct ACL so that VMs can access them.
Copy link
Member

Choose a reason for hiding this comment

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

Redundant comment, almost identical to comment 3 lines above.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in nits PR about to be submitted

}

// panicIfUsedByLcow does exactly what it says.
// TODO @jhowardmsft - this is an temporary measure for the bring-up of
Copy link
Member

Choose a reason for hiding this comment

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

Nit: "a temporary"

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in nits PR about to be submitted

}
}

// TODO @jhowardmsft LCOW support. For now, hard-code the platform shown for the driver status
Copy link
Member

Choose a reason for hiding this comment

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

Seems okay for now, but maybe also only list the corresponding driver instead of all (both) drivers?

logrus.Warnf("libcontainerd: HasPendingUpdates() failed (container may have been killed): %s", err)
} else {
si.UpdatePending = updatePending
// Pending updates is only applicable for WCOW
Copy link
Member

Choose a reason for hiding this comment

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

Ha, first time I have seen "WCOW"...

for _, rt := range bt.repoAndTags {
if err := bt.imageComponent.TagImageWithReference(imageID, rt); err != nil {
// TODO @jhowardmsft LCOW support. Will need revisiting.
platform := runtime.GOOS
Copy link
Member

@johnstep johnstep Jun 21, 2017

Choose a reason for hiding this comment

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

Even if they are removed, it would be been nice to have separate functions, something like GetEffectivePlatform, IsWindowsPlatform (check if it is WCOW), and something like EnsurePlatform (make sure platform is not empty). This might seem trivial, but would allow comments and reasoning to be in one place.

Also, the request was to always be in Linux or always be in Windows mode, and I think that means platform could have been set once, globally, instead of "computed" all over the place. It was not really about crippling, but about breaking down the work into smaller phases. However, the current changes should make it easier to switch to multiple platform support, so this approach seems okay to me.

@lowenna
Copy link
Member Author

lowenna commented Jun 21, 2017

@johnstep - spoke offline on slack, but yes, all these nits can easily be addressed in a followup. Thanks for reviewing!

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 status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants