コード例 #1
0
def is_migration_possible(guest_info,host_info):
    try:
        logger.debug("Entering into is_migration_possible")
        #host mem usage used_mem_in_kb

        host_ip = host_info['host_ip'].private_ip
        host_mem_utilization = get_host_mem_usage(host_ip)
        memhog_usage = get_memhog_usage(host_ip)

        logger.debug("For host:"+str(host_ip)+" PSS Value from memhog="+str(memhog_usage))
        host_mem_utilization=((host_mem_utilization * 1024 ) - memhog_usage) 

        logger.debug("For host:"+str(host_ip)+" host_mem_utilization="+str(host_mem_utilization))

        # guest mem usage
        guest_present_host = guest_info['host_id'].host_ip.private_ip 
        guest_domain = getVirshDomain(guest_info)
        guest_mem_utilization = get_dom_mem_usage(guest_domain, guest_present_host)
        host_utilization_if_migrated = (host_mem_utilization + guest_mem_utilization)/(host_info['RAM']*1024*1024*1024)

        host_utilization_if_migrated = host_utilization_if_migrated * 100
        logger.debug("host_mem_utilization is " +str(host_mem_utilization))
        logger.debug("guest_mem_utilization is " +str(guest_mem_utilization))
        logger.debug("host_info['RAM']*1024*1024*1024 is " +str(host_info['RAM']*1024*1024*1024))
        logger.debug("host_utilization_if_migrated is " +str(host_utilization_if_migrated))
   
        if(host_utilization_if_migrated > 90):
            return False
        else:
            return True
    except:
        logger.exception('Exception in is_migration_possible')
        return False
コード例 #2
0
ファイル: load_balancer.py プロジェクト: azhariitd/baadal2.0
def is_migration_possible(guest_info,host_info):
    try:
        logger.debug("Entering into is_migration_possible")
        #host mem usage used_mem_in_kb
        host_ip = host_info['host_ip'].private_ip
        host_mem_utilization = get_host_mem_usage(host_ip)
        host_mem_utilization = host_mem_utilization * 1024

        # guest mem usage
        guest_present_host = guest_info['host_id'].host_ip.private_ip
        guest_mem_utilization = get_dom_mem_usage(guest_info['vm_identity'], guest_present_host)
        host_utilization_if_migrated = (host_mem_utilization + guest_mem_utilization)/(host_info['RAM']*1024*1024*1024)

        host_utilization_if_migrated = host_utilization_if_migrated * 100
        logger.debug("host_mem_utilization is " +str(host_mem_utilization))
        logger.debug("guest_mem_utilization is " +str(guest_mem_utilization))
        logger.debug("host_utilization_if_migrated is " +str(host_utilization_if_migrated))
   
        if(host_utilization_if_migrated > 90):
            return False
        else:
            return True
    except:
        logger.exception('Exception in is_migration_possible')
        return False
コード例 #3
0
def is_migration_possible(guest_info, host_info):
    """
    Checks whether migration on the host is possible or not and criteria is host utilization should not 
    go above 90% after migration.
    """
    try:
        logger.debug("Entering into is_migration_possible")
        #host mem usage used_mem_in_kb

        host_ip = host_info['host_ip'].private_ip
        host_mem_utilization = get_host_mem_usage(host_ip)
        memhog_usage = get_memhog_usage(host_ip)

        logger.debug("For host:" + str(host_ip) + " PSS Value from memhog=" +
                     str(memhog_usage))
        host_mem_utilization = ((host_mem_utilization * 1024) - memhog_usage)

        logger.debug("For host:" + str(host_ip) + " host_mem_utilization=" +
                     str(host_mem_utilization))

        # guest mem usage
        guest_present_host = guest_info['host_id'].host_ip.private_ip
        guest_domain = getVirshDomain(guest_info)  # @UndefinedVariable
        guest_mem_utilization = get_dom_mem_usage(guest_domain,
                                                  guest_present_host)
        host_utilization_if_migrated = (
            host_mem_utilization +
            guest_mem_utilization) / (host_info['RAM'] * 1024 * 1024 * 1024)

        host_utilization_if_migrated = host_utilization_if_migrated * 100
        logger.debug("host_mem_utilization is " + str(host_mem_utilization))
        logger.debug("guest_mem_utilization is " + str(guest_mem_utilization))
        logger.debug("host_info['RAM']*1024*1024*1024 is " +
                     str(host_info['RAM'] * 1024 * 1024 * 1024))
        logger.debug("host_utilization_if_migrated is " +
                     str(host_utilization_if_migrated))

        if (host_utilization_if_migrated > 90):
            return False
        else:
            return True
    except:
        logger.exception('Exception in is_migration_possible')
        return False
コード例 #4
0
ファイル: load_balancer.py プロジェクト: shivgarg/baadal2.0
def is_migration_possible(guest_info, host_info):
    """
    Checks whether migration on the host is possible or not and criteria is host utilization should not 
    go above 90% after migration.
    """
    try:
        logger.debug("Entering into is_migration_possible")
        # host mem usage used_mem_in_kb

        host_ip = host_info["host_ip"].private_ip
        host_mem_utilization = get_host_mem_usage(host_ip)
        memhog_usage = get_memhog_usage(host_ip)

        logger.debug("For host:" + str(host_ip) + " PSS Value from memhog=" + str(memhog_usage))
        host_mem_utilization = (host_mem_utilization * 1024) - memhog_usage

        logger.debug("For host:" + str(host_ip) + " host_mem_utilization=" + str(host_mem_utilization))

        # guest mem usage
        guest_present_host = guest_info["host_id"].host_ip.private_ip
        guest_domain = getVirshDomain(guest_info)  # @UndefinedVariable
        guest_mem_utilization = get_dom_mem_usage(guest_domain, guest_present_host)
        host_utilization_if_migrated = (host_mem_utilization + guest_mem_utilization) / (
            host_info["RAM"] * 1024 * 1024 * 1024
        )

        host_utilization_if_migrated = host_utilization_if_migrated * 100
        logger.debug("host_mem_utilization is " + str(host_mem_utilization))
        logger.debug("guest_mem_utilization is " + str(guest_mem_utilization))
        logger.debug("host_info['RAM']*1024*1024*1024 is " + str(host_info["RAM"] * 1024 * 1024 * 1024))
        logger.debug("host_utilization_if_migrated is " + str(host_utilization_if_migrated))

        if host_utilization_if_migrated > 90:
            return False
        else:
            return True
    except:
        logger.exception("Exception in is_migration_possible")
        return False