fix install volume bugs

This commit is contained in:
凡羊羊 2020-03-10 02:02:03 +08:00
parent 998b61d949
commit 29a7d3e36a

View File

@ -554,11 +554,18 @@ func (s *ServiceAction) ServiceCreate(sc *api_model.ServiceStruct) error {
v.HostPath = fmt.Sprintf("%s/tenant/%s/service/%s%s", sharePath, sc.TenantID, ts.ServiceID, volumn.VolumePath)
//本地文件存储
case dbmodel.LocalVolumeType.String():
if sc.ExtendMethod != "state" {
if !dbmodel.ServiceType(sc.ExtendMethod).IsState() {
tx.Rollback()
return util.CreateAPIHandleError(400, fmt.Errorf("应用类型不为有状态应用.不支持本地存储"))
return util.CreateAPIHandleError(400, fmt.Errorf("应用类型为无状态组件.不支持本地存储"))
}
v.HostPath = fmt.Sprintf("%s/tenant/%s/service/%s%s", localPath, sc.TenantID, ts.ServiceID, volumn.VolumePath)
case dbmodel.ConfigFileVolumeType.String(), dbmodel.MemoryFSVolumeType.String():
logrus.Debug("simple volume type : ", volumn.VolumeType)
default:
if !dbmodel.ServiceType(sc.ExtendMethod).IsState() {
tx.Rollback()
return util.CreateAPIHandleError(400, fmt.Errorf("应用类型为无状态组件.不支持自定义存储"))
}
}
}
if volumn.VolumeName == "" {