You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, ACS does not allow resources such as ISOs, Volumes, Snapshots, and Templates to be directed to a specific purpose secondary storage. Thus, operators are unable to determine to which secondary storage a given resource will be allocated. This specification aims to extend ACS for operators to be able to direct these resources to a specific secondary storage using a user-defined rule.
This specification proposes to change the way ACS defines which secondary storage will be used to store some resources. The intent is to make the Management Server select a secondary storage based on rules written in JavaScript (JS) that will only affect new resources, i.e. resources previously allocated on secondary storage will not be changed. The proposed changes are described in the following subsections.
2. New API proposal
Create a new API (createSecondaryStorageSelector) which will have as mandatory parameters: (zoneid: String, purpose: String, heuristic_rule: String), the created rule will determine, based on the return of the heuristic_rule, in which secondary storage a given resource will be allocated.
Regarding the API parameters:
zoneid: Required, since all configurations will only be in the zone scope;
purpose: Required, this parameter will determine the purpose for which the heuristic was created, the values accepted by this parameter will be: VOLUME, SNAPSHOT, ISO, TEMPLATE;
heuristic_rule: A script, written in JS, to determine the secondary storage where the resource will be allocated. This script will take the following attributes from the secondary storage as input: id, disksizeused, protocol. For Volumes, we will take the size and format attributes, for Snapshots we will take the hypervisor_type and size attributes and, for Templates we will take the format and hypervisor_type.
Furthermore, we propose three additional APIs, one to update a created heuristic (updateSecondaryStorageSelector), that will allow operators to edit the defined heuristic_rule; the second API (removeSecondaryStorageSelector) to disable a previous created heuristic, and the third to list heuristics created by operators which were defined in a zone (listSecondaryStorageSelectors). The image below presents an overview of the proposed changes.
To persist the information about the heuristic, a new table (heuristics) will be created in the cloud database. Which will have the following columns:
Field
Type
Required
Use
uuid
varchar(40)
Yes
A unique identifier of the heuristic.
name
text
Yes
A unique name for the heuristic.
description
text
No
Description of the heuristic.
zone_id
bigint(20)
Yes
Foreign key to the cloud.data_center table.
purpose
varchar(255)
Yes
Whether the heuristic referenced was created with the purpose to manage resources of type: VOLUME, TEMPLATE, ISO, or SNAPSHOT to be directed to a specific secondary storage.
heuristic_rule
text
Yes
Script implemented in JS that will determine to which secondary storage a given resource will be allocated.
created
datetime
Yes
Any date from the current date. If this parameter is not informed, the default value will be the current date.
removed
datetime
No
When the heuristic was removed.
2.1 createSecondaryStorageSelector API
The API createSecondaryStorageSelector will have three parameters: zoneid, purpose and heuristic_rule. The return of the script heuristic_rule will determine where the resource defined in the purpose parameter will be allocated for download or upload resources. The image below presents the flowchart for this API.
2.2 updateSecondaryStorageSelector API
The API updateSecondaryStorageSelector will have two parameters: uuid and heuristic_rule. This API will update the heuristic defined by the given uuid with the new attribute heuristic_rule. The image below presents the flowchart for this API.
2.3 removeSecondaryStorageSelector API
The API removeSecondaryStorageSelector will have 1 parameter: uuid. The image below presents the flowchart for this API.
2.4 listSecondaryStorageSelectors API
The API listSecondaryStorageSelectors will have 2 parameters: zone_uuid and purpose. The operator can give a valid purpose and a zone_uuid, so that the list of active heuristics will be filtered with the given purpose and zone. The image below presents the flowchart for this API.
2.5 Variables available for the heuristic rules
The table below presents the possible values for each resource when executing the JS rule. The variables of the secondary storage are available to all types of resources; whereas, the variables for snapshots, ISOs, templates and volumes are only available for each respective resource types, according to the purpose parameter of the API createSecondaryStorageSelector.
Resource
Variables
Secondary Storage
id
name
usedDiskSize
totalDiskSize
protocol
Snapshot
size
hypervisorType
name
ISO/Template
format
hypervisorType
templateType
name
Volume
size
format
Account
id
name
domain.id
domain.name
2.6 Examples
Allocate a resource type to a specific secondary storage.
ISSUE TYPE
COMPONENT NAME
CLOUDSTACK VERSION
SUMMARY
Currently, ACS does not allow resources such as ISOs, Volumes, Snapshots, and Templates to be directed to a specific purpose secondary storage. Thus, operators are unable to determine to which secondary storage a given resource will be allocated. This specification aims to extend ACS for operators to be able to direct these resources to a specific secondary storage using a user-defined rule.
Table of contents
createSecondaryStorageSelector
APIupdateSecondaryStorageSelector
APIremoveSecondaryStorageSelector
APIlistSecondaryStorageSelectors
APIThis specification proposes to change the way ACS defines which secondary storage will be used to store some resources. The intent is to make the Management Server select a secondary storage based on rules written in JavaScript (JS) that will only affect new resources, i.e. resources previously allocated on secondary storage will not be changed. The proposed changes are described in the following subsections.
Create a new API (
createSecondaryStorageSelector
) which will have as mandatory parameters: (zoneid: String
,purpose: String
,heuristic_rule: String
), the created rule will determine, based on the return of theheuristic_rule
, in which secondary storage a given resource will be allocated.Regarding the API parameters:
zoneid
: Required, since all configurations will only be in the zone scope;purpose
: Required, this parameter will determine the purpose for which the heuristic was created, the values accepted by this parameter will be:VOLUME
,SNAPSHOT
,ISO
,TEMPLATE
;heuristic_rule
: A script, written in JS, to determine the secondary storage where the resource will be allocated. This script will take the following attributes from the secondary storage as input:id
,disksizeused
,protocol
. For Volumes, we will take thesize
andformat
attributes, for Snapshots we will take thehypervisor_type
andsize
attributes and, for Templates we will take theformat
andhypervisor_type
.Furthermore, we propose three additional APIs, one to update a created heuristic (
updateSecondaryStorageSelector
), that will allow operators to edit the definedheuristic_rule
; the second API (removeSecondaryStorageSelector
) to disable a previous created heuristic, and the third to list heuristics created by operators which were defined in a zone (listSecondaryStorageSelectors
). The image below presents an overview of the proposed changes.To persist the information about the heuristic, a new table (
heuristics
) will be created in thecloud
database. Which will have the following columns:cloud.data_center
table.VOLUME
,TEMPLATE
,ISO
, orSNAPSHOT
to be directed to a specific secondary storage.createSecondaryStorageSelector
APIThe API
createSecondaryStorageSelector
will have three parameters:zoneid
,purpose
andheuristic_rule
. The return of the scriptheuristic_rule
will determine where the resource defined in thepurpose
parameter will be allocated for download or upload resources. The image below presents the flowchart for this API.updateSecondaryStorageSelector
APIThe API
updateSecondaryStorageSelector
will have two parameters:uuid
andheuristic_rule
. This API will update the heuristic defined by the givenuuid
with the new attributeheuristic_rule
. The image below presents the flowchart for this API.removeSecondaryStorageSelector
APIThe API
removeSecondaryStorageSelector
will have 1 parameter:uuid
. The image below presents the flowchart for this API.listSecondaryStorageSelectors
APIThe API
listSecondaryStorageSelectors
will have 2 parameters:zone_uuid
andpurpose
. The operator can give a valid purpose and azone_uuid
, so that the list of active heuristics will be filtered with the given purpose and zone. The image below presents the flowchart for this API.The table below presents the possible values for each resource when executing the JS rule. The variables of the secondary storage are available to all types of resources; whereas, the variables for snapshots, ISOs, templates and volumes are only available for each respective resource types, according to the
purpose
parameter of the APIcreateSecondaryStorageSelector
.The text was updated successfully, but these errors were encountered: