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

fix(volume): don't allow unpublish from non-frontend node #889

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

dsharma-dc
Copy link
Contributor

In case application and volume target have already moved to a different node and there is a lagging ControllerUnpublish request that comes later, then this unpublish call can delete the newly created target, which is undesirable and leads to volume staging failures.

Signed-off-by: Diwakar Sharma <diwakar.sharma@datacore.com>
@@ -323,6 +323,8 @@ message UnpublishVolumeRequest {
// the nexus. Note: this option should be used only when we know the node will not become
// accessible again and it is safe to do so.
bool force = 2;
// frontend host requesting for volume unpublish.
optional string frontend_host = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

In-keeping with publish

Suggested change
optional string frontend_host = 3;
repeated string frontend_nodes = 3;

@@ -1618,6 +1618,8 @@ pub trait UnpublishVolumeInfo: Send + Sync + std::fmt::Debug {
fn uuid(&self) -> VolumeId;
/// Force unpublish
fn force(&self) -> bool;
/// Frontend node requesting unpublish.
fn frontend_host(&self) -> Option<NodeId>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fn frontend_host(&self) -> Option<NodeId>;
fn frontend_nodes(&self) -> Vec<NodeId>;

And the next token should be empty

Scenario: unpublish volume from non-frontend node
Copy link
Contributor

Choose a reason for hiding this comment

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

We should cover the returned errors when the nodes don't match

.map_err(|e| {
Status::not_found(format!(
.map_err(|e| match e {
ApiClientError::PreconditionFailed(_) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

this feels somewhat wrong, what if target was not deleted because of some other precondition error.
Maybe we need a different error here that is clearer? Something more similar to NOT_FOUND perhaps? Given that the target is not available for this node.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about NotAcceptable? I intended to do that earlier

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that seems good. wdyt @Abhinandan-Purkait ?

Copy link
Member

Choose a reason for hiding this comment

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

Yep. Although there is one more mapping of not acceptable but looking at other options this sounds reasonable.

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