oVirt / ovirt-engine

The oVirt Engine virtualization manager
Other
513 stars 268 forks source link

Setting UserSessionTimeOutInterval Fails - oVirt Node 4.5.4 #880

Closed IOMadness closed 1 year ago

IOMadness commented 1 year ago

Affected version oVirt Node 4.5.4

IMPORTANT!: oVirt prior to 4.5 reached end of life. If you have an issue on an older version please upgrade to latest stable release before opening an issue.

Describe the bug

When attempting to set the UserSessionTimeOutInterval on the hosted engine, it returns an error message and does not update the setting: [root@server ~]# engine-config -s UserSessionTimeOutInterval=120 Picked up JAVA_TOOL_OPTIONS: -Dcom.redhat.fips=false Cannot set value 120 to key UserSessionTimeOutInterval.

To reproduce

  1. SSH into the hosted engine as root
  2. Run the following (value to option is arbitrary that i've found): engine-config -s UserSessionTimeOutInterval=120
  3. Error is returned and setting is not updated

Expected behavior

I would expect to run the above command and have the UserSessionTimeOutInterval updated accordingly.

Screenshots

n/a

Additional context

n/a

JaroslavSpanko commented 1 year ago

From what i checked it seems that for some reason negative value -1 is causing this issue

 public void safeSetValue(String value) throws InvalidParameterException, Exception {
        ValidationResult validationResult = valueHelper.validate(this, value);
        if (!validationResult.isOk()) {
            StringBuilder invalidParamMsg = new StringBuilder();
            invalidParamMsg.append("Cannot set value ")
            .append(value)
            .append(" to key ")
            .append(keyName)
            .append(". ")
            .append(StringUtils.isNotEmpty(validationResult.getDetails()) ? validationResult.getDetails() : "");
            throw new InvalidParameterException(invalidParamMsg.toString());
        }
        this.value = valueHelper.setValue(value);
    }

If I edit the properties file bellow and remove -1 value

vim /etc/ovirt-engine/engine-config/engine-config.properties

UserSessionTimeOutInterval.type=Integer
UserSessionTimeOutInterval.validValues=1..100000

And then try to set value

engine-config --set UserSessionTimeOutInterval=180

Then it works

engine-config --set UserSessionTimeOutInterval=180
Picked up JAVA_TOOL_OPTIONS: -Dcom.redhat.fips=false
IOMadness commented 1 year ago

I've tested this and it appears to have done the trick! Thank you and I appreciate it!

sgratch commented 1 year ago

@IOMadness please just note that UserSessionTimeOutInterval=-1 indicates that user sessions for both Admin and VM portals never expire, so by removing it as a valid value, you'll lose that option.

IOMadness commented 1 year ago

@sgratch Thanks, we can work with that limitation for the time being. It looks like someone has actually corrected this issue in one of the nightly builds (https://lists.ovirt.org/archives/list/users@ovirt.org/thread/OPH7BHGBGWMECQKRXY6GW3YGZR73JK2D/), however, from a production point of view, we'd rather not have to rely on the nightly builds in order to get around this issue.

Hopefully someday another major version update will be released...