Skip to content

Commit 21867bd

Browse files
swordqiuQiu Jian
andauthored
fix: glance converts all queued subimages, regardless of format (#22973)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
1 parent e213bdf commit 21867bd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pkg/image/models/images.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,8 +1102,10 @@ func (self *SImage) migrateSubImage(ctx context.Context) error {
11021102
}
11031103
if self.GetImageType() != api.ImageTypeISO && imgInst.IsSparse() && utils.IsInStringArray(self.DiskFormat, options.Options.TargetImageFormats) {
11041104
// need to convert again
1105+
log.Debugf("migrateImage: image is not iso but sparse, need to convert the image")
11051106
return self.newSubformat(ctx, qemuimgfmt.String2ImageFormat(self.DiskFormat), false)
11061107
} else {
1108+
log.Debugf("migrateImage: no need to convert the image")
11071109
localPath := self.GetLocalLocation()
11081110
if !strings.HasSuffix(localPath, fmt.Sprintf(".%s", self.DiskFormat)) {
11091111
newLocalpath := fmt.Sprintf("%s.%s", localPath, self.DiskFormat)
@@ -1165,9 +1167,6 @@ func (self *SImage) doConvertAllSubformats() error {
11651167
// cleanup
11661168
continue
11671169
}
1168-
if self.DiskFormat == subimgs[i].Format {
1169-
continue
1170-
}
11711170
err := subimgs[i].doConvert(self)
11721171
if err != nil {
11731172
return errors.Wrap(err, "")

0 commit comments

Comments
 (0)