Installation guide

Chapter 24. Miscellaneous administration tasks
190
mac = [ 0x00, 0x16, 0x3e,
random.randint(0x00, 0x7f),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff) ]
return ':'.join(map(lambda x: "%02x" % x, mac))
#
print randomMAC()
Another method to generate a new MAC for your guest
You can also use the built-in modules of python-virtinst to generate a new MAC address and
UUID for use in a guest configuration file:
# echo 'import virtinst.util ; print\
virtinst.util.uuidToString(virtinst.util.randomUUID())' | python
# echo 'import virtinst.util ; print virtinst.util.randomMAC()' | python
The script above can also be implemented as a script file as seen below.
#!/usr/bin/env python
# -*- mode: python; -*-
print ""
print "New UUID:"
import virtinst.util ; print virtinst.util.uuidToString(virtinst.util.randomUUID())
print "New MAC:"
import virtinst.util ; print virtinst.util.randomMAC()
print ""
24.6. Improving guest response time
Virtualized guests can sometimes be slow to respond with certain workloads and usage patterns.
Examples of situations which may cause slow or unresponsive guests:
Severely overcommitted memory.
Overcommitted memory with high processor usage
Other (not qemu-kvm processes) busy or stalled processes on the host.
These types of workload may cause guests to appear slow or unresponsive. Usually, the guests
memory is eventually fully loaded from swap into the hosts main memory. Once the guest is loaded in
main memory, the guest will preform normally. Note, the process of loading a guest from swap to main
memory may take several seconds per gigabyte of RAM assigned to the guest depending on the type
of storage used for swap and the performance of the components.
KVM virtualized guests function as Linux processes. Linux processes are not permanently kept in
main memory (physical RAM). The kernel scheduler swaps process memory into virtual memory
(swap). Swap, with conventional hard disk drives, is thousands of times slower than main memory in
modern computers. If a guest is inactive for long periods of time, the guest may be placed into swap
by the kernel.
KVM virtualized guests processes may be moved to swap regardless of whether memory is
overcommitted or overall memory usage.
Using unsafe overcommit levels or overcommitting with swap turned off guest processes or other
critical processes may be killed by the pdflush kernel function. pdflush automatically kills
processes to keep the system from crashing and to free up memory. Always ensure the host has
sufficient swap space when overcommitting memory.