mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #12384 from zexi/glance-s3-image-removed
fix(glance): s3 uploaded image removed
This commit is contained in:
@@ -115,7 +115,7 @@ type SImage struct {
|
||||
// 镜像大小, 单位Byte
|
||||
Size int64 `nullable:"true" list:"user" create:"optional"`
|
||||
// 存储地址
|
||||
Location string `nullable:"true"`
|
||||
Location string `nullable:"true" list:"user"`
|
||||
|
||||
// 镜像格式
|
||||
DiskFormat string `width:"20" charset:"ascii" nullable:"true" list:"user" create:"optional" default:"raw"`
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db/taskman"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/notifyclient"
|
||||
"yunion.io/x/onecloud/pkg/image/models"
|
||||
"yunion.io/x/onecloud/pkg/image/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/notify"
|
||||
"yunion.io/x/onecloud/pkg/util/procutils"
|
||||
)
|
||||
@@ -89,8 +90,10 @@ func (self *PutImageTask) OnInit(ctx context.Context, obj db.IStandaloneModel, d
|
||||
if err != nil {
|
||||
log.Errorf("failed update image location %s", err)
|
||||
} else {
|
||||
if err = procutils.NewCommand("rm", "-f", imagePath).Run(); err != nil {
|
||||
log.Errorf("failed remove file %s: %s", imagePath, err)
|
||||
if !strings.Contains(imagePath, options.Options.S3MountPoint) {
|
||||
if err = procutils.NewCommand("rm", "-f", imagePath).Run(); err != nil {
|
||||
log.Errorf("failed remove file %s: %s", imagePath, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user