Skip to content

Instantly share code, notes, and snippets.

@ckrough
Created September 18, 2013 16:46
Show Gist options
  • Save ckrough/6611975 to your computer and use it in GitHub Desktop.
Save ckrough/6611975 to your computer and use it in GitHub Desktop.
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')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment