Gilad Chaplik has uploaded a new change for review. Change subject: core: empty quota causes FK violation ......................................................................
core: empty quota causes FK violation When creating a disk in Foreman, the disk object is sent via REST with empty string in id attribute: <quota id=""/> REST creates an empty UUID (000...) out of empty string, and causes FK violation, since there is no quota with that id. This patch fixes it by ignoring empty quota for adding disk. Change-Id: Ic488486edc7c5602d24e804c9a89aeccc98fc32b Bug-Url: https://bugzilla.redhat.com/1022942 Signed-off-by: Gilad Chaplik <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java 1 file changed, 5 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/02/20702/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java index cd4c413..5f896ab 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java @@ -46,8 +46,8 @@ import org.ovirt.engine.core.common.businessentities.permissions; import org.ovirt.engine.core.common.config.Config; import org.ovirt.engine.core.common.config.ConfigValues; -import org.ovirt.engine.core.common.locks.LockingGroup; import org.ovirt.engine.core.common.errors.VdcBllMessages; +import org.ovirt.engine.core.common.locks.LockingGroup; import org.ovirt.engine.core.common.utils.Pair; import org.ovirt.engine.core.common.utils.VmDeviceType; import org.ovirt.engine.core.common.validation.group.UpdateEntity; @@ -520,7 +520,10 @@ private Guid getQuotaId() { if (getParameters().getDiskInfo() != null && DiskStorageType.IMAGE == getParameters().getDiskInfo().getDiskStorageType()) { - return ((DiskImage) getParameters().getDiskInfo()).getQuotaId(); + Guid quotaId = ((DiskImage) getParameters().getDiskInfo()).getQuotaId(); + if (!Guid.Empty.equals(quotaId)) { + return quotaId; + } } return null; } -- To view, visit http://gerrit.ovirt.org/20702 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic488486edc7c5602d24e804c9a89aeccc98fc32b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.3.1 Gerrit-Owner: Gilad Chaplik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
