-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Release reserved storage resources on VM deployment failure #13048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.22
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4301,22 +4301,20 @@ protected List<String> getResourceLimitStorageTags(long diskOfferingId) { | |
| return resourceLimitService.getResourceLimitStorageTags(diskOfferingVO); | ||
| } | ||
|
|
||
| private List<CheckedReservation> reserveStorageResourcesForVm(Account owner, Long diskOfferingId, Long diskSize, List<VmDiskInfo> dataDiskInfoList, Long rootDiskOfferingId, ServiceOfferingVO offering, Long rootDiskSize) throws ResourceAllocationException { | ||
| List <CheckedReservation> checkedReservations = new ArrayList<>(); | ||
|
|
||
| private void reserveStorageResourcesForVm(List<CheckedReservation> checkedReservations, Account owner, Long diskOfferingId, Long diskSize, List<VmDiskInfo> dataDiskInfoList, Long rootDiskOfferingId, ServiceOfferingVO offering, Long rootDiskSize) throws ResourceAllocationException { | ||
| List<String> rootResourceLimitStorageTags = getResourceLimitStorageTags(rootDiskOfferingId != null ? rootDiskOfferingId : offering.getDiskOfferingId()); | ||
| CheckedReservation rootVolumeReservation = new CheckedReservation(owner, ResourceType.volume, rootResourceLimitStorageTags, 1L, reservationDao, resourceLimitService); | ||
| checkedReservations.add(rootVolumeReservation); | ||
| CheckedReservation rootPrimaryStorageReservation = new CheckedReservation(owner, ResourceType.primary_storage, rootResourceLimitStorageTags, rootDiskSize, reservationDao, resourceLimitService); | ||
| checkedReservations.add(rootPrimaryStorageReservation); | ||
|
|
||
| if (diskOfferingId != null) { | ||
| List<String> additionalResourceLimitStorageTags = diskOfferingId != null ? getResourceLimitStorageTags(diskOfferingId) : null; | ||
| List<String> additionalResourceLimitStorageTags = getResourceLimitStorageTags(diskOfferingId); | ||
| DiskOfferingVO diskOffering = _diskOfferingDao.findById(diskOfferingId); | ||
| Long size = verifyAndGetDiskSize(diskOffering, diskSize); | ||
| CheckedReservation additionalVolumeReservation = diskOfferingId != null ? new CheckedReservation(owner, ResourceType.volume, additionalResourceLimitStorageTags, 1L, reservationDao, resourceLimitService) : null; | ||
| CheckedReservation additionalVolumeReservation = new CheckedReservation(owner, ResourceType.volume, additionalResourceLimitStorageTags, 1L, reservationDao, resourceLimitService); | ||
| checkedReservations.add(additionalVolumeReservation); | ||
| CheckedReservation additionalPrimaryStorageReservation = diskOfferingId != null ? new CheckedReservation(owner, ResourceType.primary_storage, additionalResourceLimitStorageTags, size, reservationDao, resourceLimitService) : null; | ||
| CheckedReservation additionalPrimaryStorageReservation = new CheckedReservation(owner, ResourceType.primary_storage, additionalResourceLimitStorageTags, size, reservationDao, resourceLimitService); | ||
| checkedReservations.add(additionalPrimaryStorageReservation); | ||
|
|
||
| } | ||
|
|
@@ -4332,7 +4330,6 @@ private List<CheckedReservation> reserveStorageResourcesForVm(Account owner, Lon | |
| checkedReservations.add(additionalPrimaryStorageReservation); | ||
| } | ||
| } | ||
| return checkedReservations; | ||
| } | ||
|
|
||
| private UserVm getUncheckedUserVmResource(DataCenter zone, String hostName, String displayName, Account owner, | ||
|
|
@@ -4347,7 +4344,7 @@ private UserVm getUncheckedUserVmResource(DataCenter zone, String hostName, Stri | |
| List<CheckedReservation> checkedReservations = new ArrayList<>(); | ||
|
|
||
| try { | ||
| checkedReservations = reserveStorageResourcesForVm(owner, diskOfferingId, diskSize, dataDiskInfoList, rootDiskOfferingId, offering, volumesSize); | ||
| reserveStorageResourcesForVm(checkedReservations, owner, diskOfferingId, diskSize, dataDiskInfoList, rootDiskOfferingId, offering, volumesSize); | ||
|
Comment on lines
4344
to
+4347
|
||
|
|
||
| // verify security group ids | ||
| if (securityGroupIdList != null) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The upgrade cleanup deletes all rows from
cloud.resource_reservation, even though the described bug affects stalevolume/primary_storagereservations. This broad delete could also wipe unrelated in-flight reservations (e.g., public IP/template/etc.) if an operator mistakenly runs the upgrade while other management servers are still operating. Consider restricting the DELETE to the affected resource types (and optionally to rows older than a conservative threshold) to reduce blast radius while still fixing the reported issue.