-
Notifications
You must be signed in to change notification settings - Fork 373
rootless: implement rootless fs and support --rootless option #2429
rootless: implement rootless fs and support --rootless option #2429
Conversation
/test |
17ac5ce
to
7a1b00f
Compare
/test |
Codecov Report
@@ Coverage Diff @@
## master #2429 +/- ##
==========================================
+ Coverage 50.62% 50.65% +0.02%
==========================================
Files 112 114 +2
Lines 16274 16315 +41
==========================================
+ Hits 8239 8264 +25
- Misses 7020 7029 +9
- Partials 1015 1022 +7 |
7a1b00f
to
4151daf
Compare
/test |
4151daf
to
1a3c39d
Compare
/test |
1a3c39d
to
8324fb2
Compare
/test |
review please |
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.
Thanks @devimc - that's a pretty big PR but thanks for doing this and updating the tests too!
lgtm
virtcontainers/clh_test.go
Outdated
clh := &cloudHypervisor{} | ||
store, err := persist.GetDriver() | ||
if err != nil { | ||
t.Errorf("persist.GetDriver() unexpected error != %v", err) |
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: The assert syntax save you two lines of code 😄
assert.NoError(err)
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.
Fixed, thanks
8324fb2
to
e95bfec
Compare
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.
@devimc minor nits/questions from my end. Otherwise lgtm overall.
@@ -208,7 +213,12 @@ func TestAcrnGetSandboxConsole(t *testing.T) { | |||
func TestAcrnCreateSandbox(t *testing.T) { | |||
assert := assert.New(t) | |||
acrnConfig := newAcrnConfig() | |||
a := &Acrn{} | |||
store, err := persist.GetDriver() |
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.
Shoudlnt these tests be run with a mockdriver? I dont see if the the variable mockTesting
has been set to true anywhere?
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.
it's set in TestMain (entrypoint) https://github.com/kata-containers/runtime/pull/2429/files#diff-e8e7e93733a02e75346a2f9d43ad6149R113
cli/main.go
Outdated
if err != nil { | ||
return err | ||
} | ||
// If nil, not set a value, let vc auto-detect rootless |
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 comment is slightly confusing, as we are checking non-nil value below. Perhaps, this could be worded as
If flag is true/false, assign the rootless flag. vc will not perform any auto-detection in that case. In case flag is nil or auto, vc detects if the runtime is running as rootless.
|
||
// from runC | ||
// parseBoolOrAuto returns (nil, nil) if s is empty or "auto" | ||
func parseBoolOrAuto(s string) (*bool, 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.
I know this is a small function, but I think its better to include the runc license in the file if not included since we have taken this code varbatim. cc @grahamwhaley wdyt?
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.
fixed, thanks
5b3ebd7
to
1e0042f
Compare
@amshinde changes applied, thanks |
1e0042f
to
569bbbb
Compare
rootless is used in katautils, cli and virtcontainers. It makes more sense if it's part of virtcontainer, this way virtcontainers won't depend on other runtime subpackages Signed-off-by: Julio Montes <[email protected]>
`agent.getVMPath()` is an almost useless method that can be easily replaced with `filepath.Join()` Signed-off-by: Julio Montes <[email protected]>
Update persist FS API and interface to support rootless and mock filesystem implementations. `RunStoragePath` and `RunVMStoragePath` are part of FS object and may change their path depending on the driver (rootless/mock/fs) Signed-off-by: Julio Montes <[email protected]>
Rootless fs driver inherits from FS and may overwrite its methods. All files and directories created by this driver are under a path accessible for the current user, typically this path is defined by the environment variable `XDG_RUNTIME_DIR`, if this variable is not defined, the default path `/run/user/$UID` is used instead, where $UID is the current user ID. fixes kata-containers#2416 Signed-off-by: Julio Montes <[email protected]>
Mock FS driver can be used in unit testing to allow Mock fs driver inherits from FS and may overwrite its methods. All files and directories created by this driver are under a path accessible for all users, this path is created under the system temporal directory. Signed-off-by: Julio Montes <[email protected]>
GetDriver returns new PersistDriver according to current needs, a mock fs driver is returned when mockTesting is enabled, a rootless fs is returned when rootless is detected, otherwise a fs driver is used. Signed-off-by: Julio Montes <[email protected]>
Fix factory implementation and unit tests to support the new persist API Signed-off-by: Julio Montes <[email protected]>
Fix sandbox implementation and unit tests to support the new persist API Signed-off-by: Julio Montes <[email protected]>
Fix hypervisor implementations and unit tests to support the new persist API Signed-off-by: Julio Montes <[email protected]>
Fix API, container and kata implementations and unit tests to support the new persist API Signed-off-by: Julio Montes <[email protected]>
By default virtcontainer auto-detects if the current process is running rootless or not, but this behavior can change from commandline with the --rootless option fixes kata-containers#2417 Signed-off-by: Julio Montes <[email protected]>
Fix comment on exported var `IsRootless` should be of the form `IsRootless ...` (golint) Signed-off-by: Julio Montes <[email protected]>
569bbbb
to
a45cf62
Compare
/test |
No description provided.