Closed Melius-Group closed 8 years ago
Smart instances can only be cloned manually.
The web dashboard allows to upgrade smart instances too. eg: small to large So may be api can do this...
Hello, at the moment is not possible to upgrade a VM via API. I'm going to add the method.
Thank You. When expected?
I just added the method on the library with the relative example, try it.
The method can't work for me.
import argparse
from ArubaCloud.PyArubaAPI import CloudInterface
if name == 'main': parser = argparse.ArgumentParser() parser.add_argument('-d', '--datacenter', help='Specify datacenter to login.', action='store', dest='dc') parser.add_argument('-p', '--pattern', help='Specify pattern to search.', action='store', dest='pattern') parser.add_argument('-u', '--username', help='Specify username.', action='store', dest='username') parser.add_argument('-w', '--password', help='Specify password.', action='store', dest='password') parser.add_argument('-n', '--new_pkg', help='Specify password.', action='store', dest='newpkg') p = parser.parse_args()
i = CloudInterface(dc=p.dc)
i.login(username=p.username, password=p.password, load=True)
i.get_servers()
#vm = i.vmlist.find(name='Test')[0]
vm = i.get_vm(pattern=p.pattern)[0]
vm.upgrade_vm(package_id=p.newpkg)
And I initiate it with python /pyArubaCloud/examples/upgrade_smart.py -d 6 -u FHU-4_5 -w pa_**0-p -p Teszt -n 2
Nothing happen.
When I run this python /pyArubaCloud/examples/upgrade_smart.py -d 6 -u FHU-4_5 -w pa_**0-p -p Teszt -n 20
Nothing happen, but the init.py contains if package_id > 4 or package_id <= 0: return MalformedJsonRequest("Packages available are: 1, 2, 3, 4.")
Why I can't get any response?
In the first case, you should have upgraded the vm correctly, call the method in this way to see the response:
vm.upgrade_vm(package_id=p.newpkg, debug=True)
Let me know.
Nothing, no response, just some wait and shows prompt. If I mistype the function name, drop error, but if correct seems exit with ture. If I hardcode debug=True in init.py also nothing... no error, no json output, nothing...
I tried right now, and I'm able to upgrade the VM, have you turned off the vm before call the API method?
yes pf course,, but the fuction examine the state of vm and drop error msg if the state not equal 2.... I tryed and drop exception as required:
Traceback (most recent call last):
File "/pyArubaCloud/examples/upgrade_smart.py", line 21, in
But if status stopped, and run the script,... no response...
This syntax fails: vm.upgrade_vm(package_id=p.newpkg)
If I use vm.upgrade_vm(package_id=2) it was correct....
I add parser.add_argument('-g', '--newpkg', help='Specify new package id.', action='store', dest='newpkg')
and use -g 2 when i start script....
Oh, maybe because u were storing it as string and not as integer. I need to add documentation for methods.
vm.upgrade_vm(package_id=int(p.newpkg)) solv the problem :))) Sorry :) I'm waiting for upgrade methode for pro vm, and os change methodes :)) Thank You for lots of help
Perfect, I'm glad that it works. I have to ask you to open another Issue for upgrade_vm method on Pro Servers, so we can track it easily.
I'm going to close this ticket now.
Thank you!
Hi, please help me, how can I upgrade smart vm? I found just edit pro vm hardware.
Thank You! Regards: Gabor