def get_cloud_params(self, keyname): """Searches through the locations.json file with key 'infrastructure_info' to build a dict containing the parameters necessary to interact with Amazon EC2. Args: keyname: The name of the SSH keypair that uniquely identifies this AppScale deployment. """ params = { self.PARAM_CREDENTIALS: {}, self.PARAM_GROUP: LocalState.get_group(keyname), self.PARAM_KEYNAME: keyname } zone = LocalState.get_zone(keyname) if zone: params[self.PARAM_REGION] = zone[:-1] else: params[self.PARAM_REGION] = self.DEFAULT_REGION for credential in self.REQUIRED_CREDENTIALS: cred = LocalState.get_infrastructure_option(tag=credential, keyname=keyname) if not cred: raise AgentConfigurationException("no " + credential) params[self.PARAM_CREDENTIALS][credential] = cred return params
def add_instances(cls, options): """Adds additional machines to an AppScale deployment. Args: options: A Namespace that has fields for each parameter that can be passed in via the command-line interface. """ if 'master' in options.ips.keys(): raise BadConfigurationException("Cannot add master nodes to an " + \ "already running AppScale deployment.") # In virtualized cluster deployments, we need to make sure that the user # has already set up SSH keys. if LocalState.get_infrastructure_option(keyname=options.keyname, tag='infrastructure') == "xen": ips_to_check = [] for ip_group in options.ips.values(): ips_to_check.extend(ip_group) for ip in ips_to_check: # throws a ShellException if the SSH key doesn't work RemoteHelper.ssh(ip, options.keyname, "ls") # Finally, find an AppController and send it a message to add # the given nodes with the new roles. AppScaleLogger.log("Sending request to add instances") load_balancer_ip = LocalState.get_host_with_role( options.keyname, 'load_balancer') acc = AppControllerClient(load_balancer_ip, LocalState.get_secret_key( options.keyname)) acc.start_roles_on_nodes(json.dumps(options.ips)) # TODO(cgb): Should we wait for the new instances to come up and get # initialized? AppScaleLogger.success("Successfully sent request to add instances " + \ "to this AppScale deployment.")
def get_cloud_params(self, keyname): """Searches through the locations.json file with key 'infrastructure_info' to build a dict containing the parameters necessary to interact with Amazon EC2. Args: keyname: The name of the SSH keypair that uniquely identifies this AppScale deployment. """ params = { self.PARAM_CREDENTIALS : {}, self.PARAM_GROUP : LocalState.get_group(keyname), self.PARAM_KEYNAME : keyname } zone = LocalState.get_zone(keyname) if zone: params[self.PARAM_REGION] = zone[:-1] else: params[self.PARAM_REGION] = self.DEFAULT_REGION for credential in self.REQUIRED_CREDENTIALS: cred = LocalState.get_infrastructure_option(tag=credential, keyname=keyname) if not cred: raise AgentConfigurationException("no " + credential) params[self.PARAM_CREDENTIALS][credential] = cred return params