aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2013-11-18 16:11:15 +0100
committerMicael Karlberg <[email protected]>2013-11-18 16:11:15 +0100
commit78f27e212511db6b4c303f13dd698ba687fc459a (patch)
treedff0c971ecb2ff2d4d366ee05d73381ca3c28f79 /lib/snmp/src
parent98412eababc3f81719e9c150c9cff6c629e2a3ff (diff)
parent4b89567941ac6c00a994bde917e2d0d450dce91f (diff)
downloadotp-78f27e212511db6b4c303f13dd698ba687fc459a.tar.gz
otp-78f27e212511db6b4c303f13dd698ba687fc459a.tar.bz2
otp-78f27e212511db6b4c303f13dd698ba687fc459a.zip
Merge branch 'bmk/snmp/block_log_during_conversion/r15/OTP-11396' into bmk/snmp/snmp4223_integration
Diffstat (limited to 'lib/snmp/src')
-rw-r--r--lib/snmp/src/app/snmp.appup.src54
-rw-r--r--lib/snmp/src/misc/snmp_log.erl32
-rw-r--r--lib/snmp/src/misc/snmp_verbosity.erl4
3 files changed, 69 insertions, 21 deletions
diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src
index 39e154d463..69237838ab 100644
--- a/lib/snmp/src/app/snmp.appup.src
+++ b/lib/snmp/src/app/snmp.appup.src
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -22,12 +22,22 @@
%% ----- U p g r a d e -------------------------------------------------------
[
+ {"4.22.2",
+ [
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
+ {load_module, snmp_verbosity, soft_purge, soft_purge, []}
+ ]
+ },
{"4.22.1",
[
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
+ {load_module, snmp_verbosity, soft_purge, soft_purge, []}
]
},
{"4.22",
[
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
+ {load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm, soft_purge, soft_purge, []},
{load_module, snmp_pdus, soft_purge, soft_purge, []},
{load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []},
@@ -51,7 +61,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpa, soft_purge, soft_purge, [snmp]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -79,7 +89,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpa, soft_purge, soft_purge, [snmp]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -105,7 +115,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -137,7 +147,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -173,7 +183,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -209,7 +219,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -247,7 +257,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -286,7 +296,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -316,12 +326,22 @@
%% ------D o w n g r a d e ---------------------------------------------------
[
+ {"4.22.2",
+ [
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
+ {load_module, snmp_verbosity, soft_purge, soft_purge, []}
+ ]
+ },
{"4.22.1",
[
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
+ {load_module, snmp_verbosity, soft_purge, soft_purge, []}
]
},
{"4.22",
[
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
+ {load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm, soft_purge, soft_purge, []},
{load_module, snmp_pdus, soft_purge, soft_purge, []},
{load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []},
@@ -346,7 +366,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpa, soft_purge, soft_purge, [snmp]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -374,7 +394,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpa, soft_purge, soft_purge, [snmp]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -400,7 +420,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -432,7 +452,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -468,7 +488,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -504,7 +524,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -542,7 +562,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
@@ -581,7 +601,7 @@
{load_module, snmp, soft_purge, soft_purge, [snmp_log]},
{load_module, snmpm, soft_purge, soft_purge, [snmp]},
- {load_module, snmp_log, soft_purge, soft_purge, []},
+ {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]},
{load_module, snmp_verbosity, soft_purge, soft_purge, []},
{load_module, snmpm_mpd, soft_purge, soft_purge, []},
diff --git a/lib/snmp/src/misc/snmp_log.erl b/lib/snmp/src/misc/snmp_log.erl
index a8c5df0b64..9c6cb1e077 100644
--- a/lib/snmp/src/misc/snmp_log.erl
+++ b/lib/snmp/src/misc/snmp_log.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -443,9 +443,12 @@ do_log_convert(Log, File, Converter) ->
%% "~n Log: ~p"
%% "~n File: ~p"
%% "~n disk_log:info(Log): ~p", [Log, File, disk_log:info(Log)]),
+ Verbosity = get(verbosity),
{Pid, Ref} =
erlang:spawn_monitor(
fun() ->
+ put(sname, lc),
+ put(verbosity, Verbosity),
Result = do_log_convert2(Log, File, Converter),
exit(Result)
end),
@@ -462,19 +465,35 @@ do_log_convert2(Log, File, Converter) ->
%% First check if the caller process has already opened the
%% log, because if we close an already open log we will cause
%% a runtime error.
+ ?vtrace("do_log_convert2 -> entry - check if owner", []),
case is_owner(Log) of
true ->
- Converter(Log);
+ ?vdebug("do_log_converter2 -> owner - now convert log", []),
+ disk_log:block(Log, true),
+ Res = Converter(Log),
+ disk_log:unblock(Log),
+ Res;
false ->
%% Not yet member of the ruling party, apply for membership...
+ ?vtrace("do_log_converter2 -> not owner - open log", []),
case log_open(Log, File) of
{ok, _} ->
+ ?vdebug("do_log_convert2 -> opened - now convert log", []),
+ disk_log:block(Log, true),
Res = Converter(Log),
+ disk_log:unblock(Log),
disk_log:close(Log),
Res;
{error, {name_already_open, _}} ->
- Converter(Log);
+ ?vdebug("do_log_convert2 -> "
+ "already opened - now convert log", []),
+ disk_log:block(Log, true),
+ Res = Converter(Log),
+ disk_log:unblock(Log),
+ Res;
{error, Reason} ->
+ ?vinfo("Failed converting log - open failed: "
+ "~n Reason: ~p", [Reason]),
{error, {Log, Reason}}
end
end.
@@ -491,6 +510,8 @@ do_log_to_file(Log, TextFile, Mibs, Start, Stop) ->
{ok, S} ->
io:format(Fd, "~s", [S]);
_ ->
+ ?vdebug("do_log_to_txt:fun -> "
+ "format failed", []),
ok
end
end,
@@ -499,6 +520,9 @@ do_log_to_file(Log, TextFile, Mibs, Start, Stop) ->
file:close(Fd),
Res;
{error, Reason} ->
+ ?vinfo("Failed opening output file: "
+ "~n TestFile: ~p"
+ "~n Reason: ~p", [TextFile, Reason]),
{error, {TextFile, Reason}}
end.
@@ -510,6 +534,8 @@ do_log_to_io(Log, Mibs, Start, Stop) ->
{ok, S} ->
io:format("~s", [S]);
_ ->
+ ?vdebug("do_log_to_io:fun -> "
+ "format failed", []),
ok
end
end,
diff --git a/lib/snmp/src/misc/snmp_verbosity.erl b/lib/snmp/src/misc/snmp_verbosity.erl
index df5986b7bc..e5ff3daf91 100644
--- a/lib/snmp/src/misc/snmp_verbosity.erl
+++ b/lib/snmp/src/misc/snmp_verbosity.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2000-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2000-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -148,6 +148,8 @@ image_of_sname(mnifl) -> "M-NET-IF-LOGGER";
image_of_sname(mnifw) -> io_lib:format("M-NET-IF-worker(~p)", [self()]);
image_of_sname(mconf) -> "M-CONF";
+image_of_sname(lc) -> io_lib:format("LOG-CONVERTER(~p)", [self()]);
+
image_of_sname(mgr) -> "MGR";
image_of_sname(mgr_misc) -> "MGR_MISC";