mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #18366 from swordqiu/automated-cherry-pick-of-#18365-upstream-release-3.11
Automated cherry pick of #18365: fix: auto convert missing subformat images
This commit is contained in:
@@ -1905,6 +1905,7 @@ func (img *SImage) doConvert(ctx context.Context, userCred mcclient.TokenCredent
|
||||
if len(subimgs) == 0 {
|
||||
needConvert = true
|
||||
} else {
|
||||
supportedFormats := make([]string, 0)
|
||||
for i := 0; i < len(subimgs); i += 1 {
|
||||
if !utils.IsInStringArray(subimgs[i].Format, options.Options.TargetImageFormats) && subimgs[i].Format != img.DiskFormat {
|
||||
// no need to have this subformat
|
||||
@@ -1918,6 +1919,10 @@ func (img *SImage) doConvert(ctx context.Context, userCred mcclient.TokenCredent
|
||||
if subimgs[i].Status != api.IMAGE_STATUS_ACTIVE {
|
||||
needConvert = true
|
||||
}
|
||||
supportedFormats = append(supportedFormats, subimgs[i].Format)
|
||||
}
|
||||
if len(supportedFormats) < len(options.Options.TargetImageFormats) {
|
||||
needConvert = true
|
||||
}
|
||||
}
|
||||
log.Debugf("doConvert imageStatus %s %v", img.Status, needConvert)
|
||||
|
||||
Reference in New Issue
Block a user