Skip to content

Commit 35aa836

Browse files
mayastor-borstiagolobocastro
andcommitted
chore(bors): merge pull request #907
907: fix(csi/controller): don't return error on host mismatch r=tiagolobocastro a=tiagolobocastro Co-authored-by: Tiago Castro <[email protected]>
2 parents 4104acf + bc7fd69 commit 35aa836

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

control-plane/csi-driver/src/bin/controller/controller.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -655,18 +655,17 @@ impl rpc::csi::controller_server::Controller for CsiControllerSvc {
655655
}
656656

657657
// Do forced volume unpublish as Kubernetes already detached the volume.
658-
RestApiClient::get_client()
658+
if let Err(error) = RestApiClient::get_client()
659659
.unpublish_volume(&volume_uuid, true, Some(args.node_id.as_str()))
660660
.await
661-
.map_err(|e| match e {
662-
ApiClientError::NotAcceptable(_) => {
663-
Status::ok("Ignoring failure on unpublish due to mismatched host")
664-
}
665-
_ => Status::not_found(format!(
666-
"Failed to unpublish volume {}, error = {:?}",
667-
&args.volume_id, e
668-
)),
669-
})?;
661+
{
662+
if !matches!(error, ApiClientError::NotAcceptable(_)) {
663+
return Err(Status::not_found(format!(
664+
"Failed to unpublish volume {}, error = {error:?}",
665+
&args.volume_id
666+
)));
667+
}
668+
}
670669

671670
req.info_ok();
672671
Ok(Response::new(ControllerUnpublishVolumeResponse {}))

0 commit comments

Comments
 (0)