Maor Lipchuk has uploaded a new change for review. Change subject: core:Enable update for storage domain name(#851835) ......................................................................
core:Enable update for storage domain name(#851835) https://bugzilla.redhat.com/show_bug.cgi?id=851835 Update storage domain name fails since lastTimeUsedAsMaster property is sent from the client is not synchronized with the DB value. This is because this field is not reflected to the user and it is internally used in the engine. The proposed fix is to update the field with the old value from the DB before update the storage domain in the DB. Change-Id: I77de69fb8bd28a3c2c1ec1a9be576cb7b4e9dd69 Signed-off-by: Maor Lipchuk <mlipc...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/UpdateStorageDomainCommand.java 1 file changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/98/7598/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/UpdateStorageDomainCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/UpdateStorageDomainCommand.java index 7167934..dce7e17 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/UpdateStorageDomainCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/UpdateStorageDomainCommand.java @@ -2,6 +2,7 @@ import java.util.List; +import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.bll.Backend; import org.ovirt.engine.core.common.AuditLogType; import org.ovirt.engine.core.common.action.StorageDomainManagementParameter; @@ -32,11 +33,20 @@ storage_domain_static oldDomain = DbFacade.getInstance().getStorageDomainStaticDAO().get(getStorageDomain().getId()); + // Only after we know that this domain exists, we can set the last time used as master property + if (returnValue) { + getStorageDomain().setLastTimeUsedAsMaster(oldDomain.getLastTimeUsedAsMaster()); + } + + // Get change fields to update List<String> props = ObjectIdentityChecker.GetChangedFields(oldDomain, getStorageDomain() .getStorageStaticData()); - // allow change only to name field + + // Allow change only to name field props.remove("storage_name"); if (returnValue && props.size() > 0) { + log.errorFormat("There was an attempt to update the following fields although they are not allowed to be updated: {0}", + StringUtils.join(props, ",")); addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_CHANGE_STORAGE_DOMAIN_FIELDS); returnValue = false; } -- To view, visit http://gerrit.ovirt.org/7598 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I77de69fb8bd28a3c2c1ec1a9be576cb7b4e9dd69 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches