From 9885cf4fb076d1236bc26b2346b84351f90efc7d Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 1 May 2014 15:07:25 -0700 Subject: [PATCH] CLOUDSTACK-6438: WIP: Add filtering to check against existing IPs --- ui/scripts/network.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 10d5a05e581..abfaac322a7 100755 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -3393,9 +3393,23 @@ $(nics).map(function (index, nic) { if (nic.secondaryip) { - notExisting = true; + var targetIPs = $(nic.secondaryip).map(function (index, sip) { + return sip.ipaddress; + }); - return false; + var lbIPs = $(itemData).map(function(index, item) { return item.itemIp; }); + + targetIPs.push(nic.ipaddress); + + var matchingIPs = $.grep(targetIPs, function(item) { + return $.inArray(item, lbIPs) > -1; + }); + + if (targetIPs.length - matchingIPs.length) { + notExisting = true; + + return false; + } } }); }