use of org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator in project ovirt-engine by oVirt.
the class ImportRepoImageCommand method validateSpaceRequirements.
protected boolean validateSpaceRequirements(DiskImage diskImage) {
// Added for validation purposes.
diskImage.getSnapshots().add(diskImage);
StorageDomainValidator sdValidator = createStorageDomainValidator();
boolean result = validate(sdValidator.isDomainExistAndActive()) && validate(sdValidator.isDomainWithinThresholds()) && validate(sdValidator.hasSpaceForClonedDisk(diskImage));
diskImage.getSnapshots().remove(diskImage);
return result;
}
use of org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator in project ovirt-engine by oVirt.
the class StorageDomainSpaceRequirementsFilter method test.
@Override
public boolean test(StorageDomain storageDomain) {
memoryStorageHandler.updateDisksStorage(storageDomain, memoryDisks);
StorageDomainValidator storageDomainValidator = getStorageDomainValidator(storageDomain);
return storageDomainValidator.isDomainWithinThresholds().isValid() && storageDomainValidator.hasSpaceForClonedDisks(memoryDisks).isValid();
}
use of org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator in project ovirt-engine by oVirt.
the class HotPlugDiskToVmCommand method imageStorageValidation.
private boolean imageStorageValidation() {
// so we don't need to check the storage domain activity.
if (getDisk().getDiskStorageType() != DiskStorageType.IMAGE || !getVm().getStatus().isRunningOrPaused()) {
return true;
}
DiskImage diskImage = (DiskImage) getDisk();
StorageDomain storageDomain = storageDomainDao.getForStoragePool(diskImage.getStorageIds().get(0), diskImage.getStoragePoolId());
StorageDomainValidator storageDomainValidator = getStorageDomainValidator(storageDomain);
return validate(storageDomainValidator.isDomainExistAndActive()) && validate(storageDomainValidator.isNotBackupDomain());
}
use of org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator in project ovirt-engine by oVirt.
the class MoveOrCopyDiskCommand method validateDestStorage.
protected boolean validateDestStorage() {
StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain());
if (!validate(validator.isDomainExistAndActive()) || !validate(validator.domainIsValidDestination())) {
return false;
}
// Validate shareable disks moving/copying
boolean moveOrCopy = isMoveOperation() || isCopyOperation();
if (moveOrCopy && getImage().isShareable() && getStorageDomain().getStorageType() == StorageType.GLUSTERFS) {
return failValidation(EngineMessage.ACTION_TYPE_FAILED_CANT_MOVE_SHAREABLE_DISK_TO_GLUSTERFS, String.format("$%1$s %2$s", "diskAlias", getImage().getDiskAlias()));
}
if (isMoveOperation()) {
if (getImage().getStorageIds().contains(getStorageDomainId())) {
return failValidation(EngineMessage.ACTION_TYPE_FAILED_DESTINATION_STORAGE_DOMAIN_ALREADY_CONTAINS_THE_DISK);
}
}
return true;
}
use of org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator in project ovirt-engine by oVirt.
the class MoveOrCopyDiskCommand method validateSourceStorageDomain.
/**
* Validate a source storage domain of image, when a source storage domain is not provided
* any of the domains image will be used
*/
protected boolean validateSourceStorageDomain() {
Guid sourceDomainId = getParameters().getSourceDomainId();
if (sourceDomainId == null || Guid.Empty.equals(sourceDomainId)) {
sourceDomainId = getImage().getStorageIds().get(0);
getParameters().setSourceDomainId(sourceDomainId);
} else {
if (!getImage().getStorageIds().contains(sourceDomainId)) {
return failValidation(EngineMessage.ACTION_TYPE_FAILED_SOURCE_STORAGE_DOMAIN_DOES_CONTAINS_THE_DISK);
}
}
StorageDomainValidator validator = new StorageDomainValidator(storageDomainDao.getForStoragePool(sourceDomainId, getImage().getStoragePoolId()));
return validate(validator.isDomainExistAndActive());
}
Aggregations