From 24912d5940ab06c9530253a9fb2309d5b30dcf04 Mon Sep 17 00:00:00 2001 From: Chin-Ya Huang Date: Fri, 4 Oct 2024 17:07:10 +0800 Subject: [PATCH] feat(v2/auto-salvage): retrieve headSvcLvol.UUID when not in cache longhorn/longhorn-8430 Signed-off-by: Chin-Ya Huang --- pkg/spdk/replica.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/spdk/replica.go b/pkg/spdk/replica.go index 973b20c9..059065f1 100644 --- a/pkg/spdk/replica.go +++ b/pkg/spdk/replica.go @@ -612,6 +612,11 @@ func (r *Replica) Create(spdkClient *spdkclient.Client, portCount int32, superio } headSvcLvol := r.ActiveChain[r.ChainLength-1] + if headSvcLvol.UUID == "" && r.State == types.InstanceStateStopped { + r.log.Debugf("Updating replica %s state from %v to %v because headSvcLvol.UUID is empty", r.Name, r.State, types.InstanceStatePending) + r.State = types.InstanceStatePending + } + // Create bdev lvol if the replica is the new one if r.State == types.InstanceStatePending { var lvsList []spdktypes.LvstoreInfo