How to call scaleVirtualMachine api with details parameter #9961
Replies: 4 comments
-
Can you try ["memory": "3072", "cpunumber": "2"] or similar ? |
Beta Was this translation helpful? Give feedback.
-
Hello, @YashasAnand The details[0].key=value So, for example, a VM with 512 MB of RAM and 1 vCPU can be scaled to 1024 MB of RAM and 2 vCPUs by executing the following API call through CloudMonkey: scale virtualmachine id=<vm-id> serviceofferingid=<compute-offering-id> details[0].memory=1024 details[0].cpuNumber=2 How does your Python script sends the request? Does each key in the request = {
'command': 'scaleVirtualMachine',
'id': '<virtual-machine-id>',
'serviceofferingid': '<compute-offering-id>',
'response': 'json',
'details[0].memory': 1024 ,
'details[0].cpuNumber': 2
} |
Beta Was this translation helpful? Give feedback.
-
Hi @bernardodemarco @weizhouapache Thank you for your respective responses. Below is my python code.
I am getting response like this but i dont observe any scaling happening on the vm even though i have domain admin access. Pls can you suggest what might be the issue.
|
Beta Was this translation helpful? Give feedback.
-
APIs in CloudStack can be synchronous/blocking, or asynchronous/non-blocking. Async APIs return a Since the query asyncjobresult jobid="<job-id>" When retrieving the result of a job related to the (localcloud) 🐱 > query asyncjobresult jobid=75f6ebd3-e4ed-477c-b6ff-2577e2e56c30
{
(...)
"jobresult": {
"virtualmachine": {
"account": "admin",
"affinitygroup": [],
"cpunumber": 1,
"cpuspeed": 512,
"created": "2024-11-21T15:07:09+0000",
"deleteprotection": false,
"details": {
"Message.ReservedCapacityFreed.Flag": "true",
"cpuNumber": "1",
"cpuSpeed": "512",
"memory": "512"
},
(...)
}
},
"jobresultcode": 0,
"jobresulttype": "object",
"jobstatus": 1,
"userid": "203addbc-4b71-11ef-87b4-cec422422af1"
} Given that, could you check the return of the |
Beta Was this translation helpful? Give feedback.
-
I am trying to call scaleVirtualMachine API using python, but the documentation is very vague on how to use details parameter
https://cloudstack.apache.org/api/apidocs-4.19/apis/scaleVirtualMachine.html
I am trying to create request like this, is this wrong? can anyone pls suggest what is right way to call this api?
request = {
'command': 'scaleVirtualMachine',
'id': 'xys', # ID of the system VM
'serviceofferingid': 'xyz',
'response': 'json',
'details' : [
{"name": "memory", "value": "3072"},
{"name": "cpunumber", "value": "2"}
]
}
I get error
{
"scalevirtualmachineresponse": {
"uuidList": [],
"errorcode": 431,
"cserrorcode": 9999,
"errortext": "Unable to execute API command scalevirtualmachine due to invalid value [{"name": "memory", "value": "3072"}, {"name": "cpunumber", "value": "2"}] for parameter details"
}
}
Beta Was this translation helpful? Give feedback.
All reactions