Use different MAC prefixes for MAC templates

This commit is contained in:
Joshua Boniface 2020-01-04 10:42:04 -05:00
parent a6b6c54422
commit e4a83bb063
1 changed files with 2 additions and 1 deletions

View File

@ -1139,9 +1139,9 @@ def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True):
vm_id_hex = '{:x}'.format(int(vm_id % 16)) vm_id_hex = '{:x}'.format(int(vm_id % 16))
net_id_hex = '{:x}'.format(int(network_id % 16)) net_id_hex = '{:x}'.format(int(network_id % 16))
mac_prefix = '52:54:00'
if vm_data['mac_template']: if vm_data['mac_template']:
mac_prefix = '52:54:01'
mactemplate = "{prefix}:ff:f6:{vmid}{netid}" mactemplate = "{prefix}:ff:f6:{vmid}{netid}"
macgen_template = vm_data['mac_template'] macgen_template = vm_data['mac_template']
eth_macaddr = macgen_template.format( eth_macaddr = macgen_template.format(
@ -1150,6 +1150,7 @@ def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True):
netid=net_id_hex, netid=net_id_hex,
) )
else: else:
mac_prefix = '52:54:00'
random_octet_A = '{:x}'.format(random.randint(16,238)) random_octet_A = '{:x}'.format(random.randint(16,238))
random_octet_B = '{:x}'.format(random.randint(16,238)) random_octet_B = '{:x}'.format(random.randint(16,238))
random_octet_C = '{:x}'.format(random.randint(16,238)) random_octet_C = '{:x}'.format(random.randint(16,238))