Revision 1229a55f
b/snf-cyclades-app/synnefo/logic/management/commands/floating-ip-create.py | ||
---|---|---|
44 | 44 |
|
45 | 45 |
option_list = BaseCommand.option_list + ( |
46 | 46 |
make_option( |
47 |
'--pool', |
|
48 |
dest='pool', |
|
49 |
help="The ID of the floating IP pool(network) to allocate the" |
|
50 |
" address from"), |
|
47 |
'--network', |
|
48 |
dest='network_id', |
|
49 |
help="The ID of the network to allocate the address from"), |
|
51 | 50 |
make_option( |
52 | 51 |
'--address', |
53 | 52 |
dest='address', |
... | ... | |
64 | 63 |
if args: |
65 | 64 |
raise CommandError("Command doesn't accept any arguments") |
66 | 65 |
|
67 |
network_id = options['pool']
|
|
66 |
network_id = options['network_id']
|
|
68 | 67 |
address = options['address'] |
69 | 68 |
owner = options['owner'] |
70 | 69 |
|
... | ... | |
74 | 73 |
if network_id is not None: |
75 | 74 |
network = util.get_network(network_id, owner, for_update=True, |
76 | 75 |
non_deleted=True) |
76 |
if not network.floating_ip_pool: |
|
77 |
raise CommandError("Network '%s' is not a floating IP pool." |
|
78 |
% network) |
|
77 | 79 |
else: |
78 | 80 |
network = None |
79 | 81 |
|
b/snf-cyclades-app/synnefo/logic/management/commands/floating-ip-list.py | ||
---|---|---|
48 | 48 |
astakos_token = CYCLADES_SERVICE_TOKEN |
49 | 49 |
filters = {'floating_ip': True} |
50 | 50 |
|
51 |
def get_machine(ip):
|
|
51 |
def get_server(ip):
|
|
52 | 52 |
try: |
53 | 53 |
return ip.nic.machine_id |
54 | 54 |
except AttributeError: |
... | ... | |
58 | 58 |
"id": ("id", "Floating IP UUID"), |
59 | 59 |
"user.uuid": ("userid", "The UUID of the server's owner"), |
60 | 60 |
"address": ("address", "IP Address"), |
61 |
"pool": ("network", "Floating IP Pool (network)"),
|
|
62 |
"machine": (get_machine, "VM using this Floating IP"),
|
|
61 |
"network": ("network_id", "Network ID"),
|
|
62 |
"server": (get_server, "Server using this Floating IP"),
|
|
63 | 63 |
"created": ("created", "Datetime this IP was reserved"), |
64 | 64 |
"deleted": ("deleted", "If the floating IP is deleted"), |
65 | 65 |
} |
66 | 66 |
|
67 |
fields = ["id", "address", "pool", "user.uuid", "machine", "created"] |
|
67 |
fields = ["id", "address", "network", "user.uuid", "server", "created"] |
b/snf-cyclades-app/synnefo/logic/management/commands/port-create.py | ||
---|---|---|
149 | 149 |
ipaddress = None |
150 | 150 |
floating_ip_id = options["floating_ip_id"] |
151 | 151 |
ipv4_address = options["ipv4_address"] |
152 |
if ipv4_address is not None and floating_ip_id is not None: |
|
153 |
raise CommandError("Please use either --floating-ip-id or" |
|
154 |
" --ipv4-address option") |
|
155 |
elif floating_ip_id: |
|
152 |
if floating_ip_id: |
|
156 | 153 |
ipaddress = common.get_floating_ip_by_id(floating_ip_id, |
157 | 154 |
for_update=True) |
155 |
if ipv4_address is not None and ipaddress.address != ipv4_address: |
|
156 |
raise CommandError("Floating IP address '%s' is different from" |
|
157 |
" specified address '%s'" % |
|
158 |
(ipaddress.address, ipv4_address)) |
|
159 |
|
|
158 | 160 |
|
159 | 161 |
# validate security groups |
160 | 162 |
sg_list = [] |
b/snf-cyclades-app/synnefo/logic/management/commands/port-list.py | ||
---|---|---|
73 | 73 |
"name": ("name", "The name of the port"), |
74 | 74 |
"user.uuid": ("userid", "The UUID of the port's owner"), |
75 | 75 |
"mac_address": ("mac", "The MAC address of the port"), |
76 |
"device_id": ("machine_id", "The vm's id the port is conncted to"),
|
|
76 |
"server_id": ("machine_id", "The vm's id the port is conncted to"),
|
|
77 | 77 |
"state": ("state", "The port's status"), |
78 | 78 |
"device_owner": ("device_owner", "The owner of the port (vm/router)"), |
79 | 79 |
"network": ("network_id", "The network's ID the port is\ |
... | ... | |
85 | 85 |
} |
86 | 86 |
|
87 | 87 |
fields = ["id", "name", "user.uuid", "mac_address", "network", |
88 |
"device_id", "fixed_ips", "state"]
|
|
88 |
"server_id", "fixed_ips", "state"]
|
|
89 | 89 |
|
90 | 90 |
def handle_args(self, *args, **options): |
91 | 91 |
if options["public"]: |
Also available in: Unified diff