From 4ce2c1bd3ed90e6f1c208b4749ee33ae4ee9d723 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 2 Mar 2010 10:20:45 +0000 Subject: Merge from dev branch: OTP-8480 & OTP-8481. --- lib/snmp/doc/src/notes.xml | 60 +++++++++++++++++++++++++++++++++ lib/snmp/src/agent/snmpa_general_db.erl | 19 ++++------- lib/snmp/src/app/snmp.appup.src | 40 ++++++++++++++++------ lib/snmp/src/manager/snmpm_net_if.erl | 43 +++++++++++++++++++++-- lib/snmp/vsn.mk | 6 ++-- 5 files changed, 140 insertions(+), 28 deletions(-) diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 8939fbd6df..33e304abfa 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -32,6 +32,66 @@ notes.xml +
+ SNMP Development Toolkit 4.16.1 +

Version 4.16.1 supports code replacement in runtime from/to + version 4.16, 4.15, 4.14 and 4.13.5.

+ +
+ Improvements and new features +

-

+ + +
+ +
+ Reported Fixed Bugs and Malfunctions + + + + +

[manager] Fixed an upgrade/downgrade problem.

+

Upgrade/downgrade from/to 4.13.5 did not work for the net-if + process. This has now been fixed.

+

Own Id: OTP-8481

+
+ + +

[agent] A minor mnesia related performance improvement.

+

Own Id: OTP-8480

+
+ +
+ +
+ +
+ Incompatibilities +

-

+
+
+ +
SNMP Development Toolkit 4.16

