From 56d12936d9cd1ec8f3cfa6be7edab072048503d1 Mon Sep 17 00:00:00 2001 From: Nikola Dipanov Date: Mon, 14 Mar 2016 10:24:06 +0000 Subject: [PATCH] Revert "virt: reserved hugepages on compute host" This reverts commit 70604db8dacd1d8ea8a054a9f548b24dcffc292c. The commit adds a config option that is required on both the scheduler and the compute hosts which is not the direction we want to be going in, and want to make sure that compute hosts are exclusively responsible for the data that the scheduler service uses. Change-Id: I2465e1bee618a552132d659014ea96cdbda161d6 --- nova/conf/virt.py | 26 +------- nova/exception.py | 6 -- nova/tests/unit/virt/test_hardware.py | 65 ------------------- nova/virt/hardware.py | 35 ---------- ...-hugepages-per-nodes-f36225d5fca807e4.yaml | 4 -- 5 files changed, 1 insertion(+), 135 deletions(-) delete mode 100644 releasenotes/notes/reserved-hugepages-per-nodes-f36225d5fca807e4.yaml diff --git a/nova/conf/virt.py b/nova/conf/virt.py index be485aa50a96..7574ca8b87b8 100644 --- a/nova/conf/virt.py +++ b/nova/conf/virt.py @@ -299,29 +299,6 @@ timeout_nbd = cfg.IntOpt( help='Amount of time, in seconds, to wait for NBD ' 'device start up.') -reserved_memory_pages = cfg.MultiStrOpt( - "reserved_memory_pages", - default=[], - help="""Reserves amount of huge pages per NUMA host cells - -Possible values: - -* A list of valid strings which reflect NUMA node ID, page size and - number of pages reserved separated by punctuation mark - colon. Default unit is KiB. - - reserved_memory_pages = ["0:2MB:64", "1:1GB:1"] - -Services which consume this: - -* nova-compute -* nova-scheduler - -Related options: - -* None""") - - ALL_OPTS = [vcpu_pin_set, compute_driver, default_ephemeral_format, @@ -335,8 +312,7 @@ ALL_OPTS = [vcpu_pin_set, injected_network_template, virt_mkfs, resize_fs_using_block_device, - timeout_nbd, - reserved_memory_pages] + timeout_nbd] def register_opts(conf): diff --git a/nova/exception.py b/nova/exception.py index d12b42d0b76d..1d6077670920 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -2116,9 +2116,3 @@ class OsInfoNotFound(NotFound): class BuildRequestNotFound(NotFound): msg_fmt = _("BuildRequest not found for instance %(uuid)s") - - -class InvalidReservedMemoryPagesOption(Invalid): - msg_fmt = _("The format of the option 'reserved_memory_pages' is invalid. " - "(found '%(conf)s') Please refer to the nova " - "config-reference.") diff --git a/nova/tests/unit/virt/test_hardware.py b/nova/tests/unit/virt/test_hardware.py index bc367455730c..fef3dd014143 100644 --- a/nova/tests/unit/virt/test_hardware.py +++ b/nova/tests/unit/virt/test_hardware.py @@ -1349,71 +1349,6 @@ class NUMATopologyTest(test.NoDBTestCase): self.assertEqual(hostusage.cells[2].cpu_usage, 0) self.assertEqual(hostusage.cells[2].memory_usage, 0) - def test_topo_usage_reserved_page_size(self): - hosttopo = objects.NUMATopology(cells=[ - objects.NUMACell(id=0, cpuset=set([0, 1]), memory=512, - cpu_usage=0, memory_usage=0, mempages=[ - objects.NUMAPagesTopology( - size_kb=2048, - total=512, - used=128)], - siblings=[], pinned_cpus=set([])), - objects.NUMACell(id=1, cpuset=set([2, 3]), memory=512, - cpu_usage=0, memory_usage=0, mempages=[ - objects.NUMAPagesTopology( - size_kb=1048576, - total=5, - used=2)], - siblings=[], pinned_cpus=set([])), - ]) - instance1 = objects.InstanceNUMATopology(cells=[ - objects.InstanceNUMACell( - id=0, cpuset=set([0, 1]), memory=256, pagesize=2048), - objects.InstanceNUMACell( - id=1, cpuset=set([2, 3]), memory=1024, pagesize=1048576), - ]) - - # reserved_page_size is using a global variable so we prefer - # to create tests in a same context to avoid errors when - # running unit tests in parallel - - def test_success(): - hw.RESERVED_MEMORY_PAGES = None - self.flags(reserved_memory_pages=["0:2048:128", - "1:1048576:1"]) - hostusage = hw.numa_usage_from_instances( - hosttopo, [instance1]) - - self.assertEqual(hostusage.cells[0].mempages[0].size_kb, 2048) - self.assertEqual(hostusage.cells[0].mempages[0].total, 512) - # 128 reserved + 128 used by instance - self.assertEqual(hostusage.cells[0].mempages[0].used, 256) - - self.assertEqual(hostusage.cells[1].mempages[0].size_kb, 1048576) - self.assertEqual(hostusage.cells[1].mempages[0].total, 5) - # 1 reserved + 1 used by instance + 2 already used: - self.assertEqual(hostusage.cells[1].mempages[0].used, 4) - - def test_invalid_format(): - hw.RESERVED_MEMORY_PAGES = None - self.flags(reserved_memory_pages="1:2:3") - self.assertRaises( - exception.InvalidReservedMemoryPagesOption, - hw.numa_usage_from_instances, - hosttopo, [instance1]) - - def test_invalid_value(): - hw.RESERVED_MEMORY_PAGES = None - self.flags(reserved_memory_pages=["0:foo:bar"]) - self.assertRaises( - exception.InvalidReservedMemoryPagesOption, - hw.numa_usage_from_instances, - hosttopo, [instance1]) - - test_success() - test_invalid_format() - test_invalid_value() - def test_topo_usage_none(self): hosttopo = objects.NUMATopology(cells=[ objects.NUMACell(id=0, cpuset=set([0, 1]), memory=512, diff --git a/nova/virt/hardware.py b/nova/virt/hardware.py index 47a2ba1379d8..0ae1417798a5 100644 --- a/nova/virt/hardware.py +++ b/nova/virt/hardware.py @@ -38,8 +38,6 @@ MEMPAGES_SMALL = -1 MEMPAGES_LARGE = -2 MEMPAGES_ANY = -3 -RESERVED_MEMORY_PAGES = None - def get_vcpu_pin_set(): """Parsing vcpu_pin_set config. @@ -1250,36 +1248,6 @@ def numa_fit_instance_to_host( return objects.InstanceNUMATopology(cells=cells) -def _numa_reserved_memory_pages_from_cell(cell_id, pagesize): - global RESERVED_MEMORY_PAGES - try: - if CONF.reserved_memory_pages and not RESERVED_MEMORY_PAGES: - RESERVED_MEMORY_PAGES = collections.defaultdict(dict) - for cfg in CONF.reserved_memory_pages: - node, pagesize, reserved = cfg.split(":", 2) - node = int(node) - try: - pagesize = int(pagesize) - except ValueError: - pagesize = strutils.string_to_bytes( - pagesize, return_int=True) / units.Ki - RESERVED_MEMORY_PAGES[int(node)][pagesize] = int(reserved) - if RESERVED_MEMORY_PAGES: - return RESERVED_MEMORY_PAGES.get(cell_id, {}).get(pagesize, 0) - except ValueError: - raise exception.InvalidReservedMemoryPagesOption( - conf=CONF.reserved_memory_pages) - return 0 - - -def _numa_reserved_memory_pages(hostcells): - for hostcell in hostcells: - for pages in hostcell.mempages: - pages.used = ( - pages.used + _numa_reserved_memory_pages_from_cell( - hostcell.id, pages.size_kb)) - - def _numa_pagesize_usage_from_cell(hostcell, instancecell, sign): topo = [] for pages in hostcell.mempages: @@ -1358,9 +1326,6 @@ def numa_usage_from_instances(host, instances, free=False): cells.append(newcell) - # Compute reserved memory pages - _numa_reserved_memory_pages(cells) - return objects.NUMATopology(cells=cells) diff --git a/releasenotes/notes/reserved-hugepages-per-nodes-f36225d5fca807e4.yaml b/releasenotes/notes/reserved-hugepages-per-nodes-f36225d5fca807e4.yaml deleted file mode 100644 index f66fd4ffe49f..000000000000 --- a/releasenotes/notes/reserved-hugepages-per-nodes-f36225d5fca807e4.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -features: - - Adds reserved_memory_pages option to reserve - amount of hugepages used by third part components. \ No newline at end of file