예제 #1
0
    def create_resource(self, local_settings):
        iteration_id = self.get_iteration_id(local_settings)
        messages.info(local_settings, "%s: Creating VMs" % iteration_id)
        created_nodes = []
        group_id, vms_detail_list = create_vms(local_settings)
        logger.debug("group_id=%s vms_detail_list=%s" % (group_id, vms_detail_list))

        try:
            if not vms_detail_list or len(vms_detail_list) < local_settings['min_count']:
                raise InsufficientVMError
            print_vms(local_settings, all_vms=vms_detail_list)
            for vm in vms_detail_list:
                if not vm.ip_address:
                    vm.ip_address = vm.private_ip_address
            created_nodes = [[x.id, x.ip_address, unicode(x.region), 'running'] for x in vms_detail_list]
            messages.info_context(int(local_settings['contextid']),
                                 "%s: Creating VMs (%s created)" % (iteration_id, len(vms_detail_list)))
        except InsufficientVMError as e:
            group_id = 'UNKNOWN'
            messages.error_context(int(local_settings['contextid']),
                                   "error: sufficient VMs cannot be created")
            ftmanager = FTManager()
            ftmanager.manage_failure(
                e, settings=local_settings,
                created_vms=vms_detail_list)
        return group_id, created_nodes
예제 #2
0
    def create_resource(self, local_settings):
        iteration_id = self.get_iteration_id(local_settings)
        messages.info(local_settings, "%s: Creating VMs" % iteration_id)
        created_nodes = []
        group_id, vms_detail_list = create_vms(local_settings)
        logger.debug("group_id=%s vms_detail_list=%s" %
                     (group_id, vms_detail_list))

        try:
            if not vms_detail_list or len(
                    vms_detail_list) < local_settings['min_count']:
                raise InsufficientVMError
            print_vms(local_settings, all_vms=vms_detail_list)
            for vm in vms_detail_list:
                if not vm.ip_address:
                    vm.ip_address = vm.private_ip_address
            created_nodes = [[
                x.id, x.ip_address,
                unicode(x.region), 'running'
            ] for x in vms_detail_list]
            messages.info_context(
                int(local_settings['contextid']),
                "%s: Creating VMs (%s created)" %
                (iteration_id, len(vms_detail_list)))
        except InsufficientVMError as e:
            group_id = 'UNKNOWN'
            messages.error_context(int(local_settings['contextid']),
                                   "error: sufficient VMs cannot be created")
            ftmanager = FTManager()
            ftmanager.manage_failure(e,
                                     settings=local_settings,
                                     created_vms=vms_detail_list)
        return group_id, created_nodes
예제 #3
0
 def create_resource(self, local_settings):
     group_id = 'UNKNOWN'
     created_nodes = []
     created_nodes.append(
         ['1', local_settings['ip_address'], 'unix', 'running'])
     messages.info_context(
         local_settings['contextid'],
         "1: create (%s nodes created)" % len(created_nodes))
     return group_id, created_nodes
예제 #4
0
 def create_resource(self, local_settings):
     group_id = 'UNKNOWN'
     created_nodes = []
     created_nodes.append(['1', local_settings['ip_address'], 'hadoop', 'running'])
     messages.info_context(local_settings['contextid'], "1: create (%s nodes created)" % len(created_nodes))
     return group_id, created_nodes
예제 #5
0
        logger.debug("fin=%s" % fin)
        if fin:
            print "done."
            logger.debug("node=%s" % str(node))
            logger.debug("bootstrapped_nodes=%s" % bootstrap_class.bootstrapped_nodes)
            if not (node_ip in [x[1]
                                        for x in bootstrap_class.bootstrapped_nodes
                                        if x[1] == node_ip]):
                logger.debug('new ip = %s' % node_ip)
                bootstrap_class.bootstrapped_nodes.append(
                    [node.id, node_ip, unicode(node.region), 'running'])
            else:
                logger.info("We have already "
                    + "bootstrapped node %s" % node_ip)
            messages.info_context(local_settings['contextid'],
                                  "%s: Bootstrapping VMs (%s VMs done)"
                % (id, len(bootstrap_class.bootstrapped_nodes)))
        else:
            print "job still running on %s" % node_ip


