Created
September 18, 2013 17:02
-
-
Save ckrough/6612191 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RackspaceNodeDriver(OpenStack_1_1_NodeDriver): | |
name = 'Rackspace Cloud' | |
website = 'http://www.rackspace.com' | |
connectionCls = RackspaceConnection | |
type = Provider.RACKSPACE | |
api_name = None | |
def __init__(self, key, secret=None, secure=True, host=None, port=None, | |
region='dfw', **kwargs): | |
""" | |
@inherits: L{NodeDriver.__init__} | |
@param region: ID of the region which should be used. | |
@type region: C{str} | |
""" | |
valid_regions = ENDPOINT_ARGS_MAP.keys() | |
if region not in valid_regions: | |
raise ValueError('Invalid region: %s' % (region)) | |
if region == 'lon': | |
self.connectionCls.auth_url = AUTH_URL_UK | |
self.api_name = 'rackspacenovalon' | |
else: | |
self.connectionCls.auth_url = AUTH_URL_US | |
self.api_name = 'rackspacenovaus' | |
self.connectionCls._auth_version = '2.0' | |
self.connectionCls.get_endpoint_args = \ | |
ENDPOINT_ARGS_MAP[region] | |
self.region = region | |
super(RackspaceNodeDriver, self).__init__(key=key, secret=secret, | |
secure=secure, host=host, | |
port=port, **kwargs) | |
def _create_args_to_params(self, node, **kwargs): | |
server_params = super(RackspaceNodeDriver, self)._create_args_to_params(node, **kwargs) | |
server_params['OS-DCF:diskConfig'] = kwargs.get('OS-DCF:diskConfig', 'AUTO') | |
return server_params |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment