Installation guide

CPU: 1
State: running
CPU Affinity: yyyyyyyy
VCPU: 3
CPU: 2
State: running
CPU Affinity: yyyyyyyy
The virsh vcpuinfo output (the yyyyyyyy value of CPU Affinity) shows that the guest can
presently run on any CPU.
To lock the virtual CPUs to the second NUMA node (CPUs four to seven), run the following
commands.
# virsh vcpupin guest1 0 4
# virsh vcpupin guest1 1 5
# virsh vcpupin guest1 2 6
# virsh vcpupin guest1 3 7
The virsh vcpuinfo command confirms the change in affinity.
# virsh vcpuinfo guest1
VCPU: 0
CPU: 4
State: running
CPU time: 32.2s
CPU Affinity: ----y---
VCPU: 1
CPU: 5
State: running
CPU time: 16.9s
CPU Affinity: -----y--
VCPU: 2
CPU: 6
State: running
CPU time: 11.9s
CPU Affinity: ------y-
VCPU: 3
CPU: 7
State: running
CPU time: 14.6s
CPU Affinity: -------y
33.9. Generat ing a new unique MAC address
In some case you will need to generate a new and unique MAC address for a guest. There is no
command line tool available to generate a new MAC address at the time of writing. The script
provided below can generate a new MAC address for your guests. Save the script to your guest as
macgen.py. Now from that directory you can run the script using ./macgen.py and it will generate
a new MAC address. A sample output would look like the following:
$ ./macgen.py
00:16:3e:20:b0:11
#!/usr/bin/python
# macgen.py script to generate a MAC address for guests on Xen
#
import random
#
def randomMAC():
Chapt er 33. T ips and t ricks
321