rajujith commented on code in PR #492: URL: https://github.com/apache/cloudstack-documentation/pull/492#discussion_r2039166083
########## source/adminguide/virtual_machines.rst: ########## @@ -960,6 +960,146 @@ restoreVirtualMachine call. In this case, the Instance's root disk is destroyed and recreated, but from the same Template or ISO that was already in use by the Instance. +Instance Lease +-------------- + +Cloudstack provides capability to create instance on lease. Lease denotes a set period for which resource is allocated and upon expiry cleanup is performed. +This feature enables automated cleanup of instances created for specific duration and for specific purpose. This feature gives administrators the ability to automatically reclaim +resources that are no longer needed by expired virtual machines, helping to optimize resource utilization and reduce wastage. + + +**Configuring lease feature** + +The cloud administrator can use global configuration variables to control the behavior of Instance Lease. +To set these variables, API or CloudStack UI can be used: + +======================================= ======================== +Configuration Description +======================================= ======================== +instance.lease.enabled Indicates whether to enable the Instance lease featuew, will be applicable only on instances created after lease is enabled. **Default: false** +instance.lease.scheduler.interval Background task interval in seconds that executes Lease expiry action on eligibile expired instances. Default: 3600. +instance.lease.alertscheduler.interval Background task interval in seconds that executes Lease alert for instances about to be expired in next N days. Default: 86400 +instance.lease.alert.daysbefore Denotes number of days (N) for alert task. Default: 7 days +======================================= ======================== + + +**Lease Parameters** + + +**leaseduration**: Lease duration is specified in days. This can take Natural numbers and -1 to disable the lease. + +Lease may require to be disabled in following scenarios: + +- During deployment of instance while using compute offering with lease metadata +- Edit instance with existing lease + +**leaseexpiryaction**: There are two expiry action supported: + +- STOP: The instance is stopped, and it will be out of lease. The user can restart the instance manually. +- DESTROY: The instance is destroyed when the lease expires. + +.. note:: Expiry action is executed at most once on the instance, e.g. STOP action will bring instance in Stoppped state on expiry and instance will be out of lease. User may choose to start it again. + + +**Using Instance Lease** + +Lease information is associated to an Instance and following parameters are used to enable lease for it: + +#. leaseduration +#. leaseexpiryaction + +Instance remains active for specified leaseduration (in days). Upon lease expiry, configured expiryaction is executed on the instance and +lease is removed from the instance for any further action. + +**Notes:** + +#. Lease Assignment: A lease can only be assigned to an instance during deployment. +#. Lease Acquisition: Instances without a lease cannot acquire one by switching to a different compute offering or by editing the instance. +#. Lease Inheritance: Instances inherit the lease from a compute offering that contains lease metadata. This lease can be overridden or disabled in the "Advanced Settings". Review Comment: Lease Inheritance: Instances inherit the lease from a compute offering with 'Instance Lease' feature enabled. This lease can be overridden or disabled in the “Advanced Settings”. -- 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: dev-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org