|
@@ -74,9 +74,16 @@ func (l *DeleteServiceLogic) DeleteService(req *types.ServiceIdReq) (*types.Dele
|
|
|
|
|
|
|
|
// notifyFuseUnmount 删库前回调外挂程序(svc.Ip:svc.Port)的 GET /api/fuseUnMount 接口,
|
|
// notifyFuseUnmount 删库前回调外挂程序(svc.Ip:svc.Port)的 GET /api/fuseUnMount 接口,
|
|
|
// 逐目录卸载该服务全部 FUSE 挂载。
|
|
// 逐目录卸载该服务全部 FUSE 挂载。
|
|
|
|
|
+// 前置判断:只有挂载状态 mount_status=mounted 的服务才真正调外挂卸载接口;
|
|
|
|
|
+// unmounted/failed 视为无活动挂载,直接跳过不发请求——避免删除"本来就没挂载"
|
|
|
|
|
+// 的服务时还要去外挂机器白跑一趟、机器不可达时弹一堆无意义的卸载失败警告。
|
|
|
// 软处理:单个目录失败只记录并聚合,绝不阻塞删除流程(外挂机器可能已关机,
|
|
// 软处理:单个目录失败只记录并聚合,绝不阻塞删除流程(外挂机器可能已关机,
|
|
|
// 服务记录必须还能删)。返回空串 = 全部卸载成功或无需卸载。
|
|
// 服务记录必须还能删)。返回空串 = 全部卸载成功或无需卸载。
|
|
|
func (l *DeleteServiceLogic) notifyFuseUnmount(svc *model.TService) string {
|
|
func (l *DeleteServiceLogic) notifyFuseUnmount(svc *model.TService) string {
|
|
|
|
|
+ // MountStatus 是 sql.NullString 类型,.String 取其中的字符串值
|
|
|
|
|
+ if svc.MountStatus.String != "mounted" {
|
|
|
|
|
+ return "" // 未挂载/挂载失败,库里明确没有活动挂载,无需通知外挂
|
|
|
|
|
+ }
|
|
|
ip, port := svc.Ip.String, svc.Port // port 已是 int64
|
|
ip, port := svc.Ip.String, svc.Port // port 已是 int64
|
|
|
if ip == "" || port == 0 {
|
|
if ip == "" || port == 0 {
|
|
|
return "外挂服务 IP/端口为空,无法联动卸载,目录可能仍处于挂载状态"
|
|
return "外挂服务 IP/端口为空,无法联动卸载,目录可能仍处于挂载状态"
|