BryanMLima commented on PR #7659:
URL: https://github.com/apache/cloudstack/pull/7659#issuecomment-1816895066

   > @BryanMLima any documentation available that provides some guidance on the 
usage of this feature? Any plans to implement a UI?
   
   @rajujith currently, the only documentation (more like a feature 
specification) is described in issue #7654; though, I pretend to add a proper 
documentation of this feature in the official documentation of CloudStack. 
Regarding the implementation of the UI for this feature, it is planned, 
however, it is not a priority at the moment.
   
   
   
   
   
   > @BryanMLima
   > 
   >     1. I could dedicate a secondary storage for KVM snapshots.
   > 
   >     2. I could dedicate a secondary storage for a domain.
   > 
   >     3. I was unable to dedicate another secondary storage for a second 
domain in the same zone. I believe this might be a limitation?
   > 
   >     4. I faced the below issues while registering template with the 
following rules:
   > 
   > 
   > ```
   > (SS-SelectorPR) 🐱 > create secondarystorageselector name=KVMtemplatesonly 
description=KVMtemplatesonly type=TEMPLATE 
zoneid=a2a9fafd-43fb-4508-915e-d3c836a7e972 heuristicrule="function 
directToDedicatedQCOW2Pool(pool) {return pool.uuid === 
'92dc82ff-c3cc-4756-928f-6802c358f599';} if (template.format === 'QCOW2') 
{secondaryStorages.filter(directToDedicatedQCOW2Pool)[0].uuid}"
   > 
   > {
   >   "heuristics": {
   >     "created": "2023-11-15T11:42:50+0000",
   >     "description": "KVMtemplatesonly",
   >     "heuristicrule": "function directToDedicatedQCOW2Pool(pool) {return 
pool.uuid === '92dc82ff-c3cc-4756-928f-6802c358f599';} if (template.format === 
'QCOW2') {secondaryStorages.filter(directToDedicatedQCOW2Pool)[0].uuid}",
   >     "id": "1d9070e9-5d12-4159-9e7c-de0793c87e24",
   >     "name": "KVMtemplatesonly",
   >     "type": "TEMPLATE",
   >     "zoneid": "a2a9fafd-43fb-4508-915e-d3c836a7e972"
   >   }
   > }
   > ```
   > 
   > On register template:
   > 
   > ```
   >  due to [javax.script.ScriptException: TypeError: Cannot read property 
"uuid" from undefined in <eval> at line number 1]
   >         at 
org.apache.cloudstack.utils.jsinterpreter.JsInterpreter.executeScriptInThread(JsInterpreter.java:121)
   > ```
   > 
   > Specific UUID:
   > 
   > `create secondarystorageselector name=KVMtemplatesonly-specifc 
description=KVMtemplatesonly-specific type=TEMPLATE 
zoneid=a2a9fafd-43fb-4508-915e-d3c836a7e972 heuristicrule="function 
findStorageWithSpecificUuid(pool) { return pool.uuid === 
'92dc82ff-c3cc-4756-928f-6802c358f599'; } 
secondaryStorages.filter(findStorageWithSpecificUuid)[0].uuid" ` On register 
template:
   > 
   > ```
   > java.util.concurrent.ExecutionException: javax.script.ScriptException: 
TypeError: Cannot read property "uuid" from undefined in <eval> at line number 1
   >         at 
java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
   > ```
   
   @rajujith thanks for testing this PR.
   
    Regarding item **3)**, could you provide more details of this testing? This 
feature only allows one heuristic rule per type, if you tried to dedicate a 
secondary storage to a domain for a specific type, you need to edit the same 
heuristic rule to dedicate to another domain. 
   Concisely, all heuristic rules for a given type should be in the same 
secondary storage selector, otherwise, an exception will be thrown and the 
message `There is already a heuristic rule in the specified Zone {...} with the 
type [...].` will be presented.
   
   In the future, this feature could allow multiple heuristic rules for the 
same type in a zone, allowing operators to specify the order in which each rule 
would be verified.
   
   Regarding item **4)**, the description of this PR and the issue presented 
the `uuid` for the `secondarystorage` variable in the JS script; however, it is 
the `id` that is provided in the script. I apologise for the confusion, I 
already fixed this in both the PR and the issue description's.
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to