add the current state of the vmsetup
This commit is contained in:
commit
d3675f34bf
19 changed files with 985 additions and 0 deletions
17
roles/create-vm/files/macgen.py
Normal file
17
roles/create-vm/files/macgen.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/python
|
||||
# macgen.py script to generate a MAC address for guests on Xen
|
||||
# from https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Virtualization/sect-Virtualization-Tips_and_tricks-Generating_a_new_unique_MAC_address.html
|
||||
# usefull to generate the mac for a virtual machine
|
||||
#
|
||||
# run
|
||||
# python2 macgen.py
|
||||
import random
|
||||
#
|
||||
def randomMAC():
|
||||
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())
|
Loading…
Add table
Add a link
Reference in a new issue