sureshanaparti commented on PR #11244:
URL: https://github.com/apache/cloudstack/pull/11244#issuecomment-3130830075

   Verified with autoscaling with config 'autoscale.errored.instance.threshold' 
set to 5 (and manually set instances to Error for scaling). Instance scaling 
stopped once Error-ed instances reached the threshold value.
   
   CMK:
   ```
   (localcloud) 🐱 > list configurations 
name=autoscale.errored.instance.threshold
   {
     "configuration": [
       {
         "category": "Advanced",
         "component": "AutoScaleManager",
         "defaultvalue": "10",
         "description": "The number of Error Instances allowed in autoscale vm 
groups for scale up.",
         "displaytext": "Autoscale errored instance threshold",
         "group": "Compute",
         "isdynamic": true,
         "name": "autoscale.errored.instance.threshold",
         "subgroup": "Virtual Machine",
         "type": "Number",
         "value": "5"
       }
     ],
     "count": 1
   }
   
   (localcloud) 🐱 > list autoscalepolicies 
   {
     "autoscalepolicy": [
       {
         "account": "admin",
         "action": "SCALEDOWN",
         "conditions": [
           {
             "account": "admin",
             "counter": {
               "id": "3a416e0e-6bc4-11f0-b052-1e0073000395",
               "name": "VM CPU - average percentage",
               "provider": "VirtualRouter",
               "source": "CPU",
               "value": "vm.cpu.average.percentage"
             },
             "counterid": "3a416e0e-6bc4-11f0-b052-1e0073000395",
             "countername": "VM CPU - average percentage",
             "domain": "ROOT",
             "domainid": "10d7a71c-6bc4-11f0-b052-1e0073000395",
             "domainpath": "/",
             "id": "8a19ad80-dfa4-4b81-bc87-dcf95de0a083",
             "relationaloperator": "LT",
             "threshold": 2
           }
         ],
         "domain": "ROOT",
         "domainid": "10d7a71c-6bc4-11f0-b052-1e0073000395",
         "domainpath": "/",
         "duration": 30,
         "id": "f11ba6e7-9019-4d05-8be4-94438177f8d7",
         "name": "ScaleDownPolicy-0",
         "quiettime": 10
       },
       {
         "account": "admin",
         "action": "SCALEUP",
         "conditions": [
           {
             "account": "admin",
             "counter": {
               "id": "3a423d34-6bc4-11f0-b052-1e0073000395",
               "name": "Load Balancer - average connections per vm",
               "provider": "VirtualRouter",
               "source": "VIRTUALROUTER",
               "value": "virtual.network.lb.average.connections"
             },
             "counterid": "3a423d34-6bc4-11f0-b052-1e0073000395",
             "countername": "Load Balancer - average connections per vm",
             "domain": "ROOT",
             "domainid": "10d7a71c-6bc4-11f0-b052-1e0073000395",
             "domainpath": "/",
             "id": "7cb7a18a-1e17-4d3f-8646-181c26b3dc5e",
             "relationaloperator": "GT",
             "threshold": 2
           },
           {
             "account": "admin",
             "counter": {
               "id": "3a416e0e-6bc4-11f0-b052-1e0073000395",
               "name": "VM CPU - average percentage",
               "provider": "VirtualRouter",
               "source": "CPU",
               "value": "vm.cpu.average.percentage"
             },
             "counterid": "3a416e0e-6bc4-11f0-b052-1e0073000395",
             "countername": "VM CPU - average percentage",
             "domain": "ROOT",
             "domainid": "10d7a71c-6bc4-11f0-b052-1e0073000395",
             "domainpath": "/",
             "id": "8f2c2551-ed2f-4047-bc7f-47601f259356",
             "relationaloperator": "GT",
             "threshold": 1
           }
         ],
         "domain": "ROOT",
         "domainid": "10d7a71c-6bc4-11f0-b052-1e0073000395",
         "domainpath": "/",
         "duration": 30,
         "id": "2c5d2f97-186e-4243-9a93-672f74412e83",
         "name": "ScaleUpPolicy-0",
         "quiettime": 10
       }
     ],
     "count": 2
   }
   (localcloud) 🐱 > list autoscalevmgroups 
   {
     "autoscalevmgroup": [
       {
         "account": "admin",
         "associatednetworkid": "6dac2b2f-77de-46bb-b170-16e44e567575",
         "associatednetworkname": "testvm01",
         "availablevirtualmachinecount": 1,
         "created": "2025-07-29T04:32:43+0000",
         "domain": "ROOT",
         "domainid": "10d7a71c-6bc4-11f0-b052-1e0073000395",
         "domainpath": "/",
         "fordisplay": true,
         "hasannotations": false,
         "id": "0750c8d2-7a85-4675-9d01-5c4deb5a31b1",
         "interval": 5,
         "lbprovider": "VirtualRouter",
         "lbruleid": "9b14260c-dfa8-43f5-84af-a629831158f7",
         "maxmembers": 10,
         "minmembers": 2,
         "name": "AutoScalingGroup01",
         "privateport": "80",
         "publicip": "10.0.55.10",
         "publicipid": "0a67c52b-e8bb-4954-b989-e389b8470b73",
         "publicport": "80",
         "scaledownpolicies": [
           {
             "account": "admin",
             "action": "SCALEDOWN",
             "conditions": [
               {
                 "account": "admin",
                 "counter": {
                   "id": "3a416e0e-6bc4-11f0-b052-1e0073000395",
                   "name": "VM CPU - average percentage",
                   "provider": "VirtualRouter",
                   "source": "CPU",
                   "value": "vm.cpu.average.percentage"
                 },
                 "counterid": "3a416e0e-6bc4-11f0-b052-1e0073000395",
                 "countername": "VM CPU - average percentage",
                 "domain": "ROOT",
                 "domainid": "10d7a71c-6bc4-11f0-b052-1e0073000395",
                 "domainpath": "/",
                 "id": "8a19ad80-dfa4-4b81-bc87-dcf95de0a083",
                 "relationaloperator": "LT",
                 "threshold": 2
               }
             ],
             "domain": "ROOT",
             "domainid": "10d7a71c-6bc4-11f0-b052-1e0073000395",
             "domainpath": "/",
             "duration": 30,
             "id": "f11ba6e7-9019-4d05-8be4-94438177f8d7",
             "name": "ScaleDownPolicy-0",
             "quiettime": 10
           }
         ],
         "scaleuppolicies": [
           {
             "account": "admin",
             "action": "SCALEUP",
             "conditions": [
               {
                 "account": "admin",
                 "counter": {
                   "id": "3a423d34-6bc4-11f0-b052-1e0073000395",
                   "name": "Load Balancer - average connections per vm",
                   "provider": "VirtualRouter",
                   "source": "VIRTUALROUTER",
                   "value": "virtual.network.lb.average.connections"
                 },
                 "counterid": "3a423d34-6bc4-11f0-b052-1e0073000395",
                 "countername": "Load Balancer - average connections per vm",
                 "domain": "ROOT",
                 "domainid": "10d7a71c-6bc4-11f0-b052-1e0073000395",
                 "domainpath": "/",
                 "id": "7cb7a18a-1e17-4d3f-8646-181c26b3dc5e",
                 "relationaloperator": "GT",
                 "threshold": 2
               },
               {
                 "account": "admin",
                 "counter": {
                   "id": "3a416e0e-6bc4-11f0-b052-1e0073000395",
                   "name": "VM CPU - average percentage",
                   "provider": "VirtualRouter",
                   "source": "CPU",
                   "value": "vm.cpu.average.percentage"
                 },
                 "counterid": "3a416e0e-6bc4-11f0-b052-1e0073000395",
                 "countername": "VM CPU - average percentage",
                 "domain": "ROOT",
                 "domainid": "10d7a71c-6bc4-11f0-b052-1e0073000395",
                 "domainpath": "/",
                 "id": "8f2c2551-ed2f-4047-bc7f-47601f259356",
                 "relationaloperator": "GT",
                 "threshold": 1
               }
             ],
             "domain": "ROOT",
             "domainid": "10d7a71c-6bc4-11f0-b052-1e0073000395",
             "domainpath": "/",
             "duration": 30,
             "id": "2c5d2f97-186e-4243-9a93-672f74412e83",
             "name": "ScaleUpPolicy-0",
             "quiettime": 10
           }
         ],
         "state": "ENABLED",
         "vmprofileid": "b43487ae-cf9c-404e-a58b-b99df6284256"
       }
     ],
     "count": 1
   }
   (localcloud) 🐱 > list autoscalevmprofiles 
   {
     "autoscalevmprofile": [
       {
         "account": "admin",
         "counterparam": {},
         "domain": "ROOT",
         "domainid": "10d7a71c-6bc4-11f0-b052-1e0073000395",
         "domainpath": "/",
         "expungevmgraceperiod": 10,
         "id": "b43487ae-cf9c-404e-a58b-b99df6284256",
         "otherdeployparams": {
           "networkids": "6dac2b2f-77de-46bb-b170-16e44e567575"
         },
         "serviceofferingid": "2fd594f2-6f8e-4ceb-83eb-a92488b65dd1",
         "templateid": "10defc12-6bc4-11f0-b052-1e0073000395",
         "userdata": 
"IyEvYmluL2Jhc2gKeXVtIGluc3RhbGwgLXkgaHR0cGQKc2VkIC1pIC1lIOKAmC9PcHRpb25zIEluZGV4ZXMgRm9sbG93U3ltTGlua3Mvcy8kLyBFeGVjQ0dJL+KAmSBcCiAgICAgICAgICAtZSDigJhzL0RpcmVjdG9yeUluZGV4IGluZGV4Lmh0bWwvRGlyZWN0b3J5SW5kZXggaW5kZXgucHkv4oCZIFwKICAgICAgICAgIC1lIOKAmHMvI0FkZEhhbmRsZXIgY2dpLXNjcmlwdCAuY2dpL0FkZEhhbmRsZXIgY2dpLXNjcmlwdCAucHkv4oCZIC9ldGMvaHR0cGQvY29uZi9odHRwZC5jb25mCmNhdCA8PCBFT0YgPiAvdmFyL3d3dy9odG1sL2luZGV4LnB5CiMhL3Vzci9iaW4vZW52IHB5dGhvbgppbXBvcnQgdGltZQppbXBvcnQgc29ja2V0CnRpbWUuc2xlZXAoNSkKcHJpbnQo4oCYQ29udGVudC10eXBlOiB0ZXh0L2h0bWxcblxu4oCZKQpwcmludCjigJg8cCBzdHlsZT3igJ10ZXh0LWFsaWduOiBjZW50ZXI74oCdPkhlbGxvIFdvcmxkISEhPC9wPuKAmSkKcHJpbnQo4oCYPHAgc3R5bGU94oCddGV4dC1hbGlnbjogY2VudGVyO+KAnT48c3Ryb25nPiBJbnN0YW5jZTogPC9zdHJvbmc+e308L3A+4oCZLmZvcm1hdChzb2NrZXQuZ2V0aG9zdG5hbWUoKSkpCkVPRgpjaG1vZCA3MDUgL3Zhci93d3cvaHRtbC9pbmRleC5weQpzeXN0ZW1jdGwgZW5hYmxlIGh0dHBkLnNlcnZpY2UKc3lzdGVtY3RsIHJlc3RhcnQgaHR0cGQuc2VydmljZQ==",
         "zoneid": "75958f7a-8791-40ec-9992-622f7a62f2a0"
       }
     ],
     "count": 1
   }
   ```
   
   DB:
   ```
   mysql> SELECT * FROM cloud.autoscale_vmgroups\G;
   *************************** 1. row ***************************
                 id: 1
               uuid: 0750c8d2-7a85-4675-9d01-5c4deb5a31b1
            zone_id: 1
          domain_id: 1
         account_id: 2
   load_balancer_id: 1
               name: AutoScalingGroup01
        min_members: 2
        max_members: 10
        member_port: 80
           interval: 5
         profile_id: 1
              state: ENABLED
            created: 2025-07-29 04:32:43
            removed: NULL
            display: 1
      last_interval: 2025-07-29 04:40:13
        next_vm_seq: 4
   1 row in set (0.00 sec)
   
   mysql> SELECT id, uuid, name, state FROM cloud.vm_instance WHERE type = 
'User' AND removed IS NULL;
   
+----+--------------------------------------+-----------------------------------------+---------+
   | id | uuid                                 | name                           
         | state   |
   
+----+--------------------------------------+-----------------------------------------+---------+
   |  5 | c7c8a7bc-2830-43b0-bb98-9b5d2645dc5f | 
autoScaleVm-AutoScalingGroup01-1-veufwt | Error   |
   |  6 | 7d69f64d-e28a-409f-8bc3-d159f9c7a733 | 
autoScaleVm-AutoScalingGroup01-2-jeptjg | Error   |
   |  7 | fc518dc9-2242-4ff5-896d-b39d49c5d2a2 | 
autoScaleVm-AutoScalingGroup01-3-gqhjel | Error   |
   |  8 | b3c8fa3e-6605-434b-8100-14e18da5454d | 
autoScaleVm-AutoScalingGroup01-4-tjauuh | Error   |
   |  9 | 024a10ac-811d-4cc7-b22a-75320bcf8bea | 
autoScaleVm-AutoScalingGroup01-5-qfqqrd | Error   |
   | 10 | 017def07-505c-49c9-a270-eed42bd1cc96 | 
autoScaleVm-AutoScalingGroup01-6-fnwfbc | Error   |
   | 11 | ebc6359b-7c84-4fa7-9e26-499d5b205968 | 
autoScaleVm-AutoScalingGroup01-7-pjzfpi | Running |
   
+----+--------------------------------------+-----------------------------------------+---------+
   7 rows in set (0.00 sec)
   
   mysql> SELECT * FROM cloud.autoscale_vmgroup_vm_map;
   +----+------------+-------------+
   | id | vmgroup_id | instance_id |
   +----+------------+-------------+
   |  1 |          1 |           5 |
   |  2 |          1 |           6 |
   |  3 |          1 |           7 |
   |  4 |          1 |           8 |
   |  5 |          1 |           9 |
   |  6 |          1 |          10 |
   |  7 |          1 |          11 |
   +----+------------+-------------+
   7 rows in set (0.00 sec)
   ```
   
   MS Logs:
   ```
   2025-07-29 04:50:08,060 DEBUG [c.c.n.a.AutoScaleManagerImpl] 
(VmGroup-Monitor-1-1:ctx-d3e64a24) (logid:50a61812) Start monitoring on 
AutoScale VmGroup 
AutoScaleVmGroupVO[id=1|name=AutoScalingGroup01|loadBalancerId=1|profileId=1]
   2025-07-29 04:50:08,065 DEBUG [c.c.n.a.AutoScaleManagerImpl] 
(VmGroup-Monitor-1-1:ctx-d3e64a24) (logid:50a61812) There are currently 1 
available VMs which is less than the minimum member of the AS group (2), 
scaling up 1 VMs
   2025-07-29 04:50:08,070 WARN  [c.c.n.a.AutoScaleManagerImpl] 
(VmGroup-Monitor-1-1:ctx-d3e64a24) (logid:50a61812) Number of Errored Instances 
are greater than the threshold in this group for scaling up, so do nothing more
   ...
   2025-07-29 04:50:13,074 DEBUG [c.c.n.a.AutoScaleManagerImpl] 
(VmGroup-Monitor-1-1:ctx-f296c98c) (logid:97a906d8) Start monitoring on 
AutoScale VmGroup 
AutoScaleVmGroupVO[id=1|name=AutoScalingGroup01|loadBalancerId=1|profileId=1]
   2025-07-29 04:50:13,079 DEBUG [c.c.n.a.AutoScaleManagerImpl] 
(VmGroup-Monitor-1-1:ctx-f296c98c) (logid:97a906d8) There are currently 1 
available VMs which is less than the minimum member of the AS group (2), 
scaling up 1 VMs
   2025-07-29 04:50:13,082 WARN  [c.c.n.a.AutoScaleManagerImpl] 
(VmGroup-Monitor-1-1:ctx-f296c98c) (logid:97a906d8) Number of Errored Instances 
are greater than the threshold in this group for scaling up, so do nothing more
   ...
   ```
   
   GUI/Screenshots:
   
   <img width="1193" height="402" alt="01-AutoscaleInstances" 
