sureshanaparti commented on code in PR #10560: URL: https://github.com/apache/cloudstack/pull/10560#discussion_r1998288131
########## server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java: ########## @@ -3470,6 +3480,42 @@ protected ServiceOfferingVO createServiceOffering(final long userId, final boole } } + /** + * This method will return valid and non-empty expiryAction when + * "instance.lease.enabled" feature is enabled at global level + * leaseDuration is positive > -1 and has valid leaseExpiryAction provided or configured + * @param leaseDuration + * @param cmdExpiryAction + * @return leaseExpiryAction + */ + public static String validateAndGetLeaseExpiryAction(Long leaseDuration, String cmdExpiryAction) { + String leaseExpiryAction = null; + if (!VMLeaseManagerImpl.InstanceLeaseEnabled.value() + || (leaseDuration == null && StringUtils.isEmpty(cmdExpiryAction))) { // both are null + return leaseExpiryAction; + } + + // one of them is non-null + if (leaseDuration == null || StringUtils.isEmpty(cmdExpiryAction)) { + throw new InvalidParameterValueException("Provide values for both: leaseduration and leaseexpiryaction"); Review Comment: can enabled instance lease for an instance,? and will it pick values from configuration for both duration or action? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org