mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
fix: glance converts all queued subimages, regardless of format (#22971)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -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, "")
|
||||
|
||||
Reference in New Issue
Block a user