fix(region): check whether the disks of the instance snapshot is empty when creating vm

This commit is contained in:
rainzm
2021-05-17 17:26:36 +08:00
parent 28a99c1d53
commit e40c98d602
+5 -1
View File
@@ -1101,7 +1101,11 @@ func parseInstanceSnapshot(input *api.ServerCreateInput) (*api.ServerCreateInput
if isp.Status != api.INSTANCE_SNAPSHOT_READY {
return nil, httperrors.NewBadRequestError("Instance snapshot not ready")
}
return isp.ToInstanceCreateInput(input)
input, err = isp.ToInstanceCreateInput(input)
if len(input.Disks) == 0 {
return nil, httperrors.NewInputParameterError("there are no disks in this instance snapshot, try another one")
}
return input, nil
}
func (manager *SGuestManager) validateCreateData(