Skip to content

Commit c2c511e

Browse files
author
Jessica Wang
committed
CLOUDSTACK-6694: UI > VPC section > Internal LB tier > Intenral LB > select an internal LB from listing > Details tab > Assigned VMs tab > Assign VMs > change to use vmidipmap parameter instead of virtualmachineids parameter when calling assignToLoadBalancer API.
1 parent f9d7a12 commit c2c511e

1 file changed

Lines changed: 45 additions & 6 deletions

File tree

ui/scripts/vpc.js

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@
762762
});
763763
}
764764
}),
765-
action: function(args) {
765+
action: function(args) { //UI > Network menu > VPC section > select and configure a VPC from listing > select an internal LB tier > click Internal LB > Quickview on an internal LB rule from listing > click Assign VMs button > Select VM dailog
766766
var vms = args.context.instances;
767767
var array1 = [];
768768
for (var i = 0; i < vms.length; i++) {
@@ -1054,7 +1054,7 @@
10541054
});
10551055
}
10561056
}),
1057-
action: function(args) {
1057+
action: function(args) { //UI > Network menu > VPC section > select and configure a VPC from listing > select an internal LB tier > click Internal LB > select an internal LB rule from listing > Details tab > click Assigned VMs tab > click Assign VMs button > Select VM dailog
10581058
var $rows = $(':ui-dialog .list-view tbody tr');
10591059
var vms = args.context.instances;
10601060

@@ -1067,18 +1067,57 @@
10671067
$.extend(vm, { _subselect: $vmRow.find('.subselect select').val() });
10681068
});
10691069

1070+
/*
10701071
var array1 = [];
10711072
for (var i = 0; i < vms.length; i++) {
10721073
array1.push(vms[i].id);
10731074
}
10741075
var virtualmachineids = array1.join(',');
1076+
var inputData = {
1077+
id: args.context.internalLoadBalancers[0].id,
1078+
virtualmachineids: virtualmachineids
1079+
};
1080+
*/
1081+
//virtualmachineids parameter has been replaced with vmidipmap parameter, so comment out the lines above.
1082+
1083+
1084+
var inputData = {
1085+
id: args.context.internalLoadBalancers[0].id
1086+
};
1087+
/*
1088+
* e.g. first VM(xxx) has two IPs(10.1.1.~), second VM(yyy) has three IPs(10.2.2.~):
1089+
* vmidipmap[0].vmid=xxx vmidipmap[0].vmip=10.1.1.11
1090+
* vmidipmap[1].vmid=xxx vmidipmap[1].vmip=10.1.1.12
1091+
* vmidipmap[2].vmid=yyy vmidipmap[2].vmip=10.2.2.77
1092+
* vmidipmap[3].vmid=yyy vmidipmap[3].vmip=10.2.2.78
1093+
* vmidipmap[4].vmid=yyy vmidipmap[4].vmip=10.2.2.79
1094+
*/
1095+
var selectedVMs = vms;
1096+
if (selectedVMs != null) {
1097+
var vmidipmapIndex = 0;
1098+
for (var vmIndex = 0; vmIndex < selectedVMs.length; vmIndex++) {
1099+
var selectedIPs = selectedVMs[vmIndex]._subselect;
1100+
for (var ipIndex = 0; ipIndex < selectedIPs.length; ipIndex++) {
1101+
inputData['vmidipmap[' + vmidipmapIndex + '].vmid'] = selectedVMs[vmIndex].id;
1102+
1103+
//"ipAddresses" is not in args.context since this LB rule is under a VPC, not an address.
1104+
/*
1105+
if (args.context.ipAddresses[0].isportable) {
1106+
inputData['vmidipmap[' + vmidipmapIndex + '].vmip'] = selectedIPs[ipIndex].split(',')[1];
1107+
} else {
1108+
inputData['vmidipmap[' + vmidipmapIndex + '].vmip'] = selectedIPs[ipIndex];
1109+
}
1110+
*/
1111+
inputData['vmidipmap[' + vmidipmapIndex + '].vmip'] = selectedIPs[ipIndex];
1112+
1113+
vmidipmapIndex++;
1114+
}
1115+
}
1116+
}
10751117

10761118
$.ajax({
10771119
url: createURL('assignToLoadBalancerRule'),
1078-
data: {
1079-
id: args.context.internalLoadBalancers[0].id,
1080-
virtualmachineids: virtualmachineids
1081-
},
1120+
data: inputData,
10821121
dataType: 'json',
10831122
async: true,
10841123
success: function(data) {

0 commit comments

Comments
 (0)