X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/7c8f43b416a8910eda4af95c7f66e410b95ce5b7..refs/heads/geofft:/code/xen-ips?ds=sidebyside diff --git a/code/xen-ips b/code/xen-ips index 58f3078..b0b8fed 100755 --- a/code/xen-ips +++ b/code/xen-ips @@ -1,6 +1,7 @@ #!/usr/bin/python import random from invirt import database +import sqlalchemy.exceptions import sys # stolen directly from xend/server/netif.py @@ -37,9 +38,12 @@ def usage(): print >> sys.stderr, "USAGE: " + sys.argv[0] + " " def addip(ip): - n = database.NIC(machine=None, mac_addr=randomMAC(), ip=ip, hostname=None) - database.session.save(n) - database.session.flush() + try: + n = database.NIC(machine=None, mac_addr=randomMAC(), ip=ip, hostname=None) + database.session.save(n) + database.session.flush() + except sqlalchemy.exceptions.IntegrityError: + pass if __name__ == '__main__':