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

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
Jian Qiu
2025-07-29 10:25:55 +08:00
committed by GitHub
co-authored by Qiu Jian
parent c00c81f23b
commit a5e4471e1f
+2 -3
View File
@@ -1085,8 +1085,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)
@@ -1148,9 +1150,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, "")