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

Add test for support of NFS mount #1726

Merged
merged 1 commit into from
May 30, 2023
Merged

Add test for support of NFS mount #1726

merged 1 commit into from
May 30, 2023

Conversation

ambarve
Copy link
Contributor

@ambarve ambarve commented Apr 12, 2023

LCOW kernel needs to be built with certain config options(CONFIG_NFS_FS=y, CONFIG_NFS_V4=y & CONFIG_NFS_V4_1=y)_in order to be able to successfully run a NFS client and mount a NFS inside a container. This test attempts to mount a (fake) NFS server to ensure that the kernel has the capabilities of running a NFS client.

We don't mount a real NFS server because creating a real NFS server that will work in all kinds of test environments is not simple. Instead, we look at the error returned by the NFS mount operation and decide if the failure is because the server wasn't available (i.e a Connection refused error) or because the kernel doesn't support NFS clients (No Device error).

Limitations on different approaches of starting a real NFS server:

  1. Starting another LCOW container that runs a NFS server: By default on Linux the NFS server runs in the kernel and to enable that the kernel must be built with NFSD_* config options (note that the config options for running NFS server are different than the config options required for NFS client), which we don't currently do and it doesn't make sense to just enable these options for a test.
  2. Running a userspace NFS server: There are a few userspace NFS server projects but getting them to run inside the UtilityVM wasn't very easy. We didn't want to spend a lot of time on this test.
  3. Running NFS server on the windows host: Not all builds of windows support this so the test won't run in all environments.

@ambarve ambarve requested a review from a team as a code owner April 12, 2023 00:00
Copy link
Contributor

@helsaawy helsaawy left a comment

Choose a reason for hiding this comment

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

We're basically expecting all future LCOW images to have NFS support, right?

