|
|
@@ -466,11 +466,14 @@ func RestartTask(ctx *context.Context, task *models.Cloudbrain, newID *string) e |
|
|
|
log.Error("no such resourceSpecId(%d)", task.ResourceSpecId, ctx.Data["MsgID"]) |
|
|
|
return errors.New("no such resourceSpec") |
|
|
|
} |
|
|
|
|
|
|
|
datasetInfos, _, err := models.GetDatasetInfo(task.Uuid) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetDatasetInfo failed:%v", err, ctx.Data["MsgID"]) |
|
|
|
return err |
|
|
|
var datasetInfos map[string]models.DatasetInfo |
|
|
|
if task.Uuid != "" { |
|
|
|
var err error |
|
|
|
datasetInfos, _, err = models.GetDatasetInfo(task.Uuid) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetDatasetInfo failed:%v", err, ctx.Data["MsgID"]) |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
volumes := []models.Volume{ |
|
|
@@ -510,24 +513,25 @@ func RestartTask(ctx *context.Context, task *models.Cloudbrain, newID *string) e |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
if len(datasetInfos) == 1 { |
|
|
|
volumes = append(volumes, models.Volume{ |
|
|
|
HostPath: models.StHostPath{ |
|
|
|
Path: datasetInfos[task.Uuid].DataLocalPath, |
|
|
|
MountPath: DataSetMountPath, |
|
|
|
ReadOnly: true, |
|
|
|
}, |
|
|
|
}) |
|
|
|
} else { |
|
|
|
for _, dataset := range datasetInfos { |
|
|
|
if datasetInfos != nil { |
|
|
|
if len(datasetInfos) == 1 { |
|
|
|
volumes = append(volumes, models.Volume{ |
|
|
|
HostPath: models.StHostPath{ |
|
|
|
Path: dataset.DataLocalPath, |
|
|
|
MountPath: DataSetMountPath + "/" + dataset.Name, |
|
|
|
Path: datasetInfos[task.Uuid].DataLocalPath, |
|
|
|
MountPath: DataSetMountPath, |
|
|
|
ReadOnly: true, |
|
|
|
}, |
|
|
|
}) |
|
|
|
} else { |
|
|
|
for _, dataset := range datasetInfos { |
|
|
|
volumes = append(volumes, models.Volume{ |
|
|
|
HostPath: models.StHostPath{ |
|
|
|
Path: dataset.DataLocalPath, |
|
|
|
MountPath: DataSetMountPath + "/" + dataset.Name, |
|
|
|
ReadOnly: true, |
|
|
|
}, |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|