Merge "fix external nic name miss match bug"

This commit is contained in:
Jenkins 2016-01-12 02:41:24 +00:00 committed by Gerrit Code Review
commit 83f0f26589
2 changed files with 28 additions and 17 deletions

View File

@ -333,6 +333,8 @@ define(['./baseController'], ()->
$scope.updateExternalNetwork = (network_name) -> $scope.updateExternalNetwork = (network_name) ->
nic = $scope.external[network_name] nic = $scope.external[network_name]
try
if $scope.interfaces[nic]
$scope.ips[network_name].cidr = $scope.interfaces[nic].subnet $scope.ips[network_name].cidr = $scope.interfaces[nic].subnet
$scope.ips[network_name].start = $scope.ips[network_name].cidr.split('.').slice(0,3).join('.') + $scope.ips[network_name].start = $scope.ips[network_name].cidr.split('.').slice(0,3).join('.') +
'.' + $scope.ips[network_name].start.split('.')[3] '.' + $scope.ips[network_name].start.split('.')[3]
@ -343,6 +345,8 @@ define(['./baseController'], ()->
'.' + $scope.ips.external.public_vip.split('.')[3] '.' + $scope.ips.external.public_vip.split('.')[3]
$scope.ips.external.gw_ip = $scope.ips[network_name].cidr.split('.').slice(0,3).join('.') + $scope.ips.external.gw_ip = $scope.ips[network_name].cidr.split('.').slice(0,3).join('.') +
'.' + $scope.ips.external.gw_ip.split('.')[3] '.' + $scope.ips.external.gw_ip.split('.')[3]
catch error
console.log(error)
return return
defaultCfg = -> defaultCfg = ->

View File

@ -428,15 +428,22 @@
} }
}; };
$scope.updateExternalNetwork = function(network_name) { $scope.updateExternalNetwork = function(network_name) {
var nic; var error, nic;
nic = $scope.external[network_name]; nic = $scope.external[network_name];
try {
if ($scope.interfaces[nic]) {
$scope.ips[network_name].cidr = $scope.interfaces[nic].subnet; $scope.ips[network_name].cidr = $scope.interfaces[nic].subnet;
}
$scope.ips[network_name].start = $scope.ips[network_name].cidr.split('.').slice(0, 3).join('.') + '.' + $scope.ips[network_name].start.split('.')[3]; $scope.ips[network_name].start = $scope.ips[network_name].cidr.split('.').slice(0, 3).join('.') + '.' + $scope.ips[network_name].start.split('.')[3];
$scope.ips[network_name].end = $scope.ips[network_name].cidr.split('.').slice(0, 3).join('.') + '.' + $scope.ips[network_name].end.split('.')[3]; $scope.ips[network_name].end = $scope.ips[network_name].cidr.split('.').slice(0, 3).join('.') + '.' + $scope.ips[network_name].end.split('.')[3];
if (network_name === 'external') { if (network_name === 'external') {
$scope.ips.external.public_vip = $scope.ips[network_name].cidr.split('.').slice(0, 3).join('.') + '.' + $scope.ips.external.public_vip.split('.')[3]; $scope.ips.external.public_vip = $scope.ips[network_name].cidr.split('.').slice(0, 3).join('.') + '.' + $scope.ips.external.public_vip.split('.')[3];
$scope.ips.external.gw_ip = $scope.ips[network_name].cidr.split('.').slice(0, 3).join('.') + '.' + $scope.ips.external.gw_ip.split('.')[3]; $scope.ips.external.gw_ip = $scope.ips[network_name].cidr.split('.').slice(0, 3).join('.') + '.' + $scope.ips.external.gw_ip.split('.')[3];
} }
} catch (_error) {
error = _error;
console.log(error);
}
}; };
defaultCfg = function() { defaultCfg = function() {
$scope.internal = { $scope.internal = {