mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #8002 from lvyangyang/openstack_vm_deleted_status
fix: disk delete error
This commit is contained in:
@@ -106,8 +106,10 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
DISK_TYPES = []string{DISK_TYPE_ROTATE, DISK_TYPE_SSD, DISK_TYPE_HYBRID}
|
||||
STORAGE_LOCAL_TYPES = []string{STORAGE_LOCAL, STORAGE_BAREMETAL, STORAGE_UCLOUD_LOCAL_NORMAL, STORAGE_UCLOUD_LOCAL_SSD, STORAGE_UCLOUD_EXCLUSIVE_LOCAL_DISK}
|
||||
DISK_TYPES = []string{DISK_TYPE_ROTATE, DISK_TYPE_SSD, DISK_TYPE_HYBRID}
|
||||
STORAGE_LOCAL_TYPES = []string{STORAGE_LOCAL, STORAGE_BAREMETAL, STORAGE_UCLOUD_LOCAL_NORMAL, STORAGE_UCLOUD_LOCAL_SSD, STORAGE_UCLOUD_EXCLUSIVE_LOCAL_DISK,
|
||||
STORAGE_EPHEMERAL_SSD, STORAGE_LOCAL_BASIC, STORAGE_LOCAL_SSD, STORAGE_LOCAL_PRO, STORAGE_OPENSTACK_NOVA,
|
||||
STORAGE_ZSTACK_LOCAL_STORAGE, STORAGE_GOOGLE_LOCAL_SSD}
|
||||
STORAGE_SUPPORT_TYPES = STORAGE_LOCAL_TYPES
|
||||
STORAGE_ALL_TYPES = []string{
|
||||
STORAGE_LOCAL, STORAGE_BAREMETAL, STORAGE_SHEEPDOG,
|
||||
|
||||
@@ -669,7 +669,9 @@ func (self *SManagedVirtualizedGuestDriver) RequestUndeployGuestOnHost(ctx conte
|
||||
}
|
||||
|
||||
for _, guestdisk := range guest.GetDisks() {
|
||||
if disk := guestdisk.GetDisk(); disk != nil && disk.AutoDelete {
|
||||
disk := guestdisk.GetDisk()
|
||||
storage := disk.GetStorage()
|
||||
if disk != nil && disk.AutoDelete && !utils.IsInStringArray(storage.StorageType, api.STORAGE_LOCAL_TYPES) {
|
||||
idisk, err := disk.GetIDisk()
|
||||
if err != nil {
|
||||
if errors.Cause(err) == cloudprovider.ErrNotFound {
|
||||
@@ -678,6 +680,9 @@ func (self *SManagedVirtualizedGuestDriver) RequestUndeployGuestOnHost(ctx conte
|
||||
log.Errorf("disk.GetIDisk fail %s", err)
|
||||
return nil, err
|
||||
}
|
||||
if idisk.GetStatus() == api.DISK_DEALLOC {
|
||||
continue
|
||||
}
|
||||
err = idisk.Delete(ctx)
|
||||
if err != nil {
|
||||
log.Errorf("idisk.Delete fail %s", err)
|
||||
|
||||
@@ -540,7 +540,11 @@ func (region *SRegion) DeployVM(instanceId string, name string, password string,
|
||||
}
|
||||
|
||||
func (instance *SInstance) DeleteVM(ctx context.Context) error {
|
||||
return instance.host.zone.region.DeleteVM(instance.Id)
|
||||
err := instance.host.zone.region.DeleteVM(instance.Id)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "instance.host.zone.region.DeleteVM(%s)", instance.Id)
|
||||
}
|
||||
return cloudprovider.WaitDeleted(instance, time.Second*5, time.Minute*10)
|
||||
}
|
||||
|
||||
func (region *SRegion) ReplaceSystemDisk(instanceId string, imageId string, passwd string, publicKey string, sysDiskSizeGB int) error {
|
||||
|
||||
Reference in New Issue
Block a user