CLOUDSTACK-6438: WIP: Add filtering to check against existing IPs
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7daabf65 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7daabf65 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7daabf65 Branch: refs/heads/4.4-forward Commit: 7daabf6515509dc276b968c6ca042cf964a328da Parents: 0b03609 Author: Brian Federle <[email protected]> Authored: Thu May 1 15:07:25 2014 -0700 Committer: Brian Federle <[email protected]> Committed: Thu May 1 15:49:33 2014 -0700 ---------------------------------------------------------------------- ui/scripts/network.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7daabf65/ui/scripts/network.js ---------------------------------------------------------------------- diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 10d5a05..abfaac3 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; + } } }); }
