Merge remote-tracking branch 'rackspace/master' into security_groups_cli

Conflicts:
	novaclient/v1_1/shell.py
This commit is contained in:
Anthony Young 2011-10-14 17:43:57 +00:00
commit ac163b4347
2 changed files with 45 additions and 0 deletions
README.rst
novaclient/v1_1

@ -71,6 +71,7 @@ You'll find complete documentation on the shell by running
Positional arguments: Positional arguments:
<subcommand> <subcommand>
add-fixed-ip Add a new fixed IP address to a servers network. add-fixed-ip Add a new fixed IP address to a servers network.
add-floating-ip Add a floating IP address to a server.
backup Backup a server. backup Backup a server.
backup-schedule Show or edit the backup schedule for a server. backup-schedule Show or edit the backup schedule for a server.
backup-schedule-delete backup-schedule-delete
@ -79,6 +80,9 @@ You'll find complete documentation on the shell by running
delete Immediately shut down and delete a server. delete Immediately shut down and delete a server.
flavor-list Print a list of available 'flavors' (sizes of flavor-list Print a list of available 'flavors' (sizes of
servers). servers).
floating-ip-create Allocate a floating IP to the current tenant.
floating-ip-delete De-allocate a floating IP from the current tenant.
floating-ip-list List allocated floating IPs for the current tenant.
help Display help about this program or one of its help Display help about this program or one of its
subcommands. subcommands.
image-create Create a new image by taking a snapshot of a running image-create Create a new image by taking a snapshot of a running
@ -97,6 +101,7 @@ You'll find complete documentation on the shell by running
reboot Reboot a server. reboot Reboot a server.
rebuild Shutdown, re-image, and re-boot a server. rebuild Shutdown, re-image, and re-boot a server.
remove-fixed-ip Remove an IP address from a server. remove-fixed-ip Remove an IP address from a server.
remove-floating-ip Remove a floating IP address from a server.
rename Rename a server. rename Rename a server.
rescue Rescue a server. rescue Rescue a server.
resize Resize a server. resize Resize a server.

@ -705,6 +705,46 @@ def do_remove_fixed_ip(cs, args):
server.remove_fixed_ip(args.address) server.remove_fixed_ip(args.address)
def _print_floating_ip_list(floating_ips):
utils.print_list(floating_ips, ['Ip', 'Instance Id', 'Fixed Ip'])
@utils.arg('server', metavar='<server>', help='Name or ID of server.')
@utils.arg('address', metavar='<address>', help='IP Address.')
def do_add_floating_ip(cs, args):
"""Add a floating IP address to a server."""
server = _find_server(cs, args.server)
server.add_floating_ip(args.address)
@utils.arg('server', metavar='<server>', help='Name or ID of server.')
@utils.arg('address', metavar='<address>', help='IP Address.')
def do_remove_floating_ip(cs, args):
"""Remove a floating IP address from a server."""
server = _find_server(cs, args.server)
server.remove_floating_ip(args.address)
def do_floating_ip_create(cs, args):
"""Allocate a floating IP for the current tenant."""
_print_floating_ip_list([cs.floating_ips.create()])
@utils.arg('address', metavar='<address>', help='IP of Floating Ip.')
def do_floating_ip_delete(cs, args):
"""De-allocate a floating IP."""
floating_ips = cs.floating_ips.list()
for floating_ip in floating_ips:
if floating_ip.ip == args.address:
return cs.floating_ips.delete(floating_ip.id)
raise exceptions.CommandError("Floating ip %s not found.", args.address)
def do_floating_ip_list(cs, args):
"""List floating ips for this tenant."""
_print_floating_ip_list(cs.floating_ips.list())
def _print_secgroup_rules(rules): def _print_secgroup_rules(rules):
class FormattedRule: class FormattedRule:
def __init__(self, obj): def __init__(self, obj):