Conversation
fbdc437 to
13a8d51
Compare
| data = {} | ||
| data['name'] = name | ||
| data['cpu'] = size.cpu | ||
| data['cpu'] = size.cpu * 2000 |
There was a problem hiding this comment.
Would be good to add a comment on why we need to do * 2000 here.
| return node | ||
|
|
||
| def destroy_node(self, node): | ||
| def destroy_node(self, node, delete_drives=False): |
There was a problem hiding this comment.
Since it's not a standard argument, please prefix it with ex_.
| stopped = True | ||
|
|
||
| if not stopped: | ||
| raise CloudSigmaException( |
There was a problem hiding this comment.
I guess there is no way to retrieve a better error - aka why stopping node failes?
There was a problem hiding this comment.
I wasn't sure about this one, I used the return value only because the base NodeDriver returns a boolean so I handled the case of False.
Practically stopped was never False, CloudSigma returns 403 status code if the action cannot be done so an exception is raised or the action is completed and stopped is True.
Let me know if I should remove this completely
| image = '{} {}'.format(drive.extra.get('distribution', ''), | ||
| drive.extra.get('version', '')) | ||
| break | ||
| # try to find if node size is from example sizes given by CloudSigma |
There was a problem hiding this comment.
It seems somewhat inefficient to run this on every to _to_node() method call (even if that list_nodes() method doesn't result in a HTTP request and just filters a local list).
Is there any way we could handle this better / more efficiently?
Perhaps we could build a module level dictionary constant where the key would be a tuple of (cpus, memory, drive_size) and the value would be NodeSize. Then we can just do a simple dictionary lookup.
I think this should be fine since there isn't a lot of pre-defined sizes,
There was a problem hiding this comment.
I used a dictionary as you said, now we could remove completely INSTANCE_TYPES and use only the new dictionary's values to list sizes as they are basically the same. Let me know what you think.
|
Thanks for the contribution. I added some comments, nothing major. |
1ebba0a to
948c938
Compare
- add all supported regions - update example sizes - implement SSH key methods, reboot_node, ex_get_node, attach/detach disk - Use CPU cores to define CPU size instead of MHz and GBs to define drive size
948c938 to
120cdb1
Compare
Kami
left a comment
There was a problem hiding this comment.
Thanks for addressing all the comments. LGTM 👍
Updates on CloudSigma driver
Description
list_key_pairs,get_key_pair,create_key_pair,import_key_pair_from_string,delete_key_pair), add ssh keys param oncreate_nodeex_attach_drive,ex_detach_drive,ex_destroy_drive,reboot_node,ex_get_nodedestroy_nodeoptionalStatus
Checklist (tick everything that applies)