def revert(): for host_to_revert in modified_hosts: check_host_cpu_and_memory(host_to_revert, expt_shared_cpu={0: 1, 1: 1}, expt_1g_page={0: 4}) p0_shared = len(shared_disabled_hosts[host_to_revert][0]) p1_shared = len(shared_disabled_hosts[host_to_revert][1]) try: LOG.fixture_step("Revert {} shared cpu and memory setting".format(host_to_revert)) host_helper.lock_host(host_to_revert) host_helper.modify_host_cpu(host_to_revert, 'shared', p0=p0_shared, p1=p1_shared) host_helper.modify_host_memory(host_to_revert, proc=0, gib_1g=0) finally: host_helper.unlock_host(host_to_revert) host_helper.wait_for_memory_update(host_to_revert) check_host_cpu_and_memory(host_to_revert, expt_shared_cpu={0: p0_shared, 1: p1_shared}, expt_1g_page={0: 0})
def _modify(host): is_1g = True if hosts_selected.index(host) == 0 else False proc1_kwargs = {'gib_1g': 2, 'gib_4k_range': (None, 2)} if \ is_1g else {'gib_1g': 0, 'gib_4k_range': (2, None)} kwargs = {'gib_1g': 0, 'gib_4k_range': (None, 2)}, proc1_kwargs actual_mems = host_helper._get_actual_mems(host=host) LOG.fixture_step("Modify {} proc0 to have 0 of 1G pages and " "<2GiB of 4K pages".format(host)) host_helper.modify_host_memory(host, proc=0, actual_mems=actual_mems, **kwargs[0]) LOG.fixture_step("Modify {} proc1 to have >=2GiB of {} " "pages".format(host, '1G' if is_1g else '4k')) host_helper.modify_host_memory(host, proc=1, actual_mems=actual_mems, **kwargs[1])
def ensure_sufficient_4k_pages(request): """ Check if there is enough 4k pages on any compute node on any processors is a bit hassle Returns: """ # check if any 4k pages greater than 600000 means more than 2G(~536871 4k pages) total. storage_backing = request.param hypervisors = host_helper.get_hosts_in_storage_backing( storage_backing=storage_backing) if len(hypervisors) < 2: skip("Less than two hypersvisors with {} instance backing".format( storage_backing)) hypervisors = hypervisors[:2] LOG.fixture_step( "Configure {} with sufficient 4k pages".format(hypervisors)) for host in hypervisors: LOG.fixture_step( "Modify 4k page numbers to 600000 for {}".format(host)) num_4k_pages = host_helper.get_host_memories(host, 'app_total_4K') for proc, pages_4k in num_4k_pages.items(): if pages_4k[0] > 1024 * 1024 / 4: break else: proc_to_set = 1 if len(num_4k_pages) > 1 else 0 HostsToRecover.add(host, scope='module') host_helper.lock_host(host, swact=True) host_helper.modify_host_memory(host, proc=proc_to_set, gib_4k_range=(2, 4)) host_helper.unlock_host(host, check_hypervisor_up=True, check_webservice_up=True) return storage_backing, hypervisors
def _modify(host_to_modify): host_helper.modify_host_cpu(host_to_modify, 'shared', p0=1, p1=1) host_helper.modify_host_memory(host_to_modify, proc=0, gib_1g=4)