Version 4.16 supports code replacement in runtime from/to diff --git a/lib/snmp/src/agent/snmpa_general_db.erl b/lib/snmp/src/agent/snmpa_general_db.erl index 795c353a9e..a06604c9cf 100644 --- a/lib/snmp/src/agent/snmpa_general_db.erl +++ b/lib/snmp/src/agent/snmpa_general_db.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 2000-2010. 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 %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% -module(snmpa_general_db). @@ -114,14 +114,7 @@ ets_open(Name, Dir, clear, Type) -> mnesia_open({table_exist,Name},_Nodes,_RecName,_Attr,_Type,clear) -> ?vtrace("[mnesia] database ~p already exists; clear content",[Name]), - Pattern = '_', - F = fun() -> - Recs = mnesia:match_object(Name,Pattern,read), - lists:foreach(fun(Rec) -> - mnesia:delete_object(Name,Rec,write) - end, Recs), - Recs - end, + F = fun() -> mnesia:clear_table(Name) end, case mnesia:transaction(F) of {aborted,Reason} -> exit({aborted,Reason}); diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 56b8c593a8..204de71c2e 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -22,11 +22,18 @@ %% ----- U p g r a d e ------------------------------------------------------- [ + {"4.16", + [ + {load_module, snmpa_general_db, soft_purge, soft_purge, []}, + {update, snmpm_net_if, soft, soft_purge, soft_purge, []} + ] + }, {"4.15", [ {load_module, snmpa, soft_purge, soft_purge, [snmp_log]}, {load_module, snmp_config, soft_purge, soft_purge, []}, {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmpa_general_db, soft_purge, soft_purge, []}, {update, snmpm_net_if, {advanced, upgrade_from_pre_4_16}, soft_purge, soft_purge, [snmpm_config, snmp_log]}, {update, snmpa_net_if, {advanced, upgrade_from_pre_4_16}, @@ -41,14 +48,15 @@ {load_module, snmpa, soft_purge, soft_purge, [snmp_log]}, {load_module, snmp_config, soft_purge, soft_purge, []}, {load_module, snmp_log, soft_purge, soft_purge, []}, - {update, snmpm_net_if, {advanced, upgrade_from_pre_4_16}, - soft_purge, soft_purge, [snmpm_config, snmp_log]}, + {load_module, snmpa_general_db, soft_purge, soft_purge, []}, {update, snmpa_net_if, {advanced, upgrade_from_pre_4_16}, soft_purge, soft_purge, [snmpa_agent, snmp_log]}, {update, snmpa_agent, soft, soft_purge, soft_purge, []}, {load_module, snmpm_user, soft_purge, soft_purge, []}, {load_module, snmpm_user_default, soft_purge, soft_purge, [snmpm_user]}, + {update, snmpm_net_if, {advanced, upgrade_from_pre_4_16}, + soft_purge, soft_purge, [snmpm_config, snmp_log]}, {update, snmpm_config, soft, soft_purge, soft_purge, []}, {update, snmpm_server, soft, soft_purge, soft_purge, [snmpm_user_default]} @@ -60,14 +68,15 @@ {load_module, snmpa, soft_purge, soft_purge, [snmp_log]}, {load_module, snmp_config, soft_purge, soft_purge, []}, {load_module, snmp_log, soft_purge, soft_purge, []}, - {update, snmpm_net_if, {advanced, upgrade_from_pre_4_16}, - soft_purge, soft_purge, [snmpm_config, snmp_log]}, + {load_module, snmpa_general_db, soft_purge, soft_purge, []}, {update, snmpa_net_if, {advanced, upgrade_from_pre_4_16}, soft_purge, soft_purge, [snmpa_agent, snmp_log]}, {update, snmpa_agent, soft, soft_purge, soft_purge, []}, {load_module, snmpm_user, soft_purge, soft_purge, []}, {load_module, snmpm_user_default, soft_purge, soft_purge, [snmpm_user]}, + {update, snmpm_net_if, {advanced, upgrade_from_pre_4_14}, + soft_purge, soft_purge, [snmpm_config, snmp_log]}, {update, snmpm_config, soft, soft_purge, soft_purge, []}, {update, snmpm_server, soft, soft_purge, soft_purge, [snmpm_user_default]}, {add_module, snmpm_net_if_filter}, @@ -79,17 +88,25 @@ %% ------D o w n g r a d e --------------------------------------------------- [ + {"4.16", + [ + {load_module, snmpa_general_db, soft_purge, soft_purge, []}, + {update, snmpm_net_if, soft, soft_purge, soft_purge, []} + ] + }, {"4.15", [ {load_module, snmpa, soft_purge, soft_purge, [snmp_log]}, {load_module, snmp_config, soft_purge, soft_purge, []}, {load_module, snmp_log, soft_purge, soft_purge, []}, - {update, snmpm_net_if, {advanced, downgrade_to_pre_4_16}, - soft_purge, soft_purge, [snmpm_config, snmp_log]}, + {load_module, snmpa_general_db, soft_purge, soft_purge, []}, {update, snmpa_net_if, {advanced, downgrade_to_pre_4_16}, soft_purge, soft_purge, [snmpa_agent, snmp_log]}, {update, snmpa_agent, soft, soft_purge, soft_purge, []}, + {load_module, snmpa_general_db, soft_purge, soft_purge, []}, + {update, snmpm_net_if, {advanced, downgrade_to_pre_4_16}, + soft_purge, soft_purge, [snmpm_config, snmp_log]}, {update, snmpm_config, soft, soft_purge, soft_purge, []} ] }, @@ -98,14 +115,15 @@ {load_module, snmpa, soft_purge, soft_purge, [snmp_log]}, {load_module, snmp_config, soft_purge, soft_purge, []}, {load_module, snmp_log, soft_purge, soft_purge, []}, - {update, snmpm_net_if, {advanced, downgrade_to_pre_4_16}, - soft_purge, soft_purge, [snmpm_config, snmp_log]}, + {load_module, snmpa_general_db, soft_purge, soft_purge, []}, {update, snmpa_net_if, {advanced, downgrade_to_pre_4_16}, soft_purge, soft_purge, [snmpa_agent, snmp_log]}, {update, snmpa_agent, soft, soft_purge, soft_purge, []}, {load_module, snmpm_user, soft_purge, soft_purge, []}, {load_module, snmpm_user_default, soft_purge, soft_purge, [snmpm_user]}, + {update, snmpm_net_if, {advanced, downgrade_to_pre_4_16}, + soft_purge, soft_purge, [snmpm_config, snmp_log]}, {update, snmpm_config, soft, soft_purge, soft_purge, []}, {update, snmpm_server, soft, soft_purge, soft_purge, [snmpm_user_default]} @@ -117,16 +135,18 @@ {load_module, snmp_config, soft_purge, soft_purge, []}, {load_module, snmpa, soft_purge, soft_purge, [snmp_log]}, {load_module, snmp_log, soft_purge, soft_purge, []}, - {update, snmpm_net_if, {advanced, downgrade_to_pre_4_16}, - soft_purge, soft_purge, [snmpm_config, snmp_log]}, + {load_module, snmpa_general_db, soft_purge, soft_purge, []}, {update, snmpa_net_if, {advanced, downgrade_to_pre_4_16}, soft_purge, soft_purge, [snmpa_agent, snmp_log]}, {update, snmpa_agent, soft, soft_purge, soft_purge, []}, {load_module, snmpm_user, soft_purge, soft_purge, []}, {load_module, snmpm_user_default, soft_purge, soft_purge, [snmpm_user]}, + {update, snmpm_net_if, {advanced, downgrade_to_pre_4_14}, + soft_purge, soft_purge, [snmpm_config, snmp_log]}, {update, snmpm_config, soft, soft_purge, soft_purge, []}, {update, snmpm_server, soft, soft_purge, soft_purge, [snmpm_user_default]}, + {remove, {snmpm_net_if_filter, soft_purge, brutal_purge}}, {remove, {snmpm_network_interface_filter, soft_purge, brutal_purge}} ] diff --git a/lib/snmp/src/manager/snmpm_net_if.erl b/lib/snmp/src/manager/snmpm_net_if.erl index ad39157721..07156dacd9 100644 --- a/lib/snmp/src/manager/snmpm_net_if.erl +++ b/lib/snmp/src/manager/snmpm_net_if.erl @@ -441,7 +441,7 @@ handle_info(Info, State) -> %% Returns: any (ignored by gen_server) %%-------------------------------------------------------------------- terminate(Reason, #state{log = Log, irgc = IrGcRef}) -> - ?vdebug("terminate: ~p",[Reason]), + ?vdebug("terminate: ~p", [Reason]), irgc_stop(IrGcRef), %% Close logs do_close_log(Log), @@ -462,22 +462,59 @@ do_close_log(_) -> %% Returns: {ok, NewState} %%---------------------------------------------------------------------- +code_change({down, _Vsn}, OldState, downgrade_to_pre_4_14) -> + ?d("code_change(down, downgrade_to_pre_4_14) -> entry with" + "~n OldState: ~p", [OldState]), + #state{server = Server, + note_store = NoteStore, + sock = Sock, + mpd_state = MpdState, + log = {OldLog, Type}, + irb = IRB, + irgc = IRGC} = OldState, + NewLog = snmp_log:downgrade(OldLog), + State = + {state, Server, NoteStore, Sock, MpdState, {NewLog, Type}, IRB, IRGC}, + {ok, State}; + code_change({down, _Vsn}, OldState, downgrade_to_pre_4_16) -> - ?d("code_change(down) -> entry", []), + ?d("code_change(down, downgrade_to_pre_4_16) -> entry with" + "~n OldState: ~p", [OldState]), {OldLog, Type} = OldState#state.log, NewLog = snmp_log:downgrade(OldLog), State = OldState#state{log = {NewLog, Type}}, {ok, State}; % upgrade +code_change(_Vsn, OldState, upgrade_from_pre_4_14) -> + ?d("code_change(up, upgrade_from_pre_4_14) -> entry with" + "~n OldState: ~p", [OldState]), + {state, Server, NoteStore, Sock, MpdState, {OldLog, Type}, IRB, IRGC} = + OldState, + NewLog = snmp_log:upgrade(OldLog), + State = #state{server = Server, + note_store = NoteStore, + sock = Sock, + mpd_state = MpdState, + log = {NewLog, Type}, + irb = IRB, + irgc = IRGC, + filter = ?DEFAULT_FILTER_MODULE}, + {ok, State}; + code_change(_Vsn, OldState, upgrade_from_pre_4_16) -> - ?d("code_change(up) -> entry", []), + ?d("code_change(up, upgrade_from_pre_4_16) -> entry with" + "~n OldState: ~p", [OldState]), {OldLog, Type} = OldState#state.log, NewLog = snmp_log:upgrade(OldLog), State = OldState#state{log = {NewLog, Type}}, {ok, State}; code_change(_Vsn, State, _Extra) -> + ?d("code_change -> entry with" + "~n Vsn: ~p" + "~n State: ~p" + "~n Extra: ~p", [_Vsn, State, _Extra]), {ok, State}. diff --git a/lib/snmp/vsn.mk b/lib/snmp/vsn.mk index c4550d9b44..50c72b33b5 100644 --- a/lib/snmp/vsn.mk +++ b/lib/snmp/vsn.mk @@ -17,11 +17,13 @@ # # %CopyrightEnd% -SNMP_VSN = 4.16 +SNMP_VSN = 4.16.1 PRE_VSN = APP_VSN = "snmp-$(SNMP_VSN)$(PRE_VSN)" -TICKETS = \ +TICKETS = OTP-8480 OTP-8481 + +TICKETS_4_16 = \ OTP-8395 \ OTP-8433 \ OTP-8442 -- cgit v1.2.3