test/cri-containerd/main_test.go Outdated Show resolved Hide resolved
test/cri-containerd/container_test.go Outdated Show resolved Hide resolved
test/cri-containerd/container_test.go Show resolved Hide resolved
execHelper := func(ctrID string, cmd []string) (string, string, int) {
stdout, stderr, errcode := execContainer(t, client, ctx, ctrID, cmd)
if errcode != 0 {
t.Logf("stdout: %s \n\n stderr: %s\n\n", stdout, stderr)
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a t.Helper() call before the t.Logf call?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want the t.Helper() to be in the errcode block of code or outside of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shouldn't matter I think. Either works.

@ambarve ambarve force-pushed the nfs_test branch 2 times, most recently from c7557e5 to 26f263e Compare May 15, 2023 21:37
@ambarve
Copy link
Contributor Author

ambarve commented May 15, 2023

We're basically expecting all future LCOW images to have NFS support, right?

Yeah, we just want to ensure that the kernel has the required NFS client modules. If the assumptions changes in the future, we will have to update the test.

LCOW kernel needs to be built with certain config options(`CONFIG_NFS_FS=y`, `CONFIG_NFS_V4=y` &
`CONFIG_NFS_V4_1=y`)_in order to be able to successfully run a NFS client and mount a NFS inside a
container. This test attempts to mount a (fake) NFS server to ensure that the kernel has the capabilities of
running a NFS client.

We don't mount a real NFS server because creating a real NFS server that will work in all kinds of test
environments is not simple. Instead, we look at the error returned by the NFS mount operation and decide if
the failure is because the server wasn't available (i.e a `Connection refused` error) or because the kernel
doesn't support NFS clients (`No Device` error).

Limitations on different approaches of starting a real NFS server:
1. Starting another LCOW container that runs a NFS server: By default on Linux the NFS server runs in the
kernel and to enable that the kernel must be built with `NFSD_*` config options (note that the config options
for running NFS server are different than the config options required for NFS client), which we don't
currently do and it doesn't make sense to just enable these options for a test.
2. Running a userspace NFS server: There are a few userspace NFS server projects but getting them to run
inside the UtilityVM wasn't very easy. We didn't want to spend a lot of time on this test.
3. Running NFS server on the windows host: Not all builds of windows support this so the test won't run in all
environments.

Signed-off-by: Amit Barve <ambarve@microsoft.com>
Copy link
Contributor

@katiewasnothere katiewasnothere left a comment

Choose a reason for hiding this comment

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

lgtm

@ambarve ambarve merged commit e322ac5 into main May 30, 2023
kiashok pushed a commit to kiashok/hcsshim that referenced this pull request Oct 3, 2023
LCOW kernel needs to be built with certain config options(`CONFIG_NFS_FS=y`, `CONFIG_NFS_V4=y` &
`CONFIG_NFS_V4_1=y`)_in order to be able to successfully run a NFS client and mount a NFS inside a
container. This test attempts to mount a (fake) NFS server to ensure that the kernel has the capabilities of
running a NFS client.

We don't mount a real NFS server because creating a real NFS server that will work in all kinds of test
environments is not simple. Instead, we look at the error returned by the NFS mount operation and decide if
the failure is because the server wasn't available (i.e a `Connection refused` error) or because the kernel
doesn't support NFS clients (`No Device` error).

Limitations on different approaches of starting a real NFS server:
1. Starting another LCOW container that runs a NFS server: By default on Linux the NFS server runs in the
kernel and to enable that the kernel must be built with `NFSD_*` config options (note that the config options
for running NFS server are different than the config options required for NFS client), which we don't
currently do and it doesn't make sense to just enable these options for a test.
2. Running a userspace NFS server: There are a few userspace NFS server projects but getting them to run
inside the UtilityVM wasn't very easy. We didn't want to spend a lot of time on this test.
3. Running NFS server on the windows host: Not all builds of windows support this so the test won't run in all
environments.

Signed-off-by: Amit Barve <ambarve@microsoft.com>
(cherry picked from commit e322ac5)
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
kiashok pushed a commit to kiashok/hcsshim that referenced this pull request Oct 3, 2023
LCOW kernel needs to be built with certain config options(`CONFIG_NFS_FS=y`, `CONFIG_NFS_V4=y` &
`CONFIG_NFS_V4_1=y`)_in order to be able to successfully run a NFS client and mount a NFS inside a
container. This test attempts to mount a (fake) NFS server to ensure that the kernel has the capabilities of
running a NFS client.

We don't mount a real NFS server because creating a real NFS server that will work in all kinds of test
environments is not simple. Instead, we look at the error returned by the NFS mount operation and decide if
the failure is because the server wasn't available (i.e a `Connection refused` error) or because the kernel
doesn't support NFS clients (`No Device` error).

Limitations on different approaches of starting a real NFS server:
1. Starting another LCOW container that runs a NFS server: By default on Linux the NFS server runs in the
kernel and to enable that the kernel must be built with `NFSD_*` config options (note that the config options
for running NFS server are different than the config options required for NFS client), which we don't
currently do and it doesn't make sense to just enable these options for a test.
2. Running a userspace NFS server: There are a few userspace NFS server projects but getting them to run
inside the UtilityVM wasn't very easy. We didn't want to spend a lot of time on this test.
3. Running NFS server on the windows host: Not all builds of windows support this so the test won't run in all
environments.

Signed-off-by: Amit Barve <ambarve@microsoft.com>
(cherry picked from commit e322ac5)
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
kiashok pushed a commit to kiashok/hcsshim that referenced this pull request Oct 3, 2023
LCOW kernel needs to be built with certain config options(`CONFIG_NFS_FS=y`, `CONFIG_NFS_V4=y` &
`CONFIG_NFS_V4_1=y`)_in order to be able to successfully run a NFS client and mount a NFS inside a
container. This test attempts to mount a (fake) NFS server to ensure that the kernel has the capabilities of
running a NFS client.

We don't mount a real NFS server because creating a real NFS server that will work in all kinds of test
environments is not simple. Instead, we look at the error returned by the NFS mount operation and decide if
the failure is because the server wasn't available (i.e a `Connection refused` error) or because the kernel
doesn't support NFS clients (`No Device` error).

Limitations on different approaches of starting a real NFS server:
1. Starting another LCOW container that runs a NFS server: By default on Linux the NFS server runs in the
kernel and to enable that the kernel must be built with `NFSD_*` config options (note that the config options
for running NFS server are different than the config options required for NFS client), which we don't
currently do and it doesn't make sense to just enable these options for a test.
2. Running a userspace NFS server: There are a few userspace NFS server projects but getting them to run
inside the UtilityVM wasn't very easy. We didn't want to spend a lot of time on this test.
3. Running NFS server on the windows host: Not all builds of windows support this so the test won't run in all
environments.

Signed-off-by: Amit Barve <ambarve@microsoft.com>
(cherry picked from commit e322ac5)
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
anmaxvl pushed a commit that referenced this pull request Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants