Skip to content

Commit

Permalink
core: skip disk profiles validation on memory disk
Browse files Browse the repository at this point in the history
When we create the memory or metadata disks they are a result of live
snapshot with memory or hibernation command. In some cases the user can
own the VM, including the option to execute the above command but he may
not have the disk profile permission to add those disks.

This patch will skip the permission validation in those cases, allowing
a user that owns the VM and capable of executing the command to not fail
on the underlying addDisk command.

Change-Id: Ib04048d652c8d98df84ffccc4babd71730b218dc
Bug-Url: https://bugzilla.redhat.com/1565183
Signed-off-by: Liran Rotenberg <lrotenbe@redhat.com>
  • Loading branch information
liranr23 committed Aug 17, 2022
1 parent 52f06b2 commit 16c2fba
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -846,10 +846,18 @@ private void plugDiskToVmIfNeeded() {
}

protected boolean setAndValidateDiskProfiles() {
if (shouldSkipDiskProfilesValidation()) {
return true;
}
return validate(diskProfileHelper.setAndValidateDiskProfiles(Collections.singletonMap(getDiskImageInfo(),
getStorageDomainId()), getCurrentUser()));
}

private boolean shouldSkipDiskProfilesValidation() {
return getDiskImageInfo().getContentType() == DiskContentType.MEMORY_DUMP_VOLUME
|| getDiskImageInfo().getContentType() == DiskContentType.MEMORY_METADATA_VOLUME;
}

@Override
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() {
List<QuotaConsumptionParameter> list = new ArrayList<>();
Expand Down

0 comments on commit 16c2fba

Please sign in to comment.