disksize=disk, specs=None) # Modify the flavor with the appropriate extra_specs numa_flavor = numa.create_numa_topo_extra_specs(flv=numa_flavor, numa_nodes=1) # Now we have a flavor with 2 NUMA nodes defined. You can display the extra_specs extra_specs = numa_flavor.get_keys() glob_logger.info(str(extra_specs)) # Now that we have a flavor with a simple numa topology defined, we can boot an instance. # Note that the flavor that was defined only specified 1 NUMA nodes and a memory policy of # preferred. There are many additional permutations that can be done, such as having asymmetrical # cpus to to NUMA nodes, asymmetrical memory to NUMA nodes, or combining NUMA topology with # vcpu pinning or large page memory support image = numa.get_image_name("cirros") instance = numa.boot_instance(img=image, flv=numa_flavor, name="numa_instance") # Poll to see when the instance is done booting up active = smog.nova.poll_status(instance, "ACTIVE", timeout=600) if not active: print("Failed to boot instance") # Now that the instance is actually up, check to see that it actually has 2 NUMA nodes defined discovered = numa.discover(guests=[instance ]) # Find the instance we have booted inst = discovered[0] dump = inst.dumpxml() # Verify we have the NUMA topology created root = ET.fromstring(dump)
# Create a new flavor that will have the extra specs we need numa_flavor = numa.create_flavor("numa_flavor", ram=ram, vcpus=vcpus, disksize=disk, specs=None) # Modify the flavor with the appropriate extra_specs numa_flavor = numa.create_numa_topo_extra_specs(flv=numa_flavor, numa_nodes=1) # Now we have a flavor with 2 NUMA nodes defined. You can display the extra_specs extra_specs = numa_flavor.get_keys() glob_logger.info(str(extra_specs)) # Now that we have a flavor with a simple numa topology defined, we can boot an instance. # Note that the flavor that was defined only specified 1 NUMA nodes and a memory policy of # preferred. There are many additional permutations that can be done, such as having asymmetrical # cpus to to NUMA nodes, asymmetrical memory to NUMA nodes, or combining NUMA topology with # vcpu pinning or large page memory support image = numa.get_image_name("cirros") instance = numa.boot_instance(img=image, flv=numa_flavor, name="numa_instance") # Poll to see when the instance is done booting up active = smog.nova.poll_status(instance, "ACTIVE", timeout=600) if not active: print("Failed to boot instance") # Now that the instance is actually up, check to see that it actually has 2 NUMA nodes defined discovered = numa.discover(guests=[instance]) # Find the instance we have booted inst = discovered[0] dump = inst.dumpxml() # Verify we have the NUMA topology created root = ET.fromstring(dump) cpu = next(root.iter("cpu"))