Revision 14402edc snf-cyclades-app/synnefo/api/floating_ips.py
b/snf-cyclades-app/synnefo/api/floating_ips.py | ||
---|---|---|
140 | 140 |
"""Allocate a floating IP.""" |
141 | 141 |
req = utils.get_request_dict(request) |
142 | 142 |
floating_ip_dict = api.utils.get_attribute(req, "floatingip", |
143 |
required=True) |
|
143 |
required=True, attr_type=dict)
|
|
144 | 144 |
log.info('allocate_floating_ip %s', req) |
145 | 145 |
|
146 | 146 |
userid = request.user_uniq |
... | ... | |
148 | 148 |
# the network_pool is a mandatory field |
149 | 149 |
network_id = api.utils.get_attribute(floating_ip_dict, |
150 | 150 |
"floating_network_id", |
151 |
required=False) |
|
151 |
required=False, |
|
152 |
attr_type=(basestring, int)) |
|
152 | 153 |
if network_id is None: |
153 | 154 |
floating_ip = ips.create_floating_ip(userid) |
154 | 155 |
else: |
... | ... | |
161 | 162 |
non_deleted=True) |
162 | 163 |
address = api.utils.get_attribute(floating_ip_dict, |
163 | 164 |
"floating_ip_address", |
164 |
required=False) |
|
165 |
required=False, |
|
166 |
attr_type=basestring) |
|
165 | 167 |
floating_ip = ips.create_floating_ip(userid, network, address) |
166 | 168 |
|
167 | 169 |
log.info("User '%s' allocated floating IP '%s'", userid, floating_ip) |
Also available in: Unified diff