src="https://github.com/user-attachments/assets/ec12f4d5-dc2d-4e37-98f0-6978d18c7602";
 />
   
   <img width="1200" height="443" alt="02-AutoscaleInstances" 
src="https://github.com/user-attachments/assets/58c7162a-9218-4715-877e-cdd8a93df5ac";
 />
   
   <img width="1222" height="329" alt="03-AutoscaleInstances" 
src="https://github.com/user-attachments/assets/aa833281-db63-4b11-aa3a-0ccf75a6aa1a";
 />
   
   <img width="1222" height="361" alt="04-AutoscaleInstances" 
src="https://github.com/user-attachments/assets/df73ab84-100d-4736-afb7-fea6fe166379";
 />
   
   <img width="1205" height="395" alt="05-AutoscaleInstances" 
src="https://github.com/user-attachments/assets/61cc54cf-cf72-4aa3-a8e4-b04f60877710";
 />
   
   <img width="1215" height="445" alt="06-AutoscaleInstances" 
src="https://github.com/user-attachments/assets/0a9b4dda-c2ae-4c17-8078-55043f554244";
 />
   
   <img width="1215" height="448" alt="07-AutoscaleInstances" 
src="https://github.com/user-attachments/assets/76b248b3-8ccc-402f-8348-243550ee22f7";
 />
   


-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to