Arubacloud / pyArubaCloud

Python Interface for ArubaCloud IaaS Service
Apache License 2.0
33 stars 26 forks source link

Upgrade_vm for PRO VM #27

Open Melius-Group opened 8 years ago

Melius-Group commented 8 years ago

Hi,

Please provide an upgrade methode to pro vm too.

Thank You

mikamakusa commented 8 years ago

for upgrading pro VM, you can do like this : connect = CloudInterface(dc=dc) connect.login(username, password, load=True) vm = connect().get_vm(pattern=servername)[0] vm.poweroff() to add a disk vm.add_virtual_disk(size=int(disksize)) to add ram vm.set_ram_qty(int(ramsize)) to set cpu vm.set_cpu_qty(int(cpusize)) time.sleep(60) connect().poweron_server(server_id=serverid)

Melius-Group commented 8 years ago

Thank You, but how can I MODIFY (extend) disk size without add a new disk?

mikamakusa commented 8 years ago

the edit_virtual_disk function has not been implemented yet (i've not seen it in the code). I think it's like the rDNS (the team in charge may be already on it)

Melius-Group commented 8 years ago

Is this method tested? Because the VM_Type init.py does not contain set_cpu_qty and set_ram_qty methode... only edit_cpu and edit_ram exists,..

mikamakusa commented 8 years ago

i've tested it myself and they seems to be ok

blackms commented 8 years ago

set_cpu_qty and set_ram_qty should be only vailable in the ProVmCreator object. How do you manage to call them from the VM object?

mikamakusa commented 8 years ago

In my own script...i've added these commands only when i have to change cpu and ram quantity on Pro VMs

Melius-Group commented 8 years ago

Maybe can you send me a working example file for upgrade pro vm?

mikamakusa commented 8 years ago

it's available here : https://github.com/mikamakusa/Providers4

blackms commented 8 years ago

@mikamakusa first of all let me say that i really like your job and the quality of the code. Said that, you are invoking those methods using ProVmCreator object not *VM one.

pvm = ProVmCreator(name=servername,
                                       admin_password=servpass,
                                       template_id=Images.getimageid(image),
                                       auth_obj=connect().auth)
                    pvm.set_cpu_qty(int(cpu))
                    pvm.set_ram_qty(int(ram))

But I like the idea of adding set_cpu, set_ram_qty and so on to ProVM object, and I think that I will go in that way.

Melius-Group commented 8 years ago

WOW... this is nice job, but I can't use this because of my python knowledge. Maybe with VM object.... or anything else, without significant modification on the original Aruba code? :)

mikamakusa commented 8 years ago

Hum...how can I say that... I'm not a real Python developper, i'm on this language less than a year and i've started this script in Powershell to, finally, convert it in Python (i was stuck on the Aruba Part). If what i've done so far on this script is useful for you, it's a pleasure for me to help you as best as i can.

Melius-Group commented 8 years ago

Thank You... I'm on python less then 5 hours :)))