Skip to content

Commit

Permalink
core: Block MBS Image upload
Browse files Browse the repository at this point in the history
Transfering image into MBS will be block inside TransferDiskImageCommand validation

Signed-off-by: Artiom Divak <adivak@redhat.com>
  • Loading branch information
ArtiomDivak authored and bennyz committed Jul 13, 2022
1 parent aff9d17 commit 7519162
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.ovirt.engine.core.bll.utils.PermissionSubject;
import org.ovirt.engine.core.bll.validator.storage.DiskImagesValidator;
import org.ovirt.engine.core.bll.validator.storage.DiskValidator;
import org.ovirt.engine.core.bll.validator.storage.ManagedBlockStorageDomainValidator;
import org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator;
import org.ovirt.engine.core.common.AuditLogType;
import org.ovirt.engine.core.common.VdcObjectType;
Expand All @@ -47,6 +48,7 @@
import org.ovirt.engine.core.common.businessentities.VmBackupPhase;
import org.ovirt.engine.core.common.businessentities.storage.DiskBackupMode;
import org.ovirt.engine.core.common.businessentities.storage.DiskImage;
import org.ovirt.engine.core.common.businessentities.storage.DiskStorageType;
import org.ovirt.engine.core.common.businessentities.storage.ImageStatus;
import org.ovirt.engine.core.common.businessentities.storage.ImageTicket;
import org.ovirt.engine.core.common.businessentities.storage.ImageTicketInformation;
Expand Down Expand Up @@ -162,6 +164,11 @@ protected void setActionMessageParameters() {
}

protected boolean validateCreateImage() {
StorageDomain storageDomain = storageDomainDao.get(getParameters().getStorageDomainId());
if (!isSupportedByManagedBlockStorageDomain(storageDomain)) {
return false;
}

ActionReturnValue returnValue = CommandHelper.validate(ActionType.AddDisk, getAddDiskParameters(),
getContext().clone());
getReturnValue().setValidationMessages(returnValue.getValidationMessages());
Expand Down Expand Up @@ -193,6 +200,11 @@ protected boolean validateImageTransfer() {
validate(diskValidator.isDiskExists())
&& validate(diskImagesValidator.diskImagesNotIllegal())
&& validate(storageDomainValidator.isDomainExistAndActive());

if (diskImage.getDiskStorageType() == DiskStorageType.MANAGED_BLOCK_STORAGE) {
return validate(ManagedBlockStorageDomainValidator.isOperationSupportedByManagedBlockStorage(getActionType()));
}

if (isBackup()) {
if (isHybridBackup()) {
if (!snapshotDao.exists(getBackup().getVmId(), getBackup().getSnapshotId())) {
Expand Down

0 comments on commit 7519162

Please sign in to comment.