Skip to content

Commit

Permalink
chore(bors): merge pull request #907
Browse files Browse the repository at this point in the history
907: fix(csi/controller): don't return error on host mismatch r=tiagolobocastro a=tiagolobocastro



Co-authored-by: Tiago Castro <[email protected]>
  • Loading branch information
mayastor-bors and tiagolobocastro committed Dec 18, 2024
2 parents 4104acf + bc7fd69 commit 35aa836
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 @@ -655,18 +655,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 35aa836

Please sign in to comment.