fix: glance converts all queued subimages, regardless of format (#22971)

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
Jian Qiu
2025-07-29 10:26:09 +08:00
committed by GitHub
parent 5a3bc2acb6
commit 4b0f3b4dd1

View File

@@ -1102,8 +1102,10 @@ func (self *SImage) migrateSubImage(ctx context.Context) error {
}
if self.GetImageType() != api.ImageTypeISO && imgInst.IsSparse() && utils.IsInStringArray(self.DiskFormat, options.Options.TargetImageFormats) {
// need to convert again
log.Debugf("migrateImage: image is not iso but sparse, need to convert the image")
return self.newSubformat(ctx, qemuimgfmt.String2ImageFormat(self.DiskFormat), false)
} else {
log.Debugf("migrateImage: no need to convert the image")
localPath := self.GetLocalLocation()
if !strings.HasSuffix(localPath, fmt.Sprintf(".%s", self.DiskFormat)) {
newLocalpath := fmt.Sprintf("%s.%s", localPath, self.DiskFormat)
@@ -1165,9 +1167,6 @@ func (self *SImage) doConvertAllSubformats() error {
// cleanup
continue
}
if self.DiskFormat == subimgs[i].Format {
continue
}
err := subimgs[i].doConvert(self)
if err != nil {
return errors.Wrap(err, "")