Remove ipy from nova-manage and use netaddr

This commit is contained in:
Chuck Short
2011-06-06 15:32:48 -04:00
parent 0cbcdfcec0
commit 9b0241441a

View File

@@ -56,11 +56,11 @@
import gettext import gettext
import glob import glob
import json import json
import netaddr
import os import os
import sys import sys
import time import time
import IPy
# If ../nova/__init__.py exists, add ../ to Python search path, so that # If ../nova/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python... # it will override what happens to be installed in /usr/(local/)lib/python...
@@ -513,7 +513,7 @@ class FloatingIpCommands(object):
def create(self, host, range): def create(self, host, range):
"""Creates floating ips for host by range """Creates floating ips for host by range
arguments: host ip_range""" arguments: host ip_range"""
for address in IPy.IP(range): for address in netaddr.IPRange(range):
db.floating_ip_create(context.get_admin_context(), db.floating_ip_create(context.get_admin_context(),
{'address': str(address), {'address': str(address),
'host': host}) 'host': host})
@@ -521,7 +521,7 @@ class FloatingIpCommands(object):
def delete(self, ip_range): def delete(self, ip_range):
"""Deletes floating ips by range """Deletes floating ips by range
arguments: range""" arguments: range"""
for address in IPy.IP(ip_range): for address in netaddr.IPRange(ip_range):
db.floating_ip_destroy(context.get_admin_context(), db.floating_ip_destroy(context.get_admin_context(),
str(address)) str(address))