borisstoyanov commented on pull request #3991:
URL: https://github.com/apache/cloudstack/pull/3991#issuecomment-630053385


   LGTM, I've managed to confirm the fix. I've started 2 api calls to scale a 
vm almost at the same time and it scheduled them one after. The usage records 
did not ended up with the same timestamp
   ```
   cmk scale virtualmachine id=65d9020c-86ca-428c-95eb-c189f0df9425 
serviceofferingid=7af64616-bc5f-482f-8110-1bb951067399 & cmk scale 
virtualmachine id=65d9020c-86ca-428c-95eb-c189f0df9425 
serviceofferingid=d931b51c-b935-4c76-bfd4-8e799d20ce69
   ```
   and in Logs we observe they are being scheduled one after another
   
   ```
   [root@pr3991-t1534-vmware-67u3-mgmt1 ~]# cat 
/var/log/cloudstack/management/management-server.log | grep ScaleVmCommand
   2020-05-18 08:45:38,396 DEBUG [c.c.a.t.Request] 
(Work-Job-Executor-129:ctx-7ed738e5 job-342/job-344 ctx-97363648) 
(logid:c2b833de) Seq 1-4627448617123185215: Sending  { Cmd , MgmtId: 
32989006334137, via: 1(10.2.3.134), Ver: v1, Flags: 100111, 
[{"com.cloud.agent.api.ScaleVmCommand":{"vm":{"id":1,"name":"i-2-50-VM","cpus":1,"minSpeed":250,"maxSpeed":500,"minRam":536870912,"maxRam":536870912,"enableHA":false,"limitCpuUse":false,"enableDynamicallyScaleVm":false,"params":{"vmware.reserve.mem":"false","vmware.reserve.cpu":"false"},"guestOsDetails":{},"extraConfig":{}},"vmName":"i-2-50-VM","cpus":1,"minSpeed":250,"maxSpeed":500,"minRam":536870912,"maxRam":536870912,"wait":0}}]
 }
   2020-05-18 08:45:38,396 DEBUG [c.c.a.t.Request] 
(Work-Job-Executor-129:ctx-7ed738e5 job-342/job-344 ctx-97363648) 
(logid:c2b833de) Seq 1-4627448617123185215: Executing:  { Cmd , MgmtId: 
32989006334137, via: 1(10.2.3.134), Ver: v1, Flags: 100111, 
[{"com.cloud.agent.api.ScaleVmCommand":{"vm":{"id":1,"name":"i-2-50-VM","cpus":1,"minSpeed":250,"maxSpeed":500,"minRam":536870912,"maxRam":536870912,"enableHA":false,"limitCpuUse":false,"enableDynamicallyScaleVm":false,"params":{"vmware.reserve.mem":"false","vmware.reserve.cpu":"false"},"guestOsDetails":{},"extraConfig":{}},"vmName":"i-2-50-VM","cpus":1,"minSpeed":250,"maxSpeed":500,"minRam":536870912,"maxRam":536870912,"wait":0}}]
 }
   2020-05-18 08:45:38,421 DEBUG [c.c.h.v.m.HostMO] 
(DirectAgent-162:ctx-7db81840 10.2.3.134, job-342/job-344, cmd: ScaleVmCommand) 
(logid:c2b833de) find VM i-2-50-VM on host
   2020-05-18 08:45:38,421 INFO  [c.c.h.v.m.HostMO] 
(DirectAgent-162:ctx-7db81840 10.2.3.134, job-342/job-344, cmd: ScaleVmCommand) 
(logid:c2b833de) VM i-2-50-VM not found in host cache
   2020-05-18 08:45:38,422 DEBUG [c.c.h.v.m.HostMO] 
(DirectAgent-162:ctx-7db81840 10.2.3.134, job-342/job-344, cmd: ScaleVmCommand) 
(logid:c2b833de) load VM cache on host
   2020-05-18 08:45:42,392 DEBUG [c.c.a.t.Request] 
(Work-Job-Executor-130:ctx-db54c10b job-343/job-346 ctx-16ea5097) 
(logid:e8cd41a0) Seq 1-4627448617123185217: Sending  { Cmd , MgmtId: 
32989006334137, via: 1(10.2.3.134), Ver: v1, Flags: 100111, 
[{"com.cloud.agent.api.ScaleVmCommand":{"vm":{"id":1,"name":"i-2-50-VM","cpus":1,"minSpeed":500,"maxSpeed":1000,"minRam":1073741824,"maxRam":1073741824,"enableHA":false,"limitCpuUse":false,"enableDynamicallyScaleVm":false,"params":{"vmware.reserve.mem":"false","vmware.reserve.cpu":"false"},"guestOsDetails":{},"extraConfig":{}},"vmName":"i-2-50-VM","cpus":1,"minSpeed":500,"maxSpeed":1000,"minRam":1073741824,"maxRam":1073741824,"wait":0}}]
 }
   2020-05-18 08:45:42,392 DEBUG [c.c.a.t.Request] 
(Work-Job-Executor-130:ctx-db54c10b job-343/job-346 ctx-16ea5097) 
(logid:e8cd41a0) Seq 1-4627448617123185217: Executing:  { Cmd , MgmtId: 
32989006334137, via: 1(10.2.3.134), Ver: v1, Flags: 100111, 
[{"com.cloud.agent.api.ScaleVmCommand":{"vm":{"id":1,"name":"i-2-50-VM","cpus":1,"minSpeed":500,"maxSpeed":1000,"minRam":1073741824,"maxRam":1073741824,"enableHA":false,"limitCpuUse":false,"enableDynamicallyScaleVm":false,"params":{"vmware.reserve.mem":"false","vmware.reserve.cpu":"false"},"guestOsDetails":{},"extraConfig":{}},"vmName":"i-2-50-VM","cpus":1,"minSpeed":500,"maxSpeed":1000,"minRam":1073741824,"maxRam":1073741824,"wait":0}}]
 }
   2020-05-18 08:45:42,403 DEBUG [c.c.h.v.m.HostMO] 
(DirectAgent-327:ctx-92d817a6 10.2.3.134, job-343/job-346, cmd: ScaleVmCommand) 
(logid:e8cd41a0) find VM i-2-50-VM on host
   2020-05-18 08:45:42,403 INFO  [c.c.h.v.m.HostMO] 
(DirectAgent-327:ctx-92d817a6 10.2.3.134, job-343/job-346, cmd: ScaleVmCommand) 
(logid:e8cd41a0) VM i-2-50-VM not found in host cache
   2020-05-18 08:45:42,403 DEBUG [c.c.h.v.m.HostMO] 
(DirectAgent-327:ctx-92d817a6 10.2.3.134, job-343/job-346, cmd: ScaleVmCommand) 
(logid:e8cd41a0) load VM cache on host
   
   ```
   and in usage records we observe they ended up with different timestamps. 
   
   ```
   MariaDB [cloud]> select type,created,offering_id from usage_event where 
type='VM.DYNAMIC.SCALE';
   +------------------+---------------------+-------------+
   | type             | created             | offering_id |
   +------------------+---------------------+-------------+
   | VM.DYNAMIC.SCALE | 2020-05-18 08:45:39 |           1 |
   | VM.DYNAMIC.SCALE | 2020-05-18 08:45:43 |           2 |
   +------------------+---------------------+-------------+
   2 rows in set (0.01 sec)
   ```


----------------------------------------------------------------
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.

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


Reply via email to