This repository has been archived by the owner on Feb 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflavors.py
53 lines (37 loc) · 1.54 KB
/
flavors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/python
usage = """Summary:
The following tutorial demonstrates how the native OpenStack APIs can be used to deploy a server, network, subnet and router
on the Fujitsu K5 IaaS Platform
Author: Joerg.schulz (AT )ts.fujitsu.com
calls K5 routines of Graham Land
Date: 24/03/17
Github: https://github.com/joergK5Schulz/OpenStack_Fujitsu_K5_Server_Build_API_Demo
this one: list flavors and manipulate flavor of a server.
"""
import config
import fjk5
import pprint
if config.testing :
import pdb
"""
lists all servers for contract defined in config.
To search for a server, you would impose a lambda on the servers[] array below.
"""
def listFlavors(token):
flavors = fjk5.list_flavors(token)
for flavor in flavors :
# print ('name: %s id %s ram: %s vcpus %s'% (flavor['name'], flavor['id'], flavor['ram'], flavor['vcpus']))
# as opposed to the doc, details are not specified here
flavorDetail = fjk5.getFlavorDetail(token, flavor['id'])['flavor']
print ('flavor: %s id %s ram: %s vcpus %s' % (flavor['name'], flavor['id'], flavorDetail['ram'], flavorDetail['vcpus']))# pprint.pprint(flavor)
if config.testing: pdb.set_trace()
def main():
print (usage)
k5token = fjk5.get_scoped_token()
listFlavors(k5token)
# resized = fjk5.resizeServer (k5token, fjk5.lookForServer (k5token, config.serverInfo['name'])[0]['id'], '1301')
if config.testing: pdb.set_trace()
print (resized)
# here we get the login token as key for all other info
if __name__ == "__main__":
main()