示例#1
0
def _findDuplicateHost(hosts, clusterName):
    for host in hosts:
        # Host name may be empty if the host is in disconnected status
        if host.get('hostname'):
            hostConfig = server_utils.getHostConfigByName(host.get('hostname'))
            if hostConfig:
                if clusterName not in _getHostGroupNames(hostConfig):
                    return host.get('hostname')
def _findDuplicateHost(hosts, clusterName):
    for host in hosts:
        # Host name may be empty if the host is in disconnected status
        if host.get('hostname'):
            hostConfig = server_utils.getHostConfigByName(host.get('hostname'))
            if hostConfig:
                if clusterName not in _getHostGroupNames(hostConfig):
                    return host.get('hostname')
示例#3
0
def unRegisterHost(hostName):
    hostConfig = server_utils.getHostConfigByName(hostName)
    if hostConfig:
        if hostConfig.get('register') != '0':
            hostConfig['register'] = 0
            hostConfig.save()
            serviceConfigs = server_utils.getServiceConfigByHost(hostName)
            for serviceConfig in serviceConfigs:
                serviceConfig['register'] = 0
                serviceConfig.save()
def unRegisterHost(hostName):
    hostConfig = server_utils.getHostConfigByName(hostName)
    if hostConfig:
        if hostConfig.get('register') != '0':
            hostConfig['register'] = 0
            hostConfig.save()
            serviceConfigs = server_utils.getServiceConfigByHost(hostName)
            for serviceConfig in serviceConfigs:
                serviceConfig['register'] = 0
                serviceConfig.save()
示例#5
0
def findAddUpdateHosts(hosts):
    delta = []
    for host in hosts:
        hostConfing = server_utils.getHostConfigByName(host['host_name'])
        if hostConfing is None:
            host[CHANGE_MODE] = CHANGE_MODE_ADD
            delta.append(host)
        else:
            serviceDelta = findServiceDelta(host)
            if serviceDelta:
                host[CHANGE_MODE] = CHANGE_MODE_UPDATE
                host[HOST_SERVICES] = serviceDelta
                delta.append(host)
    return delta
def findAddUpdateHosts(hosts):
    delta = []
    for host in hosts:
        hostConfing = server_utils.getHostConfigByName(host['host_name'])
        if hostConfing is None:
            host[CHANGE_MODE] = CHANGE_MODE_ADD
            delta.append(host)
        else:
            serviceDelta = findServiceDelta(host)
            if serviceDelta:
                host[CHANGE_MODE] = CHANGE_MODE_UPDATE
                host[HOST_SERVICES] = serviceDelta
                delta.append(host)
    return delta