def get_required_mem_for_capture_kernel(self): """Detects the system configuration and returns the amount of memory required for capture kernel in MB""" ram = get_total_ram() if ram is None: return None else: # Change from KB to MB ram = ram / 1024 for (total_mem, need_reservation_mem) in self.capture_kernel_mem: if ram <= total_mem: return need_reservation_mem
def get_crash_mem_needed(self): """Returns the memory needs to be reserved for crash dump in MB""" ram = get_total_ram() if ram is None: self.log.debug("Failed to detect total ram") return None # change from KB to MB ram = ram / 1024 / 1024 for (sys_mem, mem_reservation_needed) in self.capture_kernel_mem: if ram <= sys_mem: return mem_reservation_needed
def get_required_mem_for_capture_kernel(self): """detects the system configuration and returns the amount of memory required for capture kernel in MB""" crash_ker_val = get_crashkernel_recomm() if crash_ker_val != -1: return crash_ker_val ram = get_total_ram() if ram is None: return None # change from kb to mb ram = ram / 1024 for (total_mem, need_reservation_mem) in self.capture_kernel_mem: if ram <= total_mem: return need_reservation_mem
def get_required_mem_for_capture_kernel(self): """Detects the system configuration and returns the amount of memory required for capture kernel in MB""" ram = get_total_ram() if ram is None: return None else: # Change from KB to MB ram = ram / 1024 capture_kernel_mem = [(2048, 128), (4096, 320), (32768, 512), (65536, 1024), (131072, 2048), (1048576, 8192), (8388608, 16384), (16777216, 32768), (sys.maxsize, 65536)] for (total_mem, need_reservation_mem) in capture_kernel_mem: if ram <= total_mem: return need_reservation_mem
def get_crash_mem_needed(self): """Returns the memory needs to be reserved for crash dump in MB""" ram = get_total_ram() if ram is None: self.log.debug("Failed to detect total ram") return None # change from KB to MB ram = ram / 1024 / 1024 # (system mem, mem reservation needed) # (GB, MB) crashkernel_mem_table = [(4, 0), (64, 1024), (128, 2048), (1024, 4096), (2048, 6144), (4096, 12288), (8192, 20480), (16384, 36864), (32786, 65536), (65536, 131072), (sys.maxsize, 184320)] for (sys_mem, mem_reservation_needed) in crashkernel_mem_table: if ram <= sys_mem: return mem_reservation_needed