-
Notifications
You must be signed in to change notification settings - Fork 276
Layer refactor #2029
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
Layer refactor #2029
Changes from all commits
47a65a1
49ada2e
00ca088
5abf55c
e0c52cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,6 @@ package main | |
|
|
||
| import ( | ||
| "context" | ||
| "encoding/json" | ||
| "fmt" | ||
| "os" | ||
| "path/filepath" | ||
|
|
@@ -18,10 +17,8 @@ import ( | |
| "google.golang.org/protobuf/types/known/timestamppb" | ||
|
|
||
| "github.com/Microsoft/hcsshim/internal/hcs" | ||
| "github.com/Microsoft/hcsshim/internal/layers" | ||
| "github.com/Microsoft/hcsshim/internal/memory" | ||
| "github.com/Microsoft/hcsshim/internal/oc" | ||
| cimlayer "github.com/Microsoft/hcsshim/internal/wclayer/cim" | ||
| "github.com/Microsoft/hcsshim/internal/winapi" | ||
| ) | ||
|
|
||
|
|
@@ -126,28 +123,8 @@ The delete command will be executed in the container's bundle as its cwd. | |
| fmt.Fprintf(os.Stderr, "failed to delete user %q: %v", username, err) | ||
| } | ||
|
|
||
| // cleanup the layers mounted for the container. We currently only handle cleanup of CimFS | ||
| // layers here. First n-1 values should be the image layerFolders (topmost layer being at | ||
| // index 0) and the last entry should be the scratch layer | ||
| var layerFolders []string | ||
| f, err := os.Open(filepath.Join(bundleFlag, layersFile)) | ||
| if err != nil { | ||
| if !errors.Is(err, os.ErrNotExist) { | ||
| fmt.Fprintf(os.Stderr, "open layers file: %s", err) | ||
| } | ||
| } else { | ||
| defer f.Close() | ||
| if err = json.NewDecoder(f).Decode(&layerFolders); err != nil { | ||
| fmt.Fprintf(os.Stderr, "decode layers json: %s", err) | ||
| } | ||
| } | ||
| if err == nil && cimlayer.IsCimLayer(layerFolders[0]) { | ||
| scratchLayerFolderPath := layerFolders[len(layerFolders)-1] | ||
| err = layers.ReleaseCimFSHostLayers(ctx, scratchLayerFolderPath, idFlag) | ||
| if err != nil { | ||
| fmt.Fprintf(os.Stderr, "cleanup container %q mounts: %s", idFlag, err) | ||
| } | ||
| } | ||
| // TODO(ambarve): | ||
| // correctly handle cleanup of cimfs layers in case of shim process crash here. | ||
|
Comment on lines
+126
to
+127
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the current thinking here? Are we still evaluating with containerd if the new deletion behavior should be changed?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The old behavior of container was actually due to a bug, that means with 2.0 onwards we need to persist layer data for each container started within a shim and properly clean it up during |
||
|
|
||
| if data, err := proto.Marshal(&task.DeleteResponse{ | ||
| ExitedAt: timestamppb.New(time.Now()), | ||
|
|
||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.