From 52b4b1cd1a95e8ce2b7ae39dd92b2875826a1394 Mon Sep 17 00:00:00 2001 From: ronen Date: Sun, 31 Dec 2023 15:23:25 +0000 Subject: [PATCH] pkg/lb/lbgrpc/client.go: createsnapshtot err lightbits api will return Unavaialble err instead of failprecondition if we attempt to create a new snapshot whle previous create snapshot request was still running. this commit doesnt change the logic, but will ensure that we continue to get same logs regardless of the error. Signed-off-by: ronen --- pkg/lb/lbgrpc/client.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/lb/lbgrpc/client.go b/pkg/lb/lbgrpc/client.go index 13b90c7..6a2fa66 100644 --- a/pkg/lb/lbgrpc/client.go +++ b/pkg/lb/lbgrpc/client.go @@ -1263,7 +1263,7 @@ func (c *Client) CreateSnapshot( return nil, status.Errorf(codes.Internal, "failed to create snapshot '%s' on LB: %s", name, st.Message()) case codes.FailedPrecondition: - // most likely source volume is being updated, tell + // most likely old snapshot still creating (older Lightbits releases), tell // upper layers to retry the whole thing and // hope the logic above will weed out the bad states so // we don't end up in an infinite loop: @@ -1271,6 +1271,16 @@ func (c *Client) CreateSnapshot( "precondition: %s", st.Message()) return nil, status.Errorf(codes.Unavailable, "create snapshot (%s) transiently failed", name) + case codes.Unavailable: + // most likely old snapshot still creating (newer Lightbits releases), + // volume in updating state, tell + // upper layers to retry the whole thing and + // hope the logic above will weed out the bad states so + // we don't end up in an infinite loop: + c.log.Debugf("create snapshot refused by LB on failed "+ + "unavailable: %s", st.Message()) + return nil, status.Errorf(codes.Unavailable, + "create snapshot (%s) transiently failed", name) } return nil, err }