Skip to content

Commit ce87ce4

Browse files
committed
Prevent copying disks to destination storage pool if there is not enough space available
1 parent 97ba5d3 commit ce87ce4

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtBaseConvertCommandWrapper.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ protected List<KVMPhysicalDisk> moveTemporaryDisksToDestination(List<KVMPhysical
157157
String destinationName = UUID.randomUUID().toString();
158158

159159
try {
160+
if (destinationPool.getAvailable() < sourceDisk.getSize()) {
161+
String msg = String.format("Not enough space on destination pool %s (%s bytes) to copy disk %s (size %s)",
162+
destinationPool.getUuid(), destinationPool.getAvailable(), sourceDisk.getName(), sourceDisk.getSize());
163+
logger.error(msg);
164+
throw new CloudRuntimeException(msg);
165+
}
166+
160167
KVMPhysicalDisk destinationDisk = storagePoolMgr.copyPhysicalDisk(sourceDisk, destinationName, destinationPool, 7200 * 1000);
161168
targetDisks.add(destinationDisk);
162169
} catch (Exception e) {

0 commit comments

Comments
 (0)