Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mmalchuk/dac542bb383c55bd4265864ab9dc2dd2 to your computer and use it in GitHub Desktop.
Save mmalchuk/dac542bb383c55bd4265864ab9dc2dd2 to your computer and use it in GitHub Desktop.
generate MAC address and UUID for libvirt KVM guest.
#!/usr/bin/env python
import virtinst.util
print "UUID:\t", virtinst.util.uuidToString(virtinst.util.randomUUID())
print "MAC:\t", virtinst.util.randomMAC(type="qemu")
# for one-liner
# python -c 'from virtinst.util import *; print uuidToString(randomUUID())'
# python -c 'from virtinst.util import *; print randomMAC(type="qemu")'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment