Nexus vSwitch UI support

Implement ability to add and modify Nexus vSwitches at the cluster
level:

-Add new fields to add cluster form, to allow addition of a vSwitch

-Add new tab to VMware clusters to list cluster's vSwitch

-Add details panel to vSwitch allowing enable, disable, and removal of
 vSwitch from cluster
This commit is contained in:
Brian Federle 2012-05-16 14:58:20 -07:00
parent a10a07c09e
commit 889cfb11d9
3 changed files with 224 additions and 2 deletions

View File

@ -1,4 +1,12 @@
#new labels (begin) **********************************************************************************************
label.nexusVswitch=Nexus Vswitch
label.action.delete.nexusVswitch=Delete NexusVswitch
label.action.enable.nexusVswitch=Enable NexusVswitch
label.action.disable.nexusVswitch=Disable NexusVswitch
label.action.list.nexusVswitch=List NexusVswitch
message.action.delete.nexusVswitch=Please confirm that you want to delete this nexusVswitch.
message.action.enable.nexusVswitch=Please confirm that you want to enable this nexusVswitch.
message.action.disable.nexusVswitch=Please confirm that you want to disable this nexusVswitch.
message.specify.url=Please specify URL
label.select.instance.to.attach.volume.to=Select instance to attach volume to
label.upload=Upload

View File

