Skip to content

Make sure the error message regarding stub drives is clear #244

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

Merged
merged 3 commits into from
Aug 9, 2019

Conversation

kzys
Copy link
Contributor

@kzys kzys commented Aug 7, 2019

Signed-off-by: Kazuyoshi Kato [email protected]

Issue #, if available:

Related, but doesn't fix #243

Description of changes:

While we don't support the use-case right now, the error message
regarding the lack of free stub drives should be clear for customers.

This change also cleans up drive_handler.go.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

While we don't support the use-case right now, the error message
regarding the lack of free stub drives should be clear for customers.

This change also cleans up drive_handler.go.

Signed-off-by: Kazuyoshi Kato <[email protected]>

// When we reuse a VM explicitly, we cannot start multiple containers unless we pre-allocate stub drives.
_, err = c2.NewTask(ctx, cio.NewCreator(cio.WithStreams(nil, &stdout, &stderr)))
assert.Equal("failed to patch stub drive: There are no remaining drives to be used: unknown", err.Error())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This unknown is a bit annoying. Should we return one of containerd's pre-defined errors such as ErrUnavailable?

https://github.com/containerd/containerd/blob/03d934adc4fb41763364b643e03399fdfcdcb20b/errdefs/errors.go#L48

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I think returning ErrUnavailable is a great idea


// When we reuse a VM explicitly, we cannot start multiple containers unless we pre-allocate stub drives.
_, err = c2.NewTask(ctx, cio.NewCreator(cio.WithStreams(nil, &stdout, &stderr)))
assert.Equal("failed to patch stub drive: There are no remaining drives to be used: unknown", err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I think returning ErrUnavailable is a great idea

kzys added 2 commits August 9, 2019 10:24
The number of stub drives cannot be changed once a microVM is
started. Modeling the limitation on the stub driver interface may
prevent programmer errors.

Signed-off-by: Kazuyoshi Kato <[email protected]>

// When we reuse a VM explicitly, we cannot start multiple containers unless we pre-allocate stub drives.
_, err = c2.NewTask(ctx, cio.NewCreator(cio.WithStreams(nil, &stdout, &stderr)))
assert.Equal("no remaining stub drives to be used: unavailable: unknown", err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

Did changing to use ErrUnavailable not result in this error message being changed? I wonder if ErrUnavailable is getting lost somewhere in the call chain (as it goes client->ctrd->shimstart->fc-control->shim and back).

The updates in this PR LGTM anyways, the error message is still more clear and the code is more clear now too. I don't personally mind if dealing with unknown is a separate, not high-priority issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no remaining stub drives to be used: unavailable: unknown

This part is coming from https://github.com/containerd/containerd/blob/ea13c9fe9941b0714630aa614ef5a0038c0083a3/errdefs/errors.go#L48, but maybe I should check the type rather than its string representation coming from Error() to make the intention more clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah okay, totally missed the "unavailable"! Makes sense

@kzys kzys merged commit 744552f into firecracker-microvm:master Aug 9, 2019
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.

Support using a stub drive of a deleted container
2 participants