Commit 46b01f6f authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Remove mac2eui64 dependency

Import mac2eui64 code which is already shipped under util/mac2eui64 instead
of shipping it as a seperate script.
parent 2f5bee39
# Copyright 2011 GRNET S.A. All rights reserved.
# Copyright 2011, 2012, 2013 GRNET S.A. All rights reserved.
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
#!/usr/bin/env python
import sys
from IPy import IP
if len(sys.argv) != 3:
sys.stderr.write("Usage: %s <mac_address> <IPv6 prefix>\n" % sys.argv[0])
mac = sys.argv[1]
prefix = IP(sys.argv[2])
except ValueError:
sys.stderr.write("Invalid IPv6 prefix '%s'\n" % sys.argv[2])
if prefix.version() != 6:
sys.stderr.write("%s is not a valid IPv6 prefix\n" % prefix)
if prefix.prefixlen() != 64:
sys.stderr.write("Cannot generate an EUI-64 address on a non-64 subnet\n")
mac_parts = mac.split(":")
pfx_parts =":")
if len(mac_parts) != 6:
sys.stderr.write("%s is not a valid MAC-48 address\n" % mac)
eui64 = mac_parts[:3] + [ "ff", "fe" ] + mac_parts[3:]
eui64[0] = "%02x" % (int(eui64[0], 16) ^ 0x02)
ip = ":".join(pfx_parts[:4])
for l in range(0, len(eui64), 2):
ip += ":%s" % "".join(eui64[l:l+2])
print IP(ip).strCompressed()
except ValueError, e:
sys.stderr.write("Ooops, something went wrong: '%s'!\n" % str(e))
# vim: set ts=4 sts=4 sw=4 et ai :
......@@ -36,7 +36,6 @@ logic/ for a description of reconciliation rules.
import sys
import datetime
import subprocess
from optparse import make_option
......@@ -45,6 +44,7 @@ from import BaseCommand, CommandError
from synnefo.db.models import VirtualMachine, Network, pooled_rapi_client
from synnefo.logic import reconciliation, utils
from synnefo.logic import backend as backend_mod
from synnefo.util.mac2eui64 import mac2eui64
from import get_backend
......@@ -274,9 +274,3 @@ class Command(BaseCommand):
backend_mod.process_net_status(vm=vm, etime=event_time,
print >> sys.stderr, " ...done"
def mac2eui64(mac, prefixstr):
process = subprocess.Popen(["mac2eui64", mac, prefixstr],
......@@ -43,8 +43,6 @@ These are the individual Ganeti hooks for Synnefo.
import sys
import os
import subprocess
import json
import socket
import logging
......@@ -54,12 +52,7 @@ from time import time
from synnefo import settings
from synnefo.lib.amqp import AMQPClient
from synnefo.lib.utils import split_time
def mac2eui64(mac, prefixstr):
process = subprocess.Popen(["mac2eui64", mac, prefixstr],
from synnefo.util.mac2eui64 import mac2eui64
def ganeti_net_status(logger, environ):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment