-
Notifications
You must be signed in to change notification settings - Fork 72
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
move unshare into chdir #277
base: main
Are you sure you want to change the base?
Conversation
@Burning1020 @fuweid Thanks for suggestion. |
e239630
to
87e134e
Compare
let fs_type = Some("overlay"); | ||
let source = Some("overlay"); | ||
let workdir = | ||
"/var/lib/containerd-test/io.containerd.snapshotter.v1.overlayfs/snapshots/0/work"; |
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.
To be honest, I don't think it's good idea to create test folder like this. Please use /tmp/$RANDOM-LONG-STRING
. Thanks.
let target = "/run/containerd/io.containerd.runtime.v2.task/k8s.io/mount-test/rootfs"; | ||
std::fs::create_dir_all(target).unwrap(); | ||
let current_dir = env::current_dir().unwrap(); | ||
std::thread::spawn(move || mount_rootfs(fs_type, source, &options, target).unwrap()); |
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.
Why must it spawn thread to mount it?
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.
because this mount_rootfs is called in a new thread by tokio::spawn_blocking, so I think it's better to test mount_rootfs in a spawn thread.
We don't need clone if we don't need to change current dir.