Commit 5b717d38 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Some verbla fixes to snf-manage commands

parent 4101131b
......@@ -44,10 +44,9 @@ class Command(BaseCommand):
option_list = BaseCommand.option_list + (
help="The ID of the floating IP pool(network) to allocate the"
" address from"),
help="The ID of the network to allocate the address from"),
......@@ -64,7 +63,7 @@ class Command(BaseCommand):
if args:
raise CommandError("Command doesn't accept any arguments")
network_id = options['pool']
network_id = options['network_id']
address = options['address']
owner = options['owner']
......@@ -74,6 +73,9 @@ class Command(BaseCommand):
if network_id is not None:
network = util.get_network(network_id, owner, for_update=True,
if not network.floating_ip_pool:
raise CommandError("Network '%s' is not a floating IP pool."
% network)
network = None
......@@ -48,7 +48,7 @@ class Command(ListCommand):
filters = {'floating_ip': True}
def get_machine(ip):
def get_server(ip):
return ip.nic.machine_id
except AttributeError:
......@@ -58,10 +58,10 @@ class Command(ListCommand):
"id": ("id", "Floating IP UUID"),
"user.uuid": ("userid", "The UUID of the server's owner"),
"address": ("address", "IP Address"),
"pool": ("network", "Floating IP Pool (network)"),
"machine": (get_machine, "VM using this Floating IP"),
"network": ("network_id", "Network ID"),
"server": (get_server, "Server using this Floating IP"),
"created": ("created", "Datetime this IP was reserved"),
"deleted": ("deleted", "If the floating IP is deleted"),
fields = ["id", "address", "pool", "user.uuid", "machine", "created"]
fields = ["id", "address", "network", "user.uuid", "server", "created"]
......@@ -149,12 +149,14 @@ class Command(BaseCommand):
ipaddress = None
floating_ip_id = options["floating_ip_id"]
ipv4_address = options["ipv4_address"]
if ipv4_address is not None and floating_ip_id is not None:
raise CommandError("Please use either --floating-ip-id or"
" --ipv4-address option")
elif floating_ip_id:
if floating_ip_id:
ipaddress = common.get_floating_ip_by_id(floating_ip_id,
if ipv4_address is not None and ipaddress.address != ipv4_address:
raise CommandError("Floating IP address '%s' is different from"
" specified address '%s'" %
(ipaddress.address, ipv4_address))
# validate security groups
sg_list = []
......@@ -73,7 +73,7 @@ class Command(ListCommand):
"name": ("name", "The name of the port"),
"user.uuid": ("userid", "The UUID of the port's owner"),
"mac_address": ("mac", "The MAC address of the port"),
"device_id": ("machine_id", "The vm's id the port is conncted to"),
"server_id": ("machine_id", "The vm's id the port is conncted to"),
"state": ("state", "The port's status"),
"device_owner": ("device_owner", "The owner of the port (vm/router)"),
"network": ("network_id", "The network's ID the port is\
......@@ -85,7 +85,7 @@ class Command(ListCommand):
fields = ["id", "name", "user.uuid", "mac_address", "network",
"device_id", "fixed_ips", "state"]
"server_id", "fixed_ips", "state"]
def handle_args(self, *args, **options):
if options["public"]:
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