Skip to content

Commit 0c6bbb3

Browse files
shwstpprsureshanapartiDaanHoogland
authored andcommitted
notes on purging expunged resources (apache#397)
* notes on purging expunged resources Feature PR: apache/cloudstack#8999 Signed-off-by: Abhishek Kumar <[email protected]> * Apply suggestions from code review Co-authored-by: Suresh Kumar Anaparti <[email protected]> Co-authored-by: dahn <[email protected]> * Update source/adminguide/tuning.rst * changes from global config description Signed-off-by: Abhishek Kumar <[email protected]> --------- Signed-off-by: Abhishek Kumar <[email protected]> Co-authored-by: Suresh Kumar Anaparti <[email protected]> Co-authored-by: dahn <[email protected]>
1 parent 1ba3689 commit 0c6bbb3

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

source/adminguide/service_offerings.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,12 @@ To create a new compute offering:
319319
- **Storage Policy**: Name of the storage policy defined at vCenter, this is applicable only for VMware.
320320
When a specific Zone is selected, one of the storage policies can be selected from the list box.
321321

322+
- **Purge Resources**: Whether to cleanup instance and its associated resources from
323+
database upon expunge. When set to true, the database records for the instances with the offering and its
324+
associated resources such as volumes, NICs, etc will be purged immediately once the instance is
325+
expunged. The duration between enpunge and purging of the records can be controlled using
326+
the global configuration - _expunged.resource.purge.job.delay_.
327+
322328
- **Compute only Disk Offering**: When this flag is enabled, a compute only disk offering
323329
is created with the disk related information provided and then linked to the compute offering.
324330
Compute only disk offering is specific to the newly created compute offering to record the

source/adminguide/tuning.rst

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,76 @@ Article <http://support.citrix.com/article/CTX126531>`_.The article
143143
refers to XenServer 5.6, but the same information applies to XenServer 6
144144

145145

146+
Purging Expunged Resources
147+
--------------------------
148+
149+
.. note::
150+
Currently only available for Instances and their linked resources.
151+
152+
Over the time there are chances of piling up of millions of database records
153+
for the removed or expunged resources. The presence of a lot of useless
154+
records in the database can also affect the performance of the cloud so it is
155+
needed to purge such entries in a systematic way.
156+
CloudStack provides the following methods to allow purging of the expunged
157+
resources and their database records:
158+
159+
Using background task
160+
~~~~~~~~~~~~~~~~~~~~~
161+
162+
A background task will run at regular intervals. The interval for the task and
163+
other parameters for it such as resource types, start and end date and batch size
164+
can also be controlled with the help of global settings.
165+
166+
The following new global settings have been introduced which would allow
167+
configuring background task for purging the expunged resources:
168+
169+
.. cssclass:: table-striped table-bordered table-hover
170+
171+
================================================ ================ ===================================================================
172+
Global setting Default values Description
173+
================================================ ================ ===================================================================
174+
expunged.resources.purge.enabled false Whether to run a background task to purge the DB records of the expunged resources.
175+
expunged.resources.purge.resources (empty) A comma-separated list of resource types that will be considered by the background task to purge the DB records of the expunged resources. Currently only VirtualMachine is supported. An empty value will result in considering all resource types for purging.
176+
expunged.resources.purge.interval 86400 Interval (in seconds) for the background task to purge the DB records of the expunged resources.
177+
expunged.resources.purge.delay 300 Initial delay (in seconds) to start the background task to purge the DB records of the expunged resources task.
178+
expunged.resources.purge.batch.size 50 Batch size to be used during purging of the DB records of the expunged resources.
179+
expunged.resources.purge.start.time (empty) Start time to be used by the background task to purge the DB records of the expunged resources. Use format yyyy-MM-dd or yyyy-MM-dd HH:mm:ss.
180+
expunged.resources.purge.keep.past.days 30 The number of days in the past from the execution time of the background task to purge the DB records of the expunged resources for which the expunged resources must not be purged. To enable purging DB records of the expunged resource till the execution of the background task, set the value to zero.
181+
================================================ ================ ===================================================================
182+
183+
184+
Using API
185+
~~~~~~~~~
186+
187+
An admin-only API `purgeExpungedResources` allows purging the expunged resources
188+
with desired parameters. It will allow passing the following parameters -
189+
resourcetype, batchsize, startdate, enddate. An example of purgeExpungedResources
190+
API call is shown below:
191+
192+
193+
.. parsed-literal::
194+
195+
> purge expungedresources startdate=2024-04-15 enddate=2024-04-20 resourcetype=VirtualMachine
196+
{
197+
"purgeexpungedresourcesresponse": {
198+
"resourcecount": 6
199+
}
200+
}
201+
202+
203+
Using configuration in offerings
204+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
205+
..note::
206+
Available only for service offerings
207+
208+
_purgeresources_ configuration for offerings can be used to allow immediately
209+
purging a resource when it is expunged. The configuration can be set to true or
210+
false _purgeresources_ parameter while creating the corresponding offerings. The
211+
following global setting can be used to control the delay for purging the
212+
resource after expunge:
213+
214+
================================================ ================ ===================================================================
215+
Global setting Default values Description
216+
================================================ ================ ===================================================================
217+
expunged.resource.purge.job.delay 180 Delay (in seconds) to execute the purging of the DB records of an expunged resource initiated by the configuration in the offering. Minimum value should be 180 seconds and if a lower value is set then the minimum value will be used.
218+
================================================ ================ ===================================================================

0 commit comments

Comments
 (0)