mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: add details for account delete (#7702)
Co-authored-by: Qu Xuan <quxuan@yunionyun.com>
This commit is contained in:
@@ -1082,15 +1082,15 @@ func (self *SDisk) validateDeleteCondition(ctx context.Context, isPurge bool) er
|
||||
}
|
||||
host := storage.GetMasterHost()
|
||||
if host == nil {
|
||||
return httperrors.NewBadRequestError("storage of disk no valid host")
|
||||
return httperrors.NewBadRequestError("storage of disk %s no valid host", self.Id)
|
||||
}
|
||||
}
|
||||
cnt, err := self.GetGuestDiskCount()
|
||||
if err != nil {
|
||||
return httperrors.NewInternalServerError("GetGuestDiskCount fail %s", err)
|
||||
return httperrors.NewInternalServerError("GetGuestDiskCount for disk %s fail %s", self.Id, err)
|
||||
}
|
||||
if cnt > 0 {
|
||||
return httperrors.NewNotEmptyError("Virtual disk used by virtual servers")
|
||||
return httperrors.NewNotEmptyError("Virtual disk %s(%s) used by virtual servers", self.Name, self.Id)
|
||||
}
|
||||
if !isPurge && self.IsValidPrePaid() {
|
||||
return httperrors.NewForbiddenError("not allow to delete prepaid disk in valid status")
|
||||
|
||||
@@ -3636,7 +3636,7 @@ func (self *SGuest) DeleteAllDisksInDB(ctx context.Context, userCred mcclient.To
|
||||
disk := guestdisk.GetDisk()
|
||||
err := guestdisk.Detach(ctx, userCred)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrapf(err, "guestdisk.Detach guest_id: %s disk_id: %s", guestdisk.GuestId, guestdisk.DiskId)
|
||||
}
|
||||
|
||||
if disk != nil {
|
||||
|
||||
@@ -674,7 +674,7 @@ func (self *SHost) RealDelete(ctx context.Context, userCred mcclient.TokenCreden
|
||||
if storage != nil && storage.IsLocal() {
|
||||
cnt, err := storage.GetDiskCount()
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrapf(err, "GetDiskCount")
|
||||
}
|
||||
if cnt > 0 {
|
||||
return httperrors.NewNotEmptyError("Inconsistent: local storage is not empty???")
|
||||
|
||||
@@ -82,14 +82,14 @@ func (host *SHost) purge(ctx context.Context, userCred mcclient.TokenCredential)
|
||||
|
||||
_, err := host.PerformDisable(ctx, userCred, nil, apis.PerformDisableInput{})
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrapf(err, "PerformDisable")
|
||||
}
|
||||
|
||||
guests := host.GetGuests()
|
||||
for i := range guests {
|
||||
err := guests[i].purge(ctx, userCred)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrapf(err, "purge guest %s", guests[i].Id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ func (host *SHost) purge(ctx context.Context, userCred mcclient.TokenCredential)
|
||||
for i := range storages {
|
||||
err := storages[i].purgeDisks(ctx, userCred)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrapf(err, "purgeDisks for storage %s", storages[i].Name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ func (storage *SStorage) purgeDisks(ctx context.Context, userCred mcclient.Token
|
||||
for i := range disks {
|
||||
err := disks[i].purge(ctx, userCred)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrapf(err, "purge disk %s", disks[i].Id)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user