Commit 691862c0 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

ui: Hotplug aware ip/network actions

disable port/network connect/disconnect on active vms when ganeti hotplug
is disabled
parent c02d3a8c
......@@ -1123,6 +1123,7 @@
},
can_connect: function() {
if (synnefo.config.hotplug_enabled && this.is_active()) { return false }
return _.contains(["ACTIVE", "STOPPED"], this.get("status")) &&
!this.get('suspended')
},
......
......@@ -372,6 +372,10 @@
if ((!network || network.get('is_public')) && (network && !network.get('is_floating'))) {
return false
}
var vm_active = this.get('vm') && this.get('vm').is_active();
if (synnefo.config.hotplug_enabled && vm_active) {
return false;
}
var status_ok = _.contains(['DOWN', 'ACTIVE', 'CONNECTED'],
this.get('status'));
var vm_status_ok = this.get('vm') && this.get('vm').can_connect();
......
......@@ -622,7 +622,7 @@
synnefo.config.vm_name_template = {{ vm_name_template|safe }};
synnefo.config.flavors_disk_templates_info = {{ flavors_disk_templates_info|safe }};
synnefo.config.vm_image_common_metadata = {{ vm_image_common_metadata|safe }};
synnefo.config.private_networks_nic_hotplug = {{ private_networks_nic_hotplug|safe }};
synnefo.config.hotplug_enabled = {{ hotplug_enabled|safe }};
synnefo.config.diagnostics_update_interval = {{ diagnostics_update_interval }};
// override diagnostic messages display
......
......@@ -147,9 +147,6 @@ NETWORK_DUPLICATE_NICS = \
NETWORK_STRICT_DESTROY = \
getattr(settings,
'UI_NETWORK_STRICT_DESTROY', False)
PRIVATE_NETWORKS_NIC_HOTPLUG = \
getattr(settings,
'UI_PRIVATE_NETWORK_NIC_HOTPLUG', False)
NETWORK_ALLOW_MULTIPLE_DESTROY = \
getattr(settings,
'UI_NETWORK_ALLOW_MULTIPLE_DESTROY', False)
......@@ -167,6 +164,10 @@ DEFAULT_FORCED_SERVER_NETWORKS = \
FORCED_SERVER_NETWORKS = getattr(settings, "UI_FORCED_SERVER_NETWORKS",
DEFAULT_FORCED_SERVER_NETWORKS)
DEFAULT_HOTPLUG_ENABLED = getattr(settings, "CYCLADES_GANETI_USE_HOTPLUG",
True)
HOTPLUG_ENABLED = getattr(settings, "UI_HOTPLUG_ENABLED",
DEFAULT_HOTPLUG_ENABLED)
def template(name, request, context):
template_path = os.path.join(os.path.dirname(__file__), "templates/")
......@@ -243,8 +244,7 @@ def home(request):
json.dumps(AUTOMATIC_NETWORK_RANGE_FORMAT),
'grouped_public_network_name': json.dumps(GROUPED_PUBLIC_NETWORK_NAME),
'group_public_networks': json.dumps(GROUP_PUBLIC_NETWORKS),
'private_networks_nic_hotplug':
json.dumps(PRIVATE_NETWORKS_NIC_HOTPLUG),
'hotplug_enabled': json.dumps(HOTPLUG_ENABLED),
'diagnostics_update_interval': json.dumps(DIAGNOSTICS_UPDATE_INTERVAL),
'no_fqdn_message': json.dumps(NO_FQDN_MESSAGE)
}
......
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