From 9728ae541fc211e66260410b5dcb3bb3a92361ec Mon Sep 17 00:00:00 2001 From: Brad Hall Date: Fri, 20 Jan 2012 17:25:08 -0800 Subject: Add support for pluggable l3 backends This will allow us to support backends other than linux_net (i.e. quantum L3 when it is available) for defining L3 connectivity. Change-Id: I0b2ece2278bd68166741107a88cedd106d1ab651 --- nova/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'nova/utils.py') diff --git a/nova/utils.py b/nova/utils.py index 675ec8623..0d3067fd3 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -1399,3 +1399,12 @@ def service_is_up(service): # Timestamps in DB are UTC. elapsed = total_seconds(utcnow() - last_heartbeat) return abs(elapsed) <= FLAGS.service_down_time + + +def generate_mac_address(): + """Generate an Ethernet MAC address.""" + mac = [0x02, 0x16, 0x3e, + random.randint(0x00, 0x7f), + random.randint(0x00, 0xff), + random.randint(0x00, 0xff)] + return ':'.join(map(lambda x: "%02x" % x, mac)) -- cgit