Ejemplo n.º 1
0
def stack(parser):
    # if node role is "unknow", go back
    if NODE_ROLE.is_unknown():
        LOG.error('Can not confirm the node role!')
        return
    if not NODE_ROLE.is_fuel():
        if parser.CONTROLLER:
            if not NODE_ROLE.is_controller():
                cmd_warn('controller')
                return
        if parser.COMPUTE:
            if not NODE_ROLE.is_compute():
                cmd_warn('compute')
                return
        if parser.MONGO:
            if not NODE_ROLE.is_mongo():
                cmd_warn('mongo')
                return
    if parser.CONTROLLER or parser.COMPUTE or parser.MONGO:
        if parser.PROFILE and not parser.SERVICE and not parser.CHECK_ALL:
            if parser.CONTROLLER:
                check('controller', 'profile')
            if parser.COMPUTE:
                check('compute', 'profile')
            if parser.MONGO:
                check('mongo', 'profile')
        if parser.SERVICE and not parser.PROFILE and not parser.CHECK_ALL:
            if parser.CONTROLLER:
                check('controller', 'service')
            if parser.COMPUTE:
                check('compute', 'service')
            if parser.MONGO:
                check('mongo', 'service')
        if parser.SERVICE and parser.PROFILE or parser.CHECK_ALL or not parser.PROFILE and not parser.SERVICE:
            if parser.CONTROLLER:
                check('controller', 'all')
            if parser.COMPUTE:
                check('compute', 'all')
            if parser.MONGO:
                check('mongo', 'all')
        return
    # check all
    if parser.CHECK_ALL and parser.PROFILE and parser.SERVICE:
        check_all()
        return
    elif parser.CHECK_ALL and parser.PROFILE:
        check_all_profile()
        return
    elif parser.CHECK_ALL and parser.SERVICE:
        check_all_service()
        return
    elif parser.CHECK_ALL:
        check_all()
        return
    # check profile or service
    if parser.PROFILE:
        check_all_profile()
    if parser.SERVICE:
        check_all_service()
Ejemplo n.º 2
0
def _network_check_remote(remote_inf):
    def _ping(peer_inf, role):
        LOG.debug("=====> start ping %s of %s(%s):" % (role, peer_inf["host"], peer_inf["role"]))
        ping(peer_inf[role])

    for inf in remote_inf:
        _ping(inf, "internal_address")
        if (not NODE_ROLE.is_mongo()) and (not inf["role"].endswith("mongo")):
            _ping(inf, "storage_address")
        if NODE_ROLE.is_controller() and inf["role"] == "controller":
            _ping(inf, "public_address")
Ejemplo n.º 3
0
def _network_check_remote(remote_inf):
    def _ping(peer_inf, role):
        LOG.debug('=====> start ping %s of %s(%s):' %
                  (role, peer_inf['host'], peer_inf['role']))
        ping(peer_inf[role])

    for inf in remote_inf:
        _ping(inf, 'internal_address')
        if (not NODE_ROLE.is_mongo()) and (not inf['role'].endswith('mongo')):
            _ping(inf, 'storage_address')
        if NODE_ROLE.is_controller() and inf['role'] == 'controller':
            _ping(inf, 'public_address')
Ejemplo n.º 4
0
def _network_check_remote(remote_inf):
    def _ping(peer_inf, role):
        LOG.debug('=====> start ping %s of %s(%s):' %
                  (role, peer_inf['host'], peer_inf['role']))
        ping(peer_inf[role])

    for inf in remote_inf:
        _ping(inf, 'internal_address')
        if (not NODE_ROLE.is_mongo()) and (not inf['role'].endswith('mongo')):
            _ping(inf, 'storage_address')
        if NODE_ROLE.is_controller() and inf['role'] == 'controller':
            _ping(inf, 'public_address')
Ejemplo n.º 5
0
def check_mongodb():
    if NODE_ROLE.is_mongo():
        role = NODE_ROLE.role
        if search_service('mongod'):
            LOG.error('mongod service was not found on %s node,please fix it' \
               % role )
        else:
            yaml_path = '/etc/astute.yaml'
            check_service('mongod')
            mongodb_stats = _get_mongodb_stats(yaml_path)
            if isinstance(mongodb_stats, dict):
                LOG.debug("mongod service is ok:%s" % mongodb_stats)
            else:
                LOG.error('mongod service is wrong:%s' % mongodb_stats)
Ejemplo n.º 6
0
def get_node_role():
    node_roles = []
    if NODE_ROLE.is_unknown():
        return node_roles
    if NODE_ROLE.is_fuel():
        node_roles.append('fuel')
    if NODE_ROLE.is_controller():
        node_roles.append('controller')
    if NODE_ROLE.is_compute():
        node_roles.append('compute')
    if NODE_ROLE.is_ceph_osd():
        node_roles.append('ceph_osd')
    if NODE_ROLE.is_mongo():
        node_roles.append('mongo')
    return node_roles
Ejemplo n.º 7
0
def _network_check_local(local_inf, nic_status):
    # 1) check if nic we need link is ok
    if NODE_ROLE.is_mongo():
        local_inf = [i for i in local_inf if i["name"] not in ["br-storage", "br-prv"]]
    if NODE_ROLE.is_ceph_osd():
        local_inf = [i for i in local_inf if i["name"] != "br-prv"]

    nic_need = [i["phy_port"] for i in local_inf]
    for nic in set(nic_need):
        # if two network roles use same nic, e.g. br-mgmt and br-fw-admin
        # use eno1, we can ignore it since we just want physic network nic
        inf = filter(lambda inf: inf["phy_port"] == nic, local_inf)[0]
        if nic_status[nic].lower() != "yes":
            LOG.error("Network card %s(%s) is not connected" % (nic, inf["name"]))
        else:
            LOG.debug("Network card %s(%s) connected" % (nic, inf["name"]))
Ejemplo n.º 8
0
def _network_check_remote(remote_inf):
    def _ping(peer_inf, role):
        LOG.debug('=====> start ping %s of %s(%s):' %
                  (role, peer_inf['host'], peer_inf['role']))
        network_role = role.split('_')[0]
        hostname = peer_inf['host'].split(".")[0]
        ping(peer_inf[role], hostname, network_role)

    for inf in remote_inf:
        _ping(inf, 'internal_address')
        if (not NODE_ROLE.is_mongo()) and (not inf['role'].endswith('mongo')):
            _ping(inf, 'storage_address')
        if NODE_ROLE.is_controller() and inf['role'] == 'controller':
            _ping(inf, 'public_address')
        if NODE_ROLE.is_ceph_osd() and inf['role'] == 'ceph-osd':
            _ping(inf, 'ceph_cluster_address')
Ejemplo n.º 9
0
def _network_check_local(local_inf, nic_status):
    # 1) check if nic we need link is ok
    if NODE_ROLE.is_mongo():
        local_inf = [i for i in local_inf if i['name']
                     not in ['br-storage', 'br-prv']]
    if NODE_ROLE.is_ceph_osd():
        local_inf = [i for i in local_inf if i['name'] != 'br-prv']

    nic_need = []
    for inf in local_inf:
        nic_need.extend(inf['phy_port'])
    for nic in set(nic_need):
        # if two network roles use same nic, e.g. br-mgmt and br-fw-admin
        # use eno1, we can ignore it since we just want physic network nic
        inf = filter(lambda inf: nic in inf['phy_port'], local_inf)[0]
        if nic_status[nic].lower() != 'yes':
            LOG.error('Network card %s(%s) is not connected' %
                      (nic, inf['name']))
        else:
            LOG.debug('Network card %s(%s) connected' %
                      (nic, inf['name']))