Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ public GetAllDisksByStorageDomainIdQuery(P parameters, EngineContext engineConte
@Override
protected void executeQueryCommand() {
StorageDomain storageDomain = storageDomainDao.get(getParameters().getId());
if (storageDomain.getStorageType().isCinderDomain()) {
// Cinder and Managed Block Storage domains store one volume per disk
// with no qcow2 snapshot chain to aggregate, so they take the simple
// listing path. SPM-managed domains need the snapshot-aggregation
// pass to fold the snapshot chain into per-disk rows.
if (storageDomain.getStorageType().isVendorManagedBlock()) {
List<DiskImage> diskImages = diskImageDao.getAllForStorageDomain(getParameters().getId());
getQueryReturnValue().setReturnValue(diskImages);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public ValidationResult domainIsValidDestination() {
}

public ValidationResult isDomainWithinThresholds() {
if (storageDomain.getStorageType().isCinderDomain()) {
if (storageDomain.getStorageType().isVendorManagedBlock()) {
return ValidationResult.VALID;
}
StorageDomainDynamic dynamicData = storageDomain.getStorageDynamicData();
Expand Down Expand Up @@ -207,7 +207,7 @@ private double getTotalSizeForMerge(Collection<SubchainInfo> subchains, ActionTy
* Validate space for new, empty disks. Used for a new Active Image.
*/
public ValidationResult hasSpaceForNewDisks(Collection<DiskImage> diskImages) {
if (storageDomain.getStorageType().isCinderDomain()) {
if (storageDomain.getStorageType().isVendorManagedBlock()) {
return ValidationResult.VALID;
}
Long availableSize = storageDomain.getAvailableDiskSizeInBytes();
Expand All @@ -220,7 +220,7 @@ public ValidationResult hasSpaceForNewDisks(Collection<DiskImage> diskImages) {
* Validate space for a cloned disk with the collapse option.
*/
public ValidationResult hasSpaceForClonedDisks(Collection<DiskImage> diskImages) {
if (storageDomain.getStorageType().isCinderDomain()) {
if (storageDomain.getStorageType().isVendorManagedBlock()) {
return ValidationResult.VALID;
}
Long availableSize = storageDomain.getAvailableDiskSizeInBytes();
Expand All @@ -230,7 +230,7 @@ public ValidationResult hasSpaceForClonedDisks(Collection<DiskImage> diskImages)
}

public ValidationResult hasSpaceForMerge(List<SubchainInfo> subchains, ActionType snapshotActionType) {
if (storageDomain.getStorageType().isCinderDomain() || storageDomain.getStorageType().isManagedBlockStorage()) {
if (storageDomain.getStorageType().isVendorManagedBlock()) {
return ValidationResult.VALID;
}
Long availableSize = storageDomain.getAvailableDiskSizeInBytes();
Expand All @@ -243,7 +243,7 @@ public ValidationResult hasSpaceForMerge(List<SubchainInfo> subchains, ActionTyp
* Validate space for cloned disks without the collapse option. Every snapshot will be cloned.
*/
public ValidationResult hasSpaceForDisksWithSnapshots(Collection<DiskImage> diskImages) {
if (storageDomain.getStorageType().isCinderDomain()) {
if (storageDomain.getStorageType().isVendorManagedBlock()) {
return ValidationResult.VALID;
}
Long availableSize = storageDomain.getAvailableDiskSizeInBytes();
Expand All @@ -259,7 +259,7 @@ public ValidationResult hasSpaceForDisksWithSnapshots(Collection<DiskImage> disk
* so there's no method for this.
*/
public ValidationResult hasSpaceForAllDisks(Collection<DiskImage> newDiskImages, Collection<DiskImage> clonedDiskImages) {
if (storageDomain.getStorageType().isCinderDomain()) {
if (storageDomain.getStorageType().isVendorManagedBlock()) {
return ValidationResult.VALID;
}
Long availableSize = storageDomain.getAvailableDiskSizeInBytes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,17 @@ public static Stream<Arguments> createParams() {
sd.setStorageType(storageType);
sd.setAvailableDiskSize(107); // GB

boolean shortCircuitForVendorManaged = storageType.isManagedBlockStorage();
boolean isValidForNew = shortCircuitForVendorManaged
|| volumeFormat == VolumeFormat.COW || volumeType == VolumeType.Sparse;
boolean isValidForCloned = shortCircuitForVendorManaged
|| volumeFormat == VolumeFormat.RAW && volumeType == VolumeType.Sparse;
boolean isValidForSnapshots = shortCircuitForVendorManaged
|| volumeFormat == VolumeFormat.RAW && volumeType == VolumeType.Sparse;
params.add(Arguments.of(disk, sd,
volumeFormat == VolumeFormat.RAW && volumeType == VolumeType.Sparse,
volumeFormat == VolumeFormat.COW || volumeType == VolumeType.Sparse,
volumeFormat == VolumeFormat.RAW && volumeType == VolumeType.Sparse
isValidForCloned,
isValidForNew,
isValidForSnapshots
));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,28 @@ public boolean isCinderDomain() {
public boolean isManagedBlockStorage() {
return this == MANAGED_BLOCK_STORAGE;
}

/**
* Returns true for any vendor-managed-block storage backend
* (Cinder, Managed Block Storage), where the volume lifecycle
* is owned by the storage backend rather than by the SPM. Both
* have one volume per disk with no qcow2 snapshot chain to
* aggregate, and both use vendor-side capacity accounting, which
* is why they take the same code path across the engine.
*
* Many places historically checked only {@code isCinderDomain()}
* and never got the parallel {@code isManagedBlockStorage()}
* added when MBS landed, causing MBS domains to fall through to
* SPM-style code paths that don't match their semantics. This
* helper names the combined case and replaces the partially-
* applied checks.
*
* When Cinder is fully removed (CentOS Stream 10 already dropped
* it) this helper collapses to {@code isManagedBlockStorage()}
* and the {@code isCinderDomain} machinery can be deleted as a
* single follow-up.
*/
public boolean isVendorManagedBlock() {
return isCinderDomain() || isManagedBlockStorage();
}
}