blob: 97c5b7d8ed974a572d4e477e182715dc02724e73 [file] [log] [blame]
Daryl Walleck1465d612011-11-02 02:22:15 -05001from storm.services.nova.json.images_client import ImagesClient
2from storm.services.nova.json.flavors_client import FlavorsClient
3from storm.services.nova.json.servers_client import ServersClient
Rohit Karajgie1b050d2011-12-02 16:13:18 -08004from storm.common.utils import data_utils
Daryl Walleck1465d612011-11-02 02:22:15 -05005import storm.config
6
7
8class Manager(object):
9
10 def __init__(self):
11 """
12 Top level manager for all Openstack APIs
13 """
14
15 self.config = storm.config.StormConfig()
Rohit Karajgie1b050d2011-12-02 16:13:18 -080016 self.auth_url = data_utils.build_url(self.config.nova.host,
17 self.config.nova.port,
18 self.config.nova.apiVer,
19 self.config.nova.path)
20
Daryl Walleck1465d612011-11-02 02:22:15 -050021 if self.config.env.authentication == 'keystone_v2':
22 self.servers_client = ServersClient(self.config.nova.username,
23 self.config.nova.api_key,
Rohit Karajgie1b050d2011-12-02 16:13:18 -080024 self.auth_url,
Daryl Walleck1465d612011-11-02 02:22:15 -050025 self.config.nova.tenant_name)
26 self.flavors_client = FlavorsClient(self.config.nova.username,
27 self.config.nova.api_key,
Rohit Karajgie1b050d2011-12-02 16:13:18 -080028 self.auth_url,
Daryl Walleck1465d612011-11-02 02:22:15 -050029 self.config.nova.tenant_name)
30 self.images_client = ImagesClient(self.config.nova.username,
31 self.config.nova.api_key,
Rohit Karajgie1b050d2011-12-02 16:13:18 -080032 self.auth_url,
Daryl Walleck1465d612011-11-02 02:22:15 -050033 self.config.nova.tenant_name)
34 else:
35 #Assuming basic/native authentication
36 self.servers_client = ServersClient(self.config.nova.username,
37 self.config.nova.api_key,
Rohit Karajgie1b050d2011-12-02 16:13:18 -080038 self.auth_url)
Daryl Walleck1465d612011-11-02 02:22:15 -050039 self.flavors_client = FlavorsClient(self.config.nova.username,
40 self.config.nova.api_key,
Rohit Karajgie1b050d2011-12-02 16:13:18 -080041 self.auth_url)
Daryl Walleck1465d612011-11-02 02:22:15 -050042 self.images_client = ImagesClient(self.config.nova.username,
43 self.config.nova.api_key,
Rohit Karajgie1b050d2011-12-02 16:13:18 -080044 self.auth_url)