feat(client): exit when volume has been marked delete

Signed-off-by: lily-lee <lilylee88756@gmail.com>
This commit is contained in:
lily-lee 2023-12-22 10:08:49 +08:00 committed by leonrayang
parent 47a7953811
commit 74c7211a71
2 changed files with 16 additions and 0 deletions

View File

@ -657,8 +657,18 @@ func mount(opt *proto.MountOptions) (fsConn *fuse.Conn, super *cfs.Super, err er
volumeInfo, err = mc.AdminAPI().GetVolumeSimpleInfo(opt.Volname)
if err != nil {
log.LogErrorf("UpdateVolConf: get vol info from master failed, err %s", err.Error())
if err == proto.ErrVolNotExists {
daemonize.SignalOutcome(err)
os.Exit(1)
}
continue
}
if volumeInfo.Status == proto.VolStatusMarkDelete {
err = fmt.Errorf("vol [%s] has been deleted, stop client", volumeInfo.Name)
log.LogError(err)
daemonize.SignalOutcome(err)
os.Exit(1)
}
super.SetTransaction(volumeInfo.EnableTransaction, volumeInfo.TxTimeout, volumeInfo.TxConflictRetryNum, volumeInfo.TxConflictRetryInterval)
if proto.IsCold(opt.VolType) {
super.CacheAction = volumeInfo.CacheAction

View File

@ -21,3 +21,9 @@ const (
ReadWrite = 2
Unavailable = -1
)
// volume status
const (
VolStatusNormal uint8 = 0
VolStatusMarkDelete uint8 = 1
)