mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 06:10:22 +00:00
rbd: improve kmip verifyResponse() error message
This commit uses %q instead %v in error messages and adds result reason and message in kmip verifyresponse(). Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
parent
eaa0e14cb2
commit
f47839d73d
@ -474,24 +474,27 @@ func (kms *kmipKMS) verifyResponse(
|
|||||||
uniqueBatchItemID []byte,
|
uniqueBatchItemID []byte,
|
||||||
) (*kmip.ResponseBatchItem, error) {
|
) (*kmip.ResponseBatchItem, error) {
|
||||||
if respMsg.ResponseHeader.BatchCount != 1 {
|
if respMsg.ResponseHeader.BatchCount != 1 {
|
||||||
return nil, fmt.Errorf("batch count %v should be 1", respMsg.ResponseHeader.BatchCount)
|
return nil, fmt.Errorf("batch count %q should be \"1\"",
|
||||||
|
respMsg.ResponseHeader.BatchCount)
|
||||||
}
|
}
|
||||||
if len(respMsg.BatchItem) != 1 {
|
if len(respMsg.BatchItem) != 1 {
|
||||||
return nil, fmt.Errorf("batch Intems list len %v should be 1",
|
return nil, fmt.Errorf("batch Intems list len %q should be \"1\"",
|
||||||
len(respMsg.BatchItem))
|
len(respMsg.BatchItem))
|
||||||
}
|
}
|
||||||
batchItem := respMsg.BatchItem[0]
|
batchItem := respMsg.BatchItem[0]
|
||||||
if operation != batchItem.Operation {
|
if operation != batchItem.Operation {
|
||||||
return nil, fmt.Errorf("unexpected operation, real %v expected %v",
|
return nil, fmt.Errorf("unexpected operation, real %q expected %q",
|
||||||
batchItem.Operation, operation)
|
batchItem.Operation, operation)
|
||||||
}
|
}
|
||||||
if !bytes.Equal(uniqueBatchItemID, batchItem.UniqueBatchItemID) {
|
if !bytes.Equal(uniqueBatchItemID, batchItem.UniqueBatchItemID) {
|
||||||
return nil, fmt.Errorf("unexpected uniqueBatchItemID, real %v expected %v",
|
return nil, fmt.Errorf("unexpected uniqueBatchItemID, real %q expected %q",
|
||||||
batchItem.UniqueBatchItemID, uniqueBatchItemID)
|
batchItem.UniqueBatchItemID, uniqueBatchItemID)
|
||||||
}
|
}
|
||||||
if kmip14.ResultStatusSuccess != batchItem.ResultStatus {
|
if kmip14.ResultStatusSuccess != batchItem.ResultStatus {
|
||||||
return nil, fmt.Errorf("unexpected result status %v expected success %v",
|
return nil, fmt.Errorf("unexpected result status %q expected success %q,"+
|
||||||
batchItem.ResultStatus, kmip14.ResultStatusSuccess)
|
"result reason %q, result message %q",
|
||||||
|
batchItem.ResultStatus, kmip14.ResultStatusSuccess,
|
||||||
|
batchItem.ResultReason, batchItem.ResultMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &batchItem, nil
|
return &batchItem, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user