aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2013-05-23 12:35:38 +0200
committerMicael Karlberg <[email protected]>2013-05-23 12:35:38 +0200
commit39540e7c380f6cb218a2ec6324f6296fa8327dba (patch)
treef94ceb3cd8f8c7bab9c0168f378f68dbd3a63baa /lib/snmp/src
parent69981c172621ed6f2e9fa7495b583af42f64c027 (diff)
downloadotp-39540e7c380f6cb218a2ec6324f6296fa8327dba.tar.gz
otp-39540e7c380f6cb218a2ec6324f6296fa8327dba.tar.bz2
otp-39540e7c380f6cb218a2ec6324f6296fa8327dba.zip
[snmp/agent] Updated open options for the mnesia mib-storage module
Updated the snmpa_mib_storage_mnesia module to handle alias atoms for the nodes option. Also, (git) added mib-storage behaviour ref-man.
Diffstat (limited to 'lib/snmp/src')
-rw-r--r--lib/snmp/src/agent/snmpa_mib_storage_mnesia.erl31
1 files changed, 29 insertions, 2 deletions
diff --git a/lib/snmp/src/agent/snmpa_mib_storage_mnesia.erl b/lib/snmp/src/agent/snmpa_mib_storage_mnesia.erl
index dca44d3c33..192b5aa26e 100644
--- a/lib/snmp/src/agent/snmpa_mib_storage_mnesia.erl
+++ b/lib/snmp/src/agent/snmpa_mib_storage_mnesia.erl
@@ -63,8 +63,8 @@
open(Name, RecName, Fields, Type, Opts) ->
?vtrace("open ~p table ~p for record ~p",
[Type, Name, RecName]),
- Action = snmp_misc:get_option(action, Opts, keep),
- Nodes = snmp_misc:get_option(nodes, Opts, erlang:nodes()),
+ Action = get_action(Opts),
+ Nodes = get_nodes(Opts),
case table_exists(Name) of
true when (Action =:= keep) ->
?vtrace("open table ~p - exist (keep)", [Name]),
@@ -271,5 +271,32 @@ backup(_, _) ->
%%----------------------------------------------------------------------
+get_action(Opts) ->
+ snmp_misc:get_option(action, Opts, keep).
+
+get_nodes(Opts) ->
+ case snmp_misc:get_option(nodes, Opts, erlang:nodes()) of
+ [] ->
+ [node()];
+ Nodes when is_list(Nodes) ->
+ Nodes;
+ all ->
+ erlang:nodes();
+ visible ->
+ erlang:nodes(visible);
+ connected ->
+ erlang:nodes(connected);
+ db_nodes ->
+ try mnesia:system_info(db_nodes) of
+ DbNodes when is_list(DbNodes) ->
+ DbNodes;
+ _ ->
+ erlang:nodes()
+ catch
+ _:_ ->
+ erlang:nodes()
+ end
+ end.
+
%% user_err(F, A) ->
%% snmpa_error:user_err(F, A).