def _is_bootstrap_complete(ip, settings, destination):
    """
        Return True if package job on instance_id has is_job_finished
    """
    ssh = open_connection(ip_address=ip, settings=settings)
    makefile_path = get_make_path(destination)
    (command_out, err) = run_make(ssh, makefile_path, 'bootstrap_done')
    if command_out:
        logger.debug("command_out = %s" % command_out)
        for line in command_out:
예제 #6
0
        logger.debug("fin=%s" % fin)
        if fin:
            print "done."
            logger.debug("node=%s" % str(node))
            logger.debug("bootstrapped_nodes=%s" % bootstrap_class.bootstrapped_nodes)
            if not (node_ip in [x[1]
                                        for x in bootstrap_class.bootstrapped_nodes
                                        if x[1] == node_ip]):
                logger.debug('new ip = %s' % node_ip)
                bootstrap_class.bootstrapped_nodes.append(
                    [node[0], node_ip, node[2], 'running'])
            else:
                logger.info("We have already "
                    + "bootstrapped node %s" % node_ip)
            messages.info_context(local_settings['contextid'],
                                  "bootstrapping nodes (%s nodes done)"
                % len(bootstrap_class.bootstrapped_nodes))
        else:
            print "job still running on %s" % node_ip


def _is_bootstrap_complete(ip, settings, destination):
    """
        Return True if package job on instance_id has is_job_finished
    """
    ssh = open_connection(ip_address=ip, settings=settings)
    makefile_path = get_make_path(destination)
    (command_out, err) = run_make(ssh, makefile_path, 'bootstrap_done')
    if command_out:
        logger.debug("command_out = %s" % command_out)
        for line in command_out:
            logger.debug("node=%s" % str(node))
            logger.debug("bootstrapped_nodes=%s" %
                         bootstrap_class.bootstrapped_nodes)
            if not (node_ip in [
                    x[1] for x in bootstrap_class.bootstrapped_nodes
                    if x[1] == node_ip
            ]):
                logger.debug('new ip = %s' % node_ip)
                bootstrap_class.bootstrapped_nodes.append(
                    [node.id, node_ip,
                     unicode(node.region), 'running'])
            else:
                logger.info("We have already " +
                            "bootstrapped node %s" % node_ip)
            messages.info_context(
                local_settings['contextid'],
                "bootstrapping nodes (%s nodes done)" %
                len(bootstrap_class.bootstrapped_nodes))
        else:
            print "job still running on %s" % node_ip


def _is_bootstrap_complete(ip, settings, destination):
    """
        Return True if package job on instance_id has is_job_finished
    """
    ssh = open_connection(ip_address=ip, settings=settings)
    makefile_path = get_make_path(destination)
    (command_out, err) = run_make(ssh, makefile_path, 'bootstrap_done')
    if command_out:
        logger.debug("command_out = %s" % command_out)
        for line in command_out:
예제 #8
0
            logger.debug("node=%s" % str(node))
            logger.debug("bootstrapped_nodes=%s" %
                         bootstrap_class.bootstrapped_nodes)
            if not (node_ip in [
                    x[1] for x in bootstrap_class.bootstrapped_nodes
                    if x[1] == node_ip
            ]):
                logger.debug('new ip = %s' % node_ip)
                bootstrap_class.bootstrapped_nodes.append(
                    [node.id, node_ip,
                     unicode(node.region), 'running'])
            else:
                logger.info("We have already " +
                            "bootstrapped node %s" % node_ip)
            messages.info_context(
                local_settings['contextid'],
                "%s: Bootstrapping VMs (%s VMs done)" %
                (id, len(bootstrap_class.bootstrapped_nodes)))
        else:
            print "job still running on %s" % node_ip


def _is_bootstrap_complete(ip, settings, destination):
    """
        Return True if package job on instance_id has is_job_finished
    """
    ssh = open_connection(ip_address=ip, settings=settings)
    makefile_path = get_make_path(destination)
    (command_out, err) = run_make(ssh, makefile_path, 'bootstrap_done')
    if command_out:
        logger.debug("command_out = %s" % command_out)
        for line in command_out: