Make sure configure-vm mac doesn't start negative
The original version of this code allowed for the possibility of generating macs with negative numbers (consider generating 100 macs, with a random start value of 0xaa). While this is unlikely to be a problem in real-world uses of this code, it's still a potential bug if someone starts to push on the limits of what is supported. Change-Id: Ia42da0ece5ab3fbeccd6b4d8a4125c1bf5a658d0
This commit is contained in:
parent
f3a73677e4
commit
702193a6cc
|
@ -43,7 +43,7 @@ def generate_baremetal_macs(count=1):
|
|||
start = random.randint(0x00, 0xff)
|
||||
if (start + (count * 2)) > 0xff:
|
||||
# leave room to generate macs in sequence
|
||||
start -= (count * 2)
|
||||
start = 0xff - count * 2
|
||||
for num in range(0, count*2, 2):
|
||||
mac = start + num
|
||||
macs.append(base_mac + ":" + ("%02x" % mac))
|
||||
|
|
Loading…
Reference in New Issue