Beispiel #1
0
func TestSetTopologySingleVirtualNUMA(t *testing.T) {
	hn := new(host.NUMA)
	hn.CPUs = []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
	hn.CellID = 0
	hn.FreeRAM = 6000
	hn.TotalRAM = 6000

	c := NewConfig()
	c.CPUs = 6
	c.RamMb = 5
	if err := c.SetTopologySingleVirtualNUMA(host.NUMANodes{hn}, true); err != nil {
		t.Fatal(err)
	}
	for _, gn := range c.NUMAs {
		fmt.Println("\n===== Guest NUMA info =====")
		fmt.Printf("CellID: %v\n", gn.CellID)
		fmt.Printf("MemoryMb: %v\n", gn.MemoryMb)
		fmt.Printf("vCPUs: %v\n", gn.CPUPin)
	}
}
Beispiel #2
0
func TestSetTopologyOneToOnePinningMultipleNUMA(t *testing.T) {

	hn1 := new(host.NUMA)
	hn1.CPUs = []int{0, 2, 4, 6, 8, 10, 12, 14, 16, 18}
	hn1.CellID = 0
	hn1.FreeRAM = 6000
	hn1.TotalRAM = 64375

	hn2 := new(host.NUMA)
	hn2.CPUs = []int{1, 3, 5, 7, 9, 11, 13, 15, 17, 19}
	hn2.CellID = 1
	hn2.FreeRAM = 6000
	hn2.TotalRAM = 64375

	hn3 := new(host.NUMA)
	hn3.CPUs = []int{20, 22, 24, 26, 28, 30, 32, 34, 36, 38}
	hn3.CellID = 2
	hn3.FreeRAM = 6000
	hn3.TotalRAM = 6437

	hn4 := new(host.NUMA)
	hn4.CPUs = []int{21, 23, 25, 27, 29, 31, 33, 35, 37, 39}
	hn4.CellID = 3
	hn4.FreeRAM = 6000
	hn4.TotalRAM = 6437

	numas := host.NUMANodes{hn1, hn2, hn3, hn4}

	c := NewConfig()
	c.CPUs = 10
	c.RamMb = 6000
	c.NICLists = createTestListMultipleNUMAs()
	if err := c.SetTopologyMultipleVirtualNUMAs(numas); err != nil {
		t.Fatal(err)
	}

	fmt.Println("\nTestSetTopologyMultipleVirtualNUMAs")
	for _, gn := range c.NUMAs {
		fmt.Println("\n===== Guest NUMA info =====")
		fmt.Printf("CellID: %v\n", gn.CellID)
		fmt.Printf("MemoryMb: %v\n", gn.MemoryMb)
		fmt.Printf("CPU pinning %v\n", gn.CPUPin)
	}
}