mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: guest save image inherit projects of guest (#14041)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -1036,6 +1036,8 @@ func (self *SDisk) PrepareSaveImage(ctx context.Context, userCred mcclient.Token
|
||||
OsArch string
|
||||
Properties map[string]string
|
||||
|
||||
ProjectId string
|
||||
|
||||
EncryptKeyId string
|
||||
}{
|
||||
Name: input.Name,
|
||||
@@ -1048,6 +1050,9 @@ func (self *SDisk) PrepareSaveImage(ctx context.Context, userCred mcclient.Token
|
||||
"os_type": input.OsType,
|
||||
"os_arch": input.OsArch,
|
||||
},
|
||||
|
||||
// inherit the ownership of disk
|
||||
ProjectId: self.ProjectId,
|
||||
}
|
||||
|
||||
if self.IsEncrypted() {
|
||||
|
||||
@@ -235,6 +235,9 @@ func (self *SGuest) PerformSaveGuestImage(ctx context.Context, userCred mcclient
|
||||
kwargs := imageapi.GuestImageCreateInput{}
|
||||
kwargs.GuestImageCreateInputBase = input.GuestImageCreateInputBase
|
||||
kwargs.Properties = make(map[string]string)
|
||||
if len(kwargs.ProjectId) == 0 {
|
||||
kwargs.ProjectId = self.ProjectId
|
||||
}
|
||||
|
||||
for _, disk := range diskList {
|
||||
kwargs.Images = append(kwargs.Images, imageapi.GuestImageCreateInputSubimage{
|
||||
|
||||
Reference in New Issue
Block a user