Skip to content

Commit

Permalink
fix(csi/controller): don't return error on host mismatch
Browse files Browse the repository at this point in the history
Signed-off-by: Tiago Castro <[email protected]>
  • Loading branch information
tiagolobocastro committed Dec 18, 2024
1 parent 0c08411 commit 9db4f1e
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions control-plane/csi-driver/src/bin/controller/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,18 +602,17 @@ impl rpc::csi::controller_server::Controller for CsiControllerSvc {
}

// Do forced volume unpublish as Kubernetes already detached the volume.
RestApiClient::get_client()
if let Err(error) = RestApiClient::get_client()
.unpublish_volume(&volume_uuid, true, Some(args.node_id.as_str()))
.await
.map_err(|e| match e {
ApiClientError::NotAcceptable(_) => {
Status::ok("Ignoring failure on unpublish due to mismatched host")
}
_ => Status::not_found(format!(
"Failed to unpublish volume {}, error = {:?}",
&args.volume_id, e
)),
})?;
{
if !matches!(error, ApiClientError::NotAcceptable(_)) {
return Err(Status::not_found(format!(
"Failed to unpublish volume {}, error = {error:?}",
&args.volume_id
)));
}
}

req.info_ok();
Ok(Response::new(ControllerUnpublishVolumeResponse {}))
Expand Down

0 comments on commit 9db4f1e

Please sign in to comment.