change suffices to suffixes

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
Petr Vobornik 2015-11-27 16:16:34 +01:00 committed by Martin Basti
parent 4d24d8b26c
commit 4854850867
3 changed files with 39 additions and 39 deletions

View File

@ -571,15 +571,15 @@ def check_last_link(delrepl, realm, dirman_passwd, force):
return None return None
def map_masters_to_suffices(masters, suffices): def map_masters_to_suffixes(masters, suffixes):
masters_to_suffix = {} masters_to_suffix = {}
suffix_name_to_root = { suffix_name_to_root = {
s['iparepltopoconfroot'][0]: s['cn'][0] for s in suffices s['iparepltopoconfroot'][0]: s['cn'][0] for s in suffixes
} }
for master in masters: for master in masters:
managed_suffices = master['iparepltopomanagedsuffix'] managed_suffixes = master['iparepltopomanagedsuffix']
for suffix in managed_suffices: for suffix in managed_suffixes:
suffix_name = suffix_name_to_root[suffix] suffix_name = suffix_name_to_root[suffix]
try: try:
masters_to_suffix[suffix_name].append(master) masters_to_suffix[suffix_name].append(master)
@ -598,15 +598,15 @@ def check_last_link_managed(api, hostname, masters, force):
""" """
Check if 'hostname' is safe to delete. Check if 'hostname' is safe to delete.
:returns: a dictionary of topology errors across all suffices in the form :returns: a dictionary of topology errors across all suffixes in the form
{<suffix name>: (<original errors>, {<suffix name>: (<original errors>,
<errors after removing the node>)} <errors after removing the node>)}
""" """
suffices = api.Command.topologysuffix_find(u'')['result'] suffixes = api.Command.topologysuffix_find(u'')['result']
suffix_to_masters = map_masters_to_suffices(masters, suffices) suffix_to_masters = map_masters_to_suffixes(masters, suffixes)
topo_errors_by_suffix = {} topo_errors_by_suffix = {}
for suffix in suffices: for suffix in suffixes:
suffix_name = suffix['cn'][0] suffix_name = suffix['cn'][0]
suffix_members = suffix_to_masters[suffix_name] suffix_members = suffix_to_masters[suffix_name]
print("Checking connectivity in topology suffix '{0}'".format( print("Checking connectivity in topology suffix '{0}'".format(
@ -776,7 +776,7 @@ def del_master_managed(realm, hostname, options):
# 2. Get all masters # 2. Get all masters
masters = api.Command.server_find('', sizelimit=0)['result'] masters = api.Command.server_find('', sizelimit=0)['result']
# 3. Check topology connectivity in all suffices # 3. Check topology connectivity in all suffixes
topo_errors = check_last_link_managed( topo_errors = check_last_link_managed(
api, hostname, masters, options.force) api, hostname, masters, options.force)
@ -871,10 +871,10 @@ def check_deleted_segments(hostname, masters, topo_errors, starting_host):
hostname)) hostname))
return return
suffices = api.Command.topologysuffix_find('', sizelimit=0)['result'] suffixes = api.Command.topologysuffix_find('', sizelimit=0)['result']
suffix_to_masters = map_masters_to_suffices(masters, suffices) suffix_to_masters = map_masters_to_suffixes(masters, suffixes)
for suffix in suffices: for suffix in suffixes:
suffix_name = suffix['cn'][0] suffix_name = suffix['cn'][0]
suffix_member_cns = [ suffix_member_cns = [
m['cn'][0] for m in suffix_to_masters[suffix_name] m['cn'][0] for m in suffix_to_masters[suffix_name]

View File

@ -636,7 +636,7 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
} }
}).execute(); }).execute();
when(s_promise, lang.hitch(this, function(results) { when(s_promise, lang.hitch(this, function(results) {
// suffices load success // suffixes load success
var servers = results.data.result.result; var servers = results.data.result.result;
deferred.resolve(servers); deferred.resolve(servers);
}), function(results) { }), function(results) {
@ -648,10 +648,10 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
return deferred.promise; return deferred.promise;
}, },
_get_suffices: function() { _get_suffixes: function() {
var deferred = new Deferred(); var deferred = new Deferred();
function get_suffices() { function get_suffixes() {
return rpc.command({ return rpc.command({
entity: 'topologysuffix', entity: 'topologysuffix',
method: 'find', method: 'find',
@ -672,23 +672,23 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
}).execute(); }).execute();
} }
var suff_promise = get_suffices(); var suff_promise = get_suffixes();
when(suff_promise, lang.hitch(this, function(results) { when(suff_promise, lang.hitch(this, function(results) {
// suffices load success // suffixes load success
var suffices = results.data.result.result; var suffixes = results.data.result.result;
var segment_promises = []; var segment_promises = [];
for (var i=0,l=suffices.length; i<l; i++) { for (var i=0,l=suffixes.length; i<l; i++) {
var suffix = suffices[i]; var suffix = suffixes[i];
var promise = get_segments(suffix['cn'][0]); var promise = get_segments(suffix['cn'][0]);
segment_promises.push(promise); segment_promises.push(promise);
} }
all(segment_promises).then(lang.hitch(this, function(results) { all(segment_promises).then(lang.hitch(this, function(results) {
// segments load success // segments load success
for (var j=0,l=results.length; j<l; j++) { for (var j=0,l=results.length; j<l; j++) {
suffices[j].segments = results[j].data.result.result; suffixes[j].segments = results[j].data.result.result;
} }
deferred.resolve(suffices); deferred.resolve(suffixes);
}), lang.hitch(this, function(results) { }), lang.hitch(this, function(results) {
// segments load failed // segments load failed
deferred.reject({ deferred.reject({
@ -699,7 +699,7 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
}), lang.hitch(this, function(results) { }), lang.hitch(this, function(results) {
// suffix load failed // suffix load failed
deferred.reject({ deferred.reject({
message: 'unable to load suffices', message: 'unable to load suffixes',
results: results results: results
}); });
})); }));
@ -707,7 +707,7 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
return deferred.promise; return deferred.promise;
}, },
_transform_data: function(servers, suffices) { _transform_data: function(servers, suffixes) {
var i,l; var i,l;
var nodes = []; var nodes = [];
@ -736,8 +736,8 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
nodes.push(node); nodes.push(node);
} }
for (i=0,l=suffices.length; i<l; i++) { for (i=0,l=suffixes.length; i<l; i++) {
var suffix = suffices[i]; var suffix = suffixes[i];
for (var j=0,l2=suffix.segments.length; j<l2; j++) { for (var j=0,l2=suffix.segments.length; j<l2; j++) {
var segment = suffix.segments[j]; var segment = suffix.segments[j];
@ -778,7 +778,7 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
var data = { var data = {
nodes: nodes, nodes: nodes,
links: links, links: links,
suffices: suffices suffixes: suffixes
}; };
return data; return data;
@ -788,7 +788,7 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
var deferred = new Deferred(); var deferred = new Deferred();
var segments = this._get_suffices(); var segments = this._get_suffixes();
var masters = this._get_servers(); var masters = this._get_servers();
all([masters, segments]).then(lang.hitch(this, function(raw) { all([masters, segments]).then(lang.hitch(this, function(raw) {
@ -811,13 +811,13 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
this.graph = new topology_graph.TopoGraph({ this.graph = new topology_graph.TopoGraph({
nodes: data.nodes, nodes: data.nodes,
links: data.links, links: data.links,
suffices: data.suffices suffixes: data.suffixes
}); });
this._bind_graph_events(this.graph); this._bind_graph_events(this.graph);
this.graph.initialize(this.visualization_cnt_el); this.graph.initialize(this.visualization_cnt_el);
} else { } else {
this.graph.update(data.nodes, data.links, data.suffices); this.graph.update(data.nodes, data.links, data.suffixes);
} }
}), function(error) { }), function(error) {
IPA.notify(error.message, 'error'); IPA.notify(error.message, 'error');

View File

@ -52,10 +52,10 @@ topology_graph.TopoGraph = declare([Evented], {
links: [], links: [],
/** /**
* List of suffices * List of suffixes
* @property {Array} * @property {Array}
*/ */
suffices: [], suffixes: [],
/** /**
* Initializes the graph * Initializes the graph
@ -63,7 +63,7 @@ topology_graph.TopoGraph = declare([Evented], {
*/ */
initialize: function(container) { initialize: function(container) {
this._create_svg(container); this._create_svg(container);
this.update(this.nodes, this.links, this.suffices); this.update(this.nodes, this.links, this.suffixes);
return; return;
}, },
@ -71,9 +71,9 @@ topology_graph.TopoGraph = declare([Evented], {
* Update the graph * Update the graph
* @param {Array} nodes array of node objects * @param {Array} nodes array of node objects
* @param {Array} links array of link objects * @param {Array} links array of link objects
* @param {Array} suffices array of suffices * @param {Array} suffixes array of suffixes
*/ */
update: function(nodes, links, suffices) { update: function(nodes, links, suffixes) {
// delete all from svg // delete all from svg
this._svg.selectAll("*").remove(); this._svg.selectAll("*").remove();
this._svg.attr('width', this.width) this._svg.attr('width', this.width)
@ -81,7 +81,7 @@ topology_graph.TopoGraph = declare([Evented], {
this.links = links; this.links = links;
this.nodes = nodes; this.nodes = nodes;
this.suffices = suffices; this.suffixes = suffixes;
// load saved coordinates // load saved coordinates
for (var i=0,l=nodes.length; i<l; i++) { for (var i=0,l=nodes.length; i<l; i++) {
@ -239,7 +239,7 @@ topology_graph.TopoGraph = declare([Evented], {
}, },
/** /**
* Defines link arrows and colors of suffices(links) and nodes * Defines link arrows and colors of suffixes(links) and nodes
*/ */
_define_shapes: function() { _define_shapes: function() {
@ -251,9 +251,9 @@ topology_graph.TopoGraph = declare([Evented], {
var x = 10; var x = 10;
var y = 20; var y = 20;
for (var i=0,l=this.suffices.length; i<l; i++) { for (var i=0,l=this.suffixes.length; i<l; i++) {
var suffix = this.suffices[i]; var suffix = this.suffixes[i];
color = d3.rgb(this._colors(suffix.cn[0])); color = d3.rgb(this._colors(suffix.cn[0]));
name = this._get_marker_name(suffix, false); name = this._get_marker_name(suffix, false);