Server expiration
3 minute read
A server or resource is marked for expiration using the Expiration Date parameter.
Server expiration is a recurring job (Admin > Recurring Jobs > Expire Servers). By default, the job runs each day at midnight.
The job runs the Expire Servers action, which spawns a job and executes any enabled Expire actions.
How expiration works
To indicate that a server should expire on a particular date, it must have an Expiration Date value. This can be provided during provisioning, as described in Order Form Customization, or added to a server via the Parameters tab.
CMP administrators can check for expired servers manually or on a schedule.
Create expiration actions
Each expiration behavior is a CloudBolt plugin that you add as an orchestration action. Create the actions you need, then enable them in the sections that follow.
To create an expiration action:
- Go to Admin > Orchestration Actions.
- In the left panel, expand the Section and select the Subsection listed for the action in the table below.
- In the right panel, select the subsection’s add button, Add Post Sync VMs Action or Add Post-Expire Server Action, then select CloudBolt Plug-in > Add a new CloudBolt plug-in.
- In the form, set Name to the action name from the table.
- Under File location, select Fetch from URL, then copy the link to the plugin file from the table and paste it.
- Select Create.
(opens full-size image in a new tab)
| Section | Subsection | Action name | Plugin file |
|---|---|---|---|
| Synchronize VMs from Resource Handlers | Post Sync VMs | Set Server Expiration Date | set_server_expiration.py |
| Expire | Post-Expire Server | Power Off Expired Servers | power_off_expired_servers.py |
| Expire | Post-Expire Server | Power Off Then Delete Expired Servers | power_off_then_delete_expired_servers.py |
Set a server expiration date
Ensure you have created the Set Server Expiration Date action.
-
Go to Admin > Orchestration Actions.
-
In the left panel, expand Synchronize VMs from Resource Handlers and select Post Sync VMs.
-
In the right panel, set Set Server Expiration Date to Enabled.
-
Select the Edit icon.
-
Under Default value for Days Before Expire, provide a positive integer.
This is the number of days after today that servers are set to expire.
-
Select Save.
Power off expired servers
Ensure you have created the Power Off Expired Servers action.
- Go to Admin > Orchestration Actions.
- In the left panel, expand Expire and select Post-Expire Server.
- In the right panel, set Power Off Expired Servers to Enabled.
Delete expired servers
Ensure you have created the Power Off Then Delete Expired Servers action.
- Go to Admin > Orchestration Actions.
- In the left panel, expand Expire and select Post-Expire Server.
- In the right panel, set Power Off Then Delete Expired Servers to Enabled.
- Select the Edit icon.
- Set Default value for Cb Hostname to an appropriate value.
- Set Default value for Days Before Delete to a positive integer.
- Set Default value for Days Before Poweroff to a positive integer.
- Select Save.
Inform owners about expired servers
- Go to Admin > Orchestration Actions.
- In the left panel, expand Expire and select Pre-Expire Server.
- In the right panel, set Email Owners of Expired Servers to Enabled.
Check for expired servers
- Go to Admin > Recurring Jobs and search for Expire Servers.
- Set to Enabled to run automatically on schedule, or select Run to run the job immediately.