@ -2108,6 +2108,9 @@ dictionary = {
'label.action.edit.network': '<fmt:message key="label.action.edit.network" />',
'label.action.delete.network.processing': '<fmt:message key="label.action.delete.network.processing" />',
'label.action.delete.network': '<fmt:message key="label.action.delete.network" />',
'label.action.delete.nexusVswitch': '<fmt:message key="label.action.delete.nexusVswitch" />',
'label.action.enable.nexusVswitch': '<fmt:message key="label.action.enable.nexusVswitch" />',
'label.action.disable.nexusVswitch': '<fmt:message key="label.action.disable.nexusVswitch" />',
'label.action.delete.pod.processing': '<fmt:message key="label.action.delete.pod.processing" />',
'label.action.delete.pod': '<fmt:message key="label.action.delete.pod" />',
'label.action.delete.primary.storage.processing': '<fmt:message key="label.action.delete.primary.storage.processing" />',
@ -2313,6 +2316,7 @@ dictionary = {
'label.description': '<fmt:message key="label.description" />',
'label.detaching.disk': '<fmt:message key="label.detaching.disk" />',
'label.details': '<fmt:message key="label.details" />',
'label.nexusVswitch': '<fmt:message key="label.nexusVswitch" />',
'label.device.id': '<fmt:message key="label.device.id" />',
'label.disabled': '<fmt:message key="label.disabled" />',
'label.disabling.vpn.access': '<fmt:message key="label.disabling.vpn.access" />',
@ -2682,6 +2686,7 @@ dictionary = {
'message.action.delete.external.load.balancer': '<fmt:message key="message.action.delete.external.load.balancer" />',
'message.action.delete.ingress.rule': '<fmt:message key="message.action.delete.ingress.rule" />',
'message.action.delete.network': '<fmt:message key="message.action.delete.network" />',
'message.action.delete.nexusVswitch': '<fmt:message key="message.action.delete.nexusVswitch" />',
'message.action.delete.pod': '<fmt:message key="message.action.delete.pod" />',
'message.action.delete.primary.storage': '<fmt:message key="message.action.delete.primary.storage" />',
'message.action.delete.secondary.storage': '<fmt:message key="message.action.delete.secondary.storage" />',

View File

@ -6101,6 +6101,7 @@
$form.find('.form-item[rel=vCenterUsername]').css('display', 'inline-block');
$form.find('.form-item[rel=vCenterPassword]').css('display', 'inline-block');
$form.find('.form-item[rel=vCenterDatacenter]').css('display', 'inline-block');
$form.find('.form-item[rel=enableNexusVswitch]').css('display', 'inline-block');
//$("#cluster_name_label", $dialogAddCluster).text("vCenter Cluster:");
}
@ -6110,6 +6111,11 @@
$form.find('.form-item[rel=vCenterUsername]').css('display', 'none');
$form.find('.form-item[rel=vCenterPassword]').css('display', 'none');
$form.find('.form-item[rel=vCenterDatacenter]').css('display', 'none');
$form.find('.form-item[rel=enableNexusVswitch]').css('display', 'none');
$('.form-item[rel=enableNexusVswitch] input').attr('checked', false);
$form.find('.form-item[rel=nexusVswitchIpAddress]').css('display', 'none');
$form.find('.form-item[rel=nexusVswitchUsername]').css('display', 'none');
$form.find('.form-item[rel=nexusVswitchPassword]').css('display', 'none');
//$("#cluster_name_label", $dialogAddCluster).text("Cluster:");
}
@ -6160,6 +6166,29 @@
vCenterDatacenter: {
label: 'label.vcenter.datacenter',
validation: { required: true }
},
enableNexusVswitch: {
label: 'Add Nexus vSwitch',
isBoolean: true
},
vsmipaddress: {
label: 'vSwitch IP Address',
dependsOn: 'enableNexusVswitch',
validation: { required: true },
isHidden: true
},
vsmusername: {
label: 'vSwitch Username',
dependsOn: 'enableNexusVswitch',
validation: { required: true },
isHidden: true
},
vsmpassword: {
label: 'vSwitch Password',
dependsOn: 'enableNexusVswitch',
validation: { required: true },
isPassword: true,
isHidden: true
}
//hypervisor==VMWare ends here
}
@ -6184,6 +6213,12 @@
array1.push("&username=" + todb(args.data.vCenterUsername));
array1.push("&password=" + todb(args.data.vCenterPassword));
if (args.data.enableNexusVswitch) {
array1.push('&vsmipaddress=' + args.data.vsmipaddress);
array1.push('&vsmusername=' + args.data.vsmusername);
array1.push('&vsmpassword=' + args.data.vsmpassword);
}
var hostname = args.data.vCenterHost;
var dcName = args.data.vCenterDatacenter;
@ -6229,6 +6264,24 @@
detailView: {
viewAll: { path: '_zone.hosts', label: 'label.hosts' },
isMaximized:true,
tabFilter: function(args) {
var vSwichConfigEnabled, vSwitchPresentOnCluster;
$.ajax({
url: createURL('listConfigurations'),
data: { name: 'vmware.use.nexus.vswitch' },
async: false,
success: function(json) {
vSwichConfigEnabled = json.listconfigurationsresponse.configuration[0].value;
}
});
var hypervisorType = args.context.clusters[0].hypervisortype;
if(vSwichConfigEnabled != "true" || hypervisorType != 'VMware') {
return ['nexusVswitch'];
}
return [];
},
actions: {
enable: {
@ -6248,7 +6301,8 @@
async: true,
success: function(json) {
var item = json.updateclusterresponse.cluster;
addExtraPropertiesToClusterObject(item);
args.context.clusters[0].state = item.allocationstate;
addExtraPropertiesToClusterObject(item);
args.response.success({
actionFilter: clusterActionfilter,
data:item
@ -6280,7 +6334,8 @@
async: true,
success: function(json) {
var item = json.updateclusterresponse.cluster;
addExtraPropertiesToClusterObject(item);
args.context.clusters[0].state = item.allocationstate;
addExtraPropertiesToClusterObject(item);
args.response.success({
actionFilter: clusterActionfilter,
data:item
@ -6417,6 +6472,160 @@
}
});
}
},
nexusVswitch: {
title:'label.nexusVswitch',
listView: {
id: 'vSwitches',
fields: {
vsmdeviceid: { label: 'label.name' },
type: { label: 'label.type' },
zonename: { label: 'label.zone' },
state: { label: 'label.status' }
},
detailView: {
actions: {
enable: {
label: 'label.action.enable.nexusVswitch',
messages: {
confirm: function(args) {
return 'message.action.enable.nexusVswitch';
},
notification: function(args) {
return 'label.action.enable.nexusVswitch';
}
},
action: function(args) {
$.ajax({
url: createURL("enableCiscoNexusVSM&id=" + args.context.vSwitches[0].vsmdeviceid),
dataType: "json",
async: true,
success: function(json) {
var item = json.getciscovsmbyclusteridcmdresponse.cisconexusvsm;
args.context.clusters[0].state = item.allocationstate;
addExtraPropertiesToClusterObject(item);
args.response.success({
actionFilter: podActionfilter,
data:item
});
}
});
},
notification: {
poll: function(args) {
args.complete();
}
}
},
disable: {
label: 'label.action.disable.nexusVswitch',
messages: {
confirm: function(args) {
return 'message.action.disable.nexusVswitch';
},
notification: function(args) {
return 'label.action.disable.nexusVswitch';
}
},
action: function(args) {
$.ajax({
url: createURL("disableCiscoNexusVSM&id=" + args.context.vSwitches[0].vsmdeviceid ),
dataType: "json",
async: true,
success: function(json) {
var item = json.getciscovsmbyclusteridcmdresponse.cisconexusvsm;
args.context.clusters[0].state = item.allocationstate;
addExtraPropertiesToClusterObject(item);
args.response.success({
actionFilter: podActionfilter,
data:item
});
}
});
},
notification: {
poll: function(args) {
args.complete();
}
}
},
'remove': {
label: 'label.action.delete.nexusVswitch' ,
messages: {
confirm: function(args) {
return 'message.action.delete.nexusVswitch';
},
notification: function(args) {
return 'label.action.delete.nexusVswitch';
}
},
action: function(args) {
$.ajax({
url: createURL("deleteCiscoNexusVSM&id=" + args.context.vSwitches[0].vsmdeviceid),
dataType: "json",
async: true,
success: function(json) {
args.response.success({data:{}});
}
});
},
notification: {
poll: function(args) { args.complete(); }
}
}
},
tabs: {
details: {
title: 'label.details',
fields: {
name: { label: 'label.name' },
type: { label: 'label.type' },
zonename: { label: 'label.zone' },
state: { label: 'label.status' }
},
dataProvider: function(args) {
$.ajax({
url: createURL("listClusters&id=" + args.context.clusters[0].id),
dataType: "json",
success: function(json) {
var item = json.listclustersresponse.cluster[0];
addExtraPropertiesToClusterObject(item);
args.response.success({
actionFilter: clusterActionfilter,
data: item
});
},
error: function(json) {
args.response.error(parseXMLHttpResponse(json));
}
});
}
}
}
},
dataProvider: function(args) {
$.ajax({
url: createURL("getCiscoVSMByClusterId&id=" + args.context.clusters[0].id),
dataType: "json",
success: function(json) {
var item = json.getciscovsmbyclusteridcmdresponse.cisconexusvsm;
args.response.success({
actionFilter: clusterActionfilter,
data: item
});
},
error: function(json) {
// Not generally a real error; means vSwitch still needs setup
args.response.success({ data: [] });
}
});
}
}
}
}
}