Пример #1
0
    def deregister_flex_cloud(self, parameters, blocking=True):
        try:
            i = InfrastructureManager(blocking=blocking)
            res = i.deregister_instances(parameters=parameters, terminate=False)
            ret = True

        except Exception, e:
            logging.error("deregister_flex_cloud() failed with error : %s", str(e))
            ret = False
Пример #2
0
    def stop_ec2_vms(self, params, blocking=False):
        '''
        This method would terminate all the EC2 instances associated with the account
	    that have a keyname prefixed with stochss (all instances created by the backend service)
	    params must contain credentials key/value
        '''
        key_prefix = AgentConfig.get_agent_key_prefix(agent_type=AgentTypes.EC2,
                                                      key_prefix=params.get('key_prefix', ''))
        try:
            logging.debug("Stopping compute nodes with key_prefix: {0}".format(key_prefix))
            i = InfrastructureManager(blocking=blocking)
            res = i.deregister_instances(parameters=params, terminate=True)
            ret = True

        except Exception, e:
            logging.error("Terminate machine failed with error : %s", str(e))
            ret = False