コード例 #1
0
def get_hotpluggable_blocks(path):
    mem_blocks = []
    for mem_blk in glob.glob(path):
        block = re.findall("\d+", os.path.basename(mem_blk))[0]
        block = re.sub(r'^\s*$', '', block)
        if memory.is_hot_pluggable(block):
            mem_blocks.append(block)
    return mem_blocks
コード例 #2
0
def get_hotpluggable_blocks(path):
    mem_blocks = []
    for mem_blk in glob.glob(path):
        block = re.findall("\d+", os.path.basename(mem_blk))[0]
        block = re.sub(r'^\s*$', '', block)
        if memory.is_hot_pluggable(block):
            mem_blocks.append(block)
    return mem_blocks
コード例 #3
0
def get_hotpluggable_blocks(path, ratio):
    mem_blocks = []
    for mem_blk in glob.glob(path):
        block = re.findall(r"\d+", os.path.basename(mem_blk))[0]
        block = re.sub(r'^\s*$', '', block)
        if memory.is_hot_pluggable(block):
            mem_blocks.append(block)

    def f(num):
        if num % 2:
            return (num / 100 + 1)
        return (num / 100)
    count = f(len(mem_blocks) * ratio)
    return mem_blocks[:count]
コード例 #4
0
def get_hotpluggable_blocks(path, ratio):
    mem_blocks = []
    for mem_blk in glob.glob(path):
        block = re.findall(r"\d+", os.path.basename(mem_blk))[0]
        block = re.sub(r'^\s*$', '', block)
        if memory.is_hot_pluggable(block):
            mem_blocks.append(block)

    def f(num):
        if num % 2:
            return (num / 100 + 1)
        return (num / 100)

    count = f(len(mem_blocks) * ratio)
    return mem_blocks[:count]
コード例 #5
0
def get_hotpluggable_blocks(path, ratio):
    mem_blocks = []
    for mem_blk in glob.glob(path):
        block = re.findall(r"\d+", os.path.basename(mem_blk))[0]
        block = re.sub(r'^\s*$', '', block)
        if memory.is_hot_pluggable(block):
            mem_blocks.append(block)

    def chunks(num):
        """
        Return number of blocks in chunks of 100
        """
        if num % 2:
            return num // 100 + 1
        return num // 100
    count = chunks(len(mem_blocks) * ratio)
    return mem_blocks[:count]