NeutronConfig+HAConfig

Change-Id: Idd0c6e9d829007eb2e3641a125a46fd6451ce3b5
This commit is contained in:
CongLu 2015-02-09 18:45:27 -08:00 committed by CongLu
parent 56cc825ef4
commit 94130baa44
5 changed files with 344 additions and 61 deletions

View File

@ -90,6 +90,12 @@ compassAppDev.run(function($httpBackend, settings, $http) {
"id": 3,
"template": "multinodes.tmpl",
"name": "multinodes"
}, {
"roles": [],
"display_name": "Multi-node Cluster with HA",
"id": 3,
"template": "ha.tmpl",
"name": "HA-multinodes"
}],
"name": "openstack_icehouse",
"distributed_system_id": 1,

View File

@ -1,4 +1,4 @@
define(['angular','uiBootstrap'], function(ng, uiBootstrap) {
define(['angular', 'uiBootstrap'], function(ng, uiBootstrap) {
var servicesModule = angular.module('compass.services', ['ui.bootstrap']);
// stateService is used for dynamically add/edit state
/* .service('stateService', ['$state',
@ -34,7 +34,7 @@ define(['angular','uiBootstrap'], function(ng, uiBootstrap) {
return $http.post(settings.apiUrlBase + '/users/login', angular.toJson(user));
};
this.logout = function(){
this.logout = function() {
return $http.post(settings.apiUrlBase + '/users/logout', null);
}
@ -246,11 +246,11 @@ define(['angular','uiBootstrap'], function(ng, uiBootstrap) {
};
this.monitorMetricsTagName = function(id, selectedMetrics) {
var metrics = '{"metrics":[{"tags":{},"name":"'+selectedMetrics+'"}],"cache_time":0,"start_absolute":0}';
return $http.post(settings.monitoringUrlBase + '/clusters/'+ id +'/datapointtags',metrics);
var metrics = '{"metrics":[{"tags":{},"name":"' + selectedMetrics + '"}],"cache_time":0,"start_absolute":0}';
return $http.post(settings.monitoringUrlBase + '/clusters/' + id + '/datapointtags', metrics);
};
this.monitorMetricsQuery = function(clusterId,query) {
return $http.post(settings.monitoringUrlBase + '/clusters/'+clusterId+'/datapoints',query);
this.monitorMetricsQuery = function(clusterId, query) {
return $http.post(settings.monitoringUrlBase + '/clusters/' + clusterId + '/datapoints', query);
};
this.monitorMetricsTree = function() {
@ -382,8 +382,7 @@ define(['angular','uiBootstrap'], function(ng, uiBootstrap) {
};
metrics.setEndRelative = function(new_end_relative) {
if(new_end_relative)
{
if (new_end_relative) {
console.log(new_end_relative)
metrics.end_relative.value = new_end_relative.value;
metrics.end_relative.unit = new_end_relative.unit;
@ -461,8 +460,7 @@ define(['angular','uiBootstrap'], function(ng, uiBootstrap) {
return metrics.displayData.length - 1;
};
metrics.updateDisplayData = function(data) {
if(data.errors)
{
if (data.errors) {
alert(data.errors[0]);
return -1;
}
@ -505,6 +503,8 @@ define(['angular','uiBootstrap'], function(ng, uiBootstrap) {
wizard.console_credentials = {};
wizard.network_mapping = {};
wizard.ceph_config = {};
wizard.neutron_config = {};
wizard.ha_config = {};
};
wizard.init();
@ -513,6 +513,9 @@ define(['angular','uiBootstrap'], function(ng, uiBootstrap) {
//wizard.setClusterInfo(config.cluster);
wizard.setInterfaces(config.interface);
wizard.setGeneralConfig(config.general);
// wizard.setNeutronConfig(config.neutron_config);
wizard.setPartition(config.partition);
wizard.setServerCredentials(config.server_credentials);
wizard.setServiceCredentials(config.service_credentials);
@ -521,6 +524,13 @@ define(['angular','uiBootstrap'], function(ng, uiBootstrap) {
if (config.ceph_config) {
wizard.setCephConfig(config.ceph_config);
}
if (config.neutron_config) {
wizard.setNeutronConfig(config.neutron_config);
}
if (config.ha_config) {
wizard.setHighAvailabilityConfig(config.ha_config)
}
};
wizard.setClusterInfo = function(cluster) {
@ -653,19 +663,33 @@ define(['angular','uiBootstrap'], function(ng, uiBootstrap) {
return angular.copy(wizard.ceph_config);
};
wizard.setNeutronConfig = function(neutronConfig) {
wizard.neutron_config = neutronConfig;
}
wizard.getNeutronConfig = function() {
return angular.copy(wizard.neutron_config);
}
wizard.setHighAvailabilityConfig = function(haConfig) {
wizard.ha_config = haConfig;
}
wizard.getHighAvailabilityConfig = function() {
return angular.copy(wizard.ha_config);
}
return wizard;
}
]);
servicesModule.service('authService', ['$http', 'dataService','rememberMe',
function($http, dataService,rememberMe) {
servicesModule.service('authService', ['$http', 'dataService', 'rememberMe',
function($http, dataService, rememberMe) {
this.isAuthenticated = false;
this.setLogin = function(remember) {
this.isAuthenticated = true;
rememberMe.setCookies("isAuthenticated","true",0.0833,Boolean(remember));
rememberMe.setCookies("isAuthenticated", "true", 0.0833, Boolean(remember));
};
this.setLogout = function(){
this.setLogout = function() {
this.isAuthenticated = false;
rememberMe.setCookies("isAuthenticated", "false", -30);
}
@ -675,24 +699,24 @@ define(['angular','uiBootstrap'], function(ng, uiBootstrap) {
};
this.logout = function() {
return dataService.logout();
};
return dataService.logout();
};
}
]);
servicesModule.service('modalService',function($modal){
this.show = function(message){
servicesModule.service('modalService', function($modal) {
this.show = function(message) {
return $modal.open({
templateUrl: 'messagemodal.html',
controller: 'errorHandlingModalController',
resolve:{
message: function(){
resolve: {
message: function() {
return message;
}
}
});
}
});
servicesModule.factory('authenticationInterceptor', ['$q', '$location','$injector',
servicesModule.factory('authenticationInterceptor', ['$q', '$location', '$injector',
function($q, $location, $injector) {
return {
response: function(response) {
@ -702,13 +726,11 @@ define(['angular','uiBootstrap'], function(ng, uiBootstrap) {
if (rejection.status == 401) {
console.log("Response Error 401", rejection);
$location.path('/login');
}
else{
if(rejection.config.url && rejection.config.url != "/api/users/login")
{
} else {
if (rejection.config.url && rejection.config.url != "/api/users/login") {
var modal = $injector.get("modalService");
modal.show(rejection);
}
}
}
return $q.reject(rejection);
@ -737,11 +759,10 @@ define(['angular','uiBootstrap'], function(ng, uiBootstrap) {
var c = ca[i];
while (c.charAt(0) == ' ')
c = c.substring(1);
if (c.indexOf(name) != -1)
{
if (c.indexOf(name) != -1) {
console.log("inside")
return c.substring(name.length, c.length);
}
}
}
return "";

View File

@ -42,7 +42,6 @@
<div class="form-group">
<div>
<label class="col-sm-4 control-label no-padding-right">
HTTP Proxy
<span class="text-danger opacity-zero">*</span>
</label>
<div class="col-sm-8">
@ -65,7 +64,7 @@
<div>
<label class="col-sm-4 control-label no-padding-right">
<span ng-if="$index==0">
No Proxy
No Proxy {{no_proxy}}
<span class="text-danger opacity-zero">*</span>
</span>
</label>

View File

@ -157,7 +157,7 @@
</accordion-heading>
<div class="row">
<div class="col-xs-12">
<form id="cephForm" name="cephForm" class="form-horizontal" role="form">
<form id="form.cephForm" name="form.cephForm" class="form-horizontal" role="form">
<div class="form-group">
<div>
<label class="col-sm-4 control-label no-padding-right">
@ -223,15 +223,15 @@
<input ng-model="cephConfig.osd_devices" type="text" class="col-xs-5 col-sm-2" placeholder="Device" name="device">
<input ng-model="cephConfig.journals" type="text" class="col-xs-5 col-sm-3" placeholder="Journal" name="journal">
<span class="col-xs-2 col-sm-3"-->
<!--Add Action-->
<!--span class="action" ng-click="addValue('dns_servers')">
<!--Add Action-->
<!--span class="action" ng-click="addValue('dns_servers')">
<i class="fa fa-plus-circle bigger-140 blue"></i>
</span-->
<!--Remove Action-->
<!--span ng-show="general.dns_servers.length > 1" class="action" ng-click="general.dns_servers.splice($index,1)">
<!--Remove Action-->
<!--span ng-show="general.dns_servers.length > 1" class="action" ng-click="general.dns_servers.splice($index,1)">
<i class="fa fa-minus-circle bigger-140 blue"></i>
</span-->
<!--/span>
<!--/span>
</div>
</div>
</div-->
@ -241,10 +241,144 @@
</div>
</accordion-group>
<accordion-group ng-if="currentAdapterName == 'ceph_openstack_icehouse' || currentAdapterName == 'openstack_icehouse'">
<accordion-heading>
<i class="ace-icon fa fa-angle-right"></i> Neutron Configuration
</accordion-heading>
<div class="row">
<div class="col-xs-12">
<form id="form.neutronForm" name="form.neutronForm" class="form-horizontal" role="form">
<div class="form-group">
<div>
<label class="col-sm-4 control-label no-padding-right">
Tenant Network Type:
<span class="text-danger">*</span>
</label>
<div class="col-sm-8">
<select ng-init="neutron_config.openvswitch.tenant_network_type='gre'" ng-model="neutron_config.openvswitch.tenant_network_type" name="tenant" class="col-xs-10 col-sm-5">
<option value="gre" ng-selected="neutron_config.openvswitch.tenant_network_type == 'gre'">gre</option>
<option value="vlan" ng-selected="neutron_config.openvswitch.tenant_network_type == 'vlan'">vlan</option>
</select>
</div>
</div>
</div>
<div ng-if="neutron_config.openvswitch.tenant_network_type=='gre'" ng-repeat="tunnel_id in neutron_config.openvswitch.tunnel_id_ranges track by $index">
<div>
<label class="col-sm-4 control-label no-padding-right">
<span ng-if="$index==0">
Tunnel ID Ranges:
<span class="text-danger">*</span>
</span>
</label>
<div class="col-sm-8" style="margin-bottom: 10px;">
<input ng-model="neutron_config.openvswitch.tunnel_id_ranges[$index]" type="text" class="col-xs-10 col-sm-5" placeholder="TunnelID" name="tunnel_id" required>
<span class="col-xs-2 col-sm-3">
<!--Add Action-->
<span class="action" ng-click="addValue('tunnel_id_ranges')">
<i class="fa fa-plus-circle bigger-140 blue"></i>
</span>
<!--Remove Action-->
<span ng-show="neutron_config.openvswitch.tunnel_id_ranges.length > 1" class="action" ng-click="neutron_config.openvswitch.tunnel_id_ranges.splice($index,1)">
<i class="fa fa-minus-circle bigger-140 blue"></i>
</span>
<!-- hint -->
<span style="margin-left: 20px; color: #AEAEAE;">e.g. 1:1000</span>
</span>
</div>
</div>
</div>
<div ng-if="neutron_config.openvswitch.tenant_network_type=='vlan'" ng-repeat="vlan in neutron_config.openvswitch.network_vlan_ranges track by $index">
<div>
<label class="col-sm-4 control-label no-padding-right">
<span ng-if="$index==0">
Network Vlan Ranges:
<span class="text-danger">*</span>
</span>
</label>
<div class="col-sm-8" style="margin-bottom: 10px;">
<input ng-model="neutron_config.openvswitch.network_vlan_ranges[$index]" type="text" class="col-xs-10 col-sm-5" placeholder="VlanRanges" name="vlan" required>
<span class="col-xs-2 col-sm-3">
<!--Add Action-->
<span class="action" ng-click="addValue('network_vlan_ranges')">
<i class="fa fa-plus-circle bigger-140 blue"></i>
</span>
<!--Remove Action-->
<span ng-show="neutron_config.openvswitch.network_vlan_ranges.length > 1" class="action" ng-click="neutron_config.openvswitch.network_vlan_ranges.splice($index,1)">
<i class="fa fa-minus-circle bigger-140 blue"></i>
</span>
<!-- hint -->
<span style="margin-left: 20px; color: #AEAEAE;">e.g. physnet1:2700:2999</span>
</span>
</div>
</div>
</div>
<div ng-if="neutron_config.openvswitch.tenant_network_type=='vlan'" ng-repeat="bridge in neutron_config.openvswitch.bridge_mappings track by $index" style="margin-bottom: 10px;">
<div>
<label class="col-sm-4 control-label no-padding-right">
<span ng-if="$index==0">
Bridge Mapping:
<span class="text-danger">*</span>
</span>
</label>
<div class="col-sm-8" style="margin-bottom: 10px;">
<input ng-model="neutron_config.openvswitch.bridge_mappings[$index]" type="text" class="col-xs-10 col-sm-5" placeholder="BridgeMapping" name="bridge_mappings" required>
<span class="col-xs-2 col-sm-3">
<!--Add Action-->
<span class="action" ng-click="addValue('bridge_mappings')">
<i class="fa fa-plus-circle bigger-140 blue"></i>
</span>
<!--Remove Action-->
<span ng-show="neutron_config.openvswitch.bridge_mappings.length > 1" class="action" ng-click="neutron_config.openvswitch.bridge_mappings.splice($index,1)">
<i class="fa fa-minus-circle bigger-140 blue"></i>
</span>
<!-- hint -->
<span style="margin-left: 20px; color: #AEAEAE;">e.g. physnet1:br-eth1</span>
</span>
</div>
</div>
</div>
</form>
</div>
</div>
</accordion-group>
<accordion-group ng-if="currentFlavor == 'HA-multinodes'">
<accordion-heading>
<i class="ace-icon fa fa-angle-right"></i>High Availability Configuration
</accordion-heading>
<div class="row">
<form id="form.haForm" name="form.haForm" class="form-horizontal" role="form">
<div class="form-group">
<div>
<label class="col-sm-4 control-label no-padding-right">
VIP:
<span class="text-danger">*</span>
</label>
<div class="col-sm-8" style="margin-bottom: 10px;">
<input ng-model="ha_config.ha_proxy.vip" type="text" class="col-xs-10 col-sm-5" placeholder="" name="ha" ng-pattern="/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/" required>
<div class="margin-left-14 inline">
<span class="text-danger" ng-show="form.haForm.ha.$dirty && form.haForm.ha.$error.pattern">
Invalid IP Address
</span>
</div>
</div>
</div>
</div>
</form>
</div>
</accordion-group>
</accordion>
</div>
</div>
</div>
</div>
</div>

View File

@ -69,14 +69,12 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
$scope.adapters = adaptersData;
angular.forEach($scope.adapters, function(adapter) {
if (adapter.id == $scope.cluster.adapter_id) {
$scope.currentAdapterName = adapter.name;
}
});
$scope.currentAdapterName = $scope.cluster.adapter_name;
$scope.currentFlavor = $scope.cluster.flavor.name;
// get pre-config data for wizard and set wizard steps based on different adapters
var oldConfig = clusterConfigData;
$scope.steps = [];
if ($stateParams.config == "true") {
dataService.getWizardPreConfig().success(function(data) {
@ -108,7 +106,6 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
if (preConfigData) {
wizardFactory.preConfig(preConfigData);
if (oldConfig.os_config) {
if (oldConfig.os_config.general) {
wizardFactory.setGeneralConfig(oldConfig.os_config.general);
@ -135,6 +132,12 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
if (oldConfig.package_config.ceph_config) {
wizardFactory.setCephConfig(oldConfig.package_config.ceph_config);
}
if (oldConfig.package_config.neutron_config) {
wizardFactory.setNeutronConfig(oldConfig.package_config.neutron_config);
}
if (oldConfig.package_config.ha_config) {
wizardFactory.setNeutronConfig(oldConfig.package_config.ha_config);
}
}
}
});
@ -528,11 +531,14 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
});
wizardModule.controller('globalCtrl', function($scope, wizardFactory, dataService, $q) {
var cluster = wizardFactory.getClusterInfo();
$scope.general = wizardFactory.getGeneralConfig();
$scope.server_credentials = wizardFactory.getServerCredentials();
if (!$scope.general["dns_servers"]) {
$scope.general["dns_servers"] = [""];
}
@ -580,6 +586,8 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
}
});
$scope.commit = function(sendRequest) {
if (!sendRequest) {
var commitState = {
@ -600,6 +608,7 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
}
}
};
if ($scope.generalForm.$valid) {
dataService.updateClusterConfig(cluster.id, osGlobalConfig).success(function(configData) {
wizardFactory.setGeneralConfig($scope.general);
@ -1241,6 +1250,38 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
$scope.service_credentials = angular.copy($scope.originalServiceData);
}
//High Availability Config
$scope.haAccordion = {};
$scope.ha_config = wizardFactory.getHighAvailabilityConfig();
if (!$scope.ha_config["ha_proxy"]) {
$scope.ha_config["ha_proxy"] = {};
$scope.ha_config["ha_proxy"]["vip"] = [""];
}
//Neutron Config
$scope.neutronAccordion = {};
$scope.neutron_config = wizardFactory.getNeutronConfig();
$scope.addValue = function(key) {
$scope.neutron_config.openvswitch[key].push("");
};
if (!$scope.neutron_config["openvswitch"]) {
$scope.neutron_config["openvswitch"] = {};
$scope.neutron_config["openvswitch"]["tunnel_id_ranges"] = [""];
$scope.neutron_config["openvswitch"]["network_vlan_ranges"] = [""];
$scope.neutron_config["openvswitch"]["bridge_mappings"] = [""];
}
// else {
// if (!$scope.neutronConfig["openvswitch"]["tunnel_id_ranges"]) $scope.neutronConfig["openvswitch"]["tunnel_id_ranges"] = [""];
// if (!$scope.neutronConfig["openvswitch"]["network_vlan_ranges"]) $scope.neutronConfig["openvswitch"]["network_vlan_ranges"] = [""];
// if (!$scope.neutronConfig["openvswitch"]["bridge_mapping"]) $scope.neutronConfig["openvswitch"]["bridge_mapping"] = [""];
// if (!$scope.neutronConfig["openvswitch"]["tenant_network_type"]) $scope.neutronConfig["openvswitch"]["tenant_network_type"] = [""];
// }
// console.log($scope.neutronConfig);
// Ceph Config
$scope.cephAccordion = {};
/*$scope.cephConfig = {
@ -1250,6 +1291,24 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
};*/
$scope.cephConfig = wizardFactory.getCephConfig();
// $scope.$watch(function() {
// return wizardFactory.getCommitState()
// }, function(newCommitState, oldCommitState) {
// if (newCommitState !== undefined) {
// if (newCommitState.state == "triggered") {
// $scope.commit(newCommitState.sendRequest);
// }
// }
// });
$scope.form = {};
$scope.commit = function(sendRequest) {
if (!sendRequest) {
var commitState = {
@ -1269,28 +1328,92 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
}
}
};
if ($scope.currentAdapterName == "ceph_openstack_icehouse") {
targetSysConfigData["package_config"]["ceph_config"] = $scope.cephConfig;
if ($scope.currentAdapterName == "ceph_openstack_icehouse" || $scope.currentAdapterName == "openstack_icehouse") {
if ($scope.currentAdapterName == "ceph_openstack_icehouse") {
targetSysConfigData["package_config"]["ceph_config"] = $scope.cephConfig;
}
if ($scope.currentAdapterName == "openstack_icehouse" && $scope.currentFlavor == "HA-multinodes") {
targetSysConfigData["package_config"]["ha_proxy"] = {};
targetSysConfigData["package_config"]["ha_proxy"]["vip"] = $scope.ha_config.ha_proxy.vip;
}
targetSysConfigData["package_config"]["neutron_config"] = {};
targetSysConfigData["package_config"]["neutron_config"]["openvswitch"] = {};
if ($scope.neutron_config.openvswitch.tenant_network_type == "gre") {
targetSysConfigData["package_config"]["neutron_config"]["openvswitch"]["tenant_network_type"] = "gre";
targetSysConfigData["package_config"]["neutron_config"]["openvswitch"]["tunnel_id_ranges"] = $scope.neutron_config.openvswitch.tunnel_id_ranges;
}
if ($scope.neutron_config.openvswitch.tenant_network_type == "vlan") {
targetSysConfigData["package_config"]["neutron_config"]["openvswitch"]["tenant_network_type"] = "vlan";
targetSysConfigData["package_config"]["neutron_config"]["openvswitch"]["network_vlan_ranges"] = $scope.neutron_config.openvswitch.network_vlan_ranges;
targetSysConfigData["package_config"]["neutron_config"]["openvswitch"]["bridge_mappings"] = $scope.neutron_config.openvswitch.bridge_mappings;
}
}
if ($scope.currentAdapterName == "ceph_firefly") {
targetSysConfigData["package_config"] = {};
targetSysConfigData["package_config"]["ceph_config"] = $scope.cephConfig;
}
dataService.updateClusterConfig(cluster.id, targetSysConfigData).success(function(data) {
var commitState = {
"name": "package_config",
"state": "success",
"message": ""
};
wizardFactory.setCommitState(commitState);
}).error(function(response) {
var commitState = {
"name": "package_config",
"state": "error",
"message": response
};
wizardFactory.setCommitState(commitState);
$scope.areValid = true;
$scope.notValidformName = "";
angular.forEach($scope.form, function(formdt, key) {
if ($scope.form[key].$valid == false) {
$scope.areValid = false;
$scope.notValidformName = key;
}
});
if ($scope.areValid) {
dataService.updateClusterConfig(cluster.id, targetSysConfigData).success(function(data) {
wizardFactory.setNeutronConfig($scope.neutron_config);
wizardFactory.setHighAvailabilityConfig($scope.ha_config);
var commitState = {
"name": "package_config",
"state": "success",
"message": ""
};
wizardFactory.setCommitState(commitState);
}).error(function(response) {
var commitState = {
"name": "package_config",
"state": "error",
"message": response
};
wizardFactory.setCommitState(commitState);
});
} else {
var message = {};
if ($scope.form[$scope.notValidformName].$error.required) {
message = {
"message": "The required(*) fields are empty!"
};
} else if ($scope.form[$scope.notValidformName].$error.pattern) {
message = {
"message": "The required(*) fields are not in correct patterns!"
};
}
var commitState = {
"name": "package_config",
"state": "invalid",
"message": message
};
wizardFactory.setCommitState(commitState);
}
};
});
@ -1964,4 +2087,4 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
}, true);
};
});
});