Revision 29cf98c9
b/snf-cyclades-app/synnefo/app_settings/default/ui.py | ||
---|---|---|
170 | 170 |
# network with dhcp enabled |
171 | 171 |
UI_NETWORK_AVAILABLE_SUBNETS = ['10.0.0.0/24', '192.168.0.0/24'] |
172 | 172 |
|
173 |
# UI will use this setting to find an available network subnet if user requests |
|
174 |
# automatic subnet selection. |
|
175 |
UI_AUTOMATIC_NETWORK_RANGE_FORMAT = "192.168.%d.0/24" |
|
176 |
|
|
173 | 177 |
# Whether to display already connected vm's to the network connect overlay |
174 | 178 |
UI_NETWORK_ALLOW_DUPLICATE_VM_NICS = False |
175 | 179 |
|
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_networks_view.js | ||
---|---|---|
314 | 314 |
|
315 | 315 |
return true; |
316 | 316 |
}, |
317 |
|
|
318 |
get_next_available_subnet: function() { |
|
319 |
var auto_tpl = synnefo.config.automatic_network_range_format; |
|
320 |
if (!auto_tpl) { |
|
321 |
return null |
|
322 |
} |
|
323 |
var index = 0; |
|
324 |
var subnet = auto_tpl.format(index); |
|
325 |
var networks = synnefo.storage.networks; |
|
326 |
var check_existing = function(n) { return n.get('cidr') == subnet } |
|
327 |
while (networks.filter(check_existing).length > 0 && index <= 255) { |
|
328 |
index++; |
|
329 |
subnet = auto_tpl.format(index); |
|
330 |
} |
|
331 |
return subnet; |
|
332 |
}, |
|
317 | 333 |
|
318 | 334 |
create: function() { |
319 | 335 |
this.create_button.addClass("in-progress"); |
... | ... | |
329 | 345 |
if (this.subnet_select.val() == "custom") { |
330 | 346 |
subnet = this.subnet_custom.val(); |
331 | 347 |
} else if (this.subnet_select.val() == "auto") { |
332 |
subnet = null;
|
|
348 |
subnet = this.get_next_available_subnet()
|
|
333 | 349 |
} else { |
334 | 350 |
subnet = this.subnet_select.val(); |
335 | 351 |
} |
b/snf-cyclades-app/synnefo/ui/templates/home.html | ||
---|---|---|
629 | 629 |
synnefo.config.group_public_networks = {{ group_public_networks }}; |
630 | 630 |
synnefo.config.grouped_public_network_name = {{ grouped_public_network_name|safe }}; |
631 | 631 |
synnefo.config.vm_hostname_format = {{ vm_hostname_format|safe }}; |
632 |
synnefo.config.automatic_network_range_format = {{ automatic_network_range_format|safe }}; |
|
632 | 633 |
|
633 | 634 |
synnefo.auth_client = new synnefo.auth.AstakosClient({ |
634 | 635 |
login_url: synnefo.config.login_redirect, |
b/snf-cyclades-app/synnefo/ui/views.py | ||
---|---|---|
138 | 138 |
'UI_NETWORK_STRICT_DESTROY', False) |
139 | 139 |
NETWORK_ALLOW_MULTIPLE_DESTROY = getattr(settings, |
140 | 140 |
'UI_NETWORK_ALLOW_MULTIPLE_DESTROY', False) |
141 |
AUTOMATIC_NETWORK_RANGE_FORMAT = getattr(settings, |
|
142 |
'UI_AUTOMATIC_NETWORK_RANGE_FORMAT', |
|
143 |
"192.168.%d.0/24").replace("%d", "{0}") |
|
141 | 144 |
GROUP_PUBLIC_NETWORKS = getattr(settings, 'UI_GROUP_PUBLIC_NETWORKS', True) |
142 | 145 |
GROUPED_PUBLIC_NETWORK_NAME = getattr(settings, 'UI_GROUPED_PUBLIC_NETWORK_NAME', 'Internet') |
143 | 146 |
|
... | ... | |
199 | 202 |
'network_allow_duplicate_vm_nics': json.dumps(NETWORK_DUPLICATE_NICS), |
200 | 203 |
'network_strict_destroy': json.dumps(NETWORK_STRICT_DESTROY), |
201 | 204 |
'network_allow_multiple_destroy': json.dumps(NETWORK_ALLOW_MULTIPLE_DESTROY), |
205 |
'automatic_network_range_format': json.dumps(AUTOMATIC_NETWORK_RANGE_FORMAT), |
|
202 | 206 |
'grouped_public_network_name': json.dumps(GROUPED_PUBLIC_NETWORK_NAME), |
203 | 207 |
'group_public_networks': json.dumps(GROUP_PUBLIC_NETWORKS), |
204 | 208 |
'diagnostics_update_interval': json.dumps(DIAGNOSTICS_UPDATE_INTERVAL), |
Also available in: Unified diff