From 238baaf4f7c15d4eef2a3feaf9bad0983b921732 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 23 Feb 2012 13:45:45 +0000 Subject: [PATCH] Init macmap on demand. The handled_commands is no place for persistent initializations git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11669 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/switch.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/switch.pm b/xCAT-server/lib/xcat/plugins/switch.pm index 4ce7d2a38..06b5f5bbd 100644 --- a/xCAT-server/lib/xcat/plugins/switch.pm +++ b/xCAT-server/lib/xcat/plugins/switch.pm @@ -18,7 +18,6 @@ use xCAT::MellanoxIB; my $macmap; sub handled_commands { - $macmap = xCAT::MacMap->new(); return { findme => 'switch', findmac => 'switch', @@ -106,6 +105,9 @@ sub process_request { my $req = shift; my $cb = shift; my $doreq = shift; + unless ($macmap) { + $macmap = xCAT::MacMap->new(); + } my $node; my $mac = ''; if ($req->{command}->[0] eq 'findmac') {