-Reduce memory consumption through not moving modules into shorter lifetime
places git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2898 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
66f4ba40e8
commit
ed59575e36
@ -12,7 +12,6 @@ use Thread qw(yield);
|
||||
use xCAT::Utils;
|
||||
use xCAT::Usage;
|
||||
use IO::Socket;
|
||||
use SNMP;
|
||||
use xCAT::GlobalDef;
|
||||
use xCAT_monitoring::monitorctrl;
|
||||
use strict;
|
||||
@ -2033,9 +2032,16 @@ sub process_request {
|
||||
}
|
||||
exit 0;
|
||||
};
|
||||
|
||||
my $request = shift;
|
||||
my $callback = shift;
|
||||
eval {
|
||||
require SNMP;
|
||||
}
|
||||
if ($@) {
|
||||
$callback->{error=>['Missing SNMP perl support'],errorcode=>[1]};
|
||||
return;
|
||||
}
|
||||
|
||||
my $doreq = shift;
|
||||
my $level = shift;
|
||||
my $noderange = $request->{node};
|
||||
|
@ -1,8 +1,6 @@
|
||||
#!/usr/bin/env perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
package xCAT_plugin::kvm;
|
||||
my $libvirtsupport;
|
||||
$libvirtsupport = eval { require Sys::Virt; };
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
@ -12,18 +10,17 @@ use xCAT::GlobalDef;
|
||||
use xCAT::NodeRange;
|
||||
use xCAT_monitoring::monitorctrl;
|
||||
|
||||
#use Net::SNMP qw(:snmp INTEGER);
|
||||
use xCAT::Table;
|
||||
use XML::Simple qw(XMLout);
|
||||
use Thread qw(yield);
|
||||
use IO::Socket;
|
||||
use IO::Select;
|
||||
use SNMP;
|
||||
use strict;
|
||||
#use warnings;
|
||||
my %vm_comm_pids;
|
||||
my @destblacklist;
|
||||
my $vmhash;
|
||||
my $nthash; #to store nodetype data
|
||||
my $hmhash;
|
||||
|
||||
use XML::Simple;
|
||||
@ -74,7 +71,6 @@ my $hyp;
|
||||
my $doreq;
|
||||
my %hyphash;
|
||||
my $node;
|
||||
my $hmtab;
|
||||
my $vmtab;
|
||||
|
||||
sub waitforack {
|
||||
@ -579,15 +575,6 @@ sub preprocess_request {
|
||||
my $request = shift;
|
||||
if ($request->{_xcatdest}) { return [$request]; } #exit if preprocessed
|
||||
my $callback=shift;
|
||||
unless ($libvirtsupport) { #Try to see if conditions changed since last check (no xCATd restart for it to take effect)
|
||||
$libvirtsupport = eval { require Sys::Virt; };
|
||||
}
|
||||
unless ($libvirtsupport) { #Still no Sys::Virt module
|
||||
$callback->({error=>"Sys::Virt perl module missing, unable to fulfill Xen plugin requirements",errorcode=>[42]});
|
||||
return [];
|
||||
}
|
||||
require Sys::Virt::Domain;
|
||||
%runningstates = (&Sys::Virt::Domain::STATE_NOSTATE=>1,&Sys::Virt::Domain::STATE_RUNNING=>1,&Sys::Virt::Domain::STATE_BLOCKED=>1);
|
||||
my @requests;
|
||||
|
||||
my $noderange = $request->{node}; #Should be arrayref
|
||||
@ -642,10 +629,14 @@ sub grab_table_data{ #grab table data relevent to VM guest nodes
|
||||
my $noderange=shift;
|
||||
my $callback=shift;
|
||||
$vmtab = xCAT::Table->new("vm");
|
||||
$hmtab = xCAT::Table->new("nodehm");
|
||||
my $hmtab = xCAT::Table->new("nodehm");
|
||||
my $nttab = xCAT::Table->new("nodetype");
|
||||
if ($hmtab) {
|
||||
$hmhash = $hmtab->getNodesAttribs($noderange,['serialspeed']);
|
||||
}
|
||||
if ($nttab) {
|
||||
$hmhash = $hmtab->getNodesAttribs($noderange,['serialspeed']);
|
||||
}
|
||||
unless ($vmtab) {
|
||||
$callback->({data=>["Cannot open vm table"]});
|
||||
return;
|
||||
@ -663,9 +654,16 @@ sub process_request {
|
||||
}
|
||||
exit 0;
|
||||
};
|
||||
|
||||
my $request = shift;
|
||||
my $callback = shift;
|
||||
my $libvirtsupport = eval { require Sys::Virt; };
|
||||
unless ($libvirtsupport) { #Still no Sys::Virt module
|
||||
$callback->({error=>"Sys::Virt perl module missing, unable to fulfill KVM plugin requirements",errorcode=>[42]});
|
||||
return [];
|
||||
}
|
||||
require Sys::Virt::Domain;
|
||||
%runningstates = (&Sys::Virt::Domain::STATE_NOSTATE=>1,&Sys::Virt::Domain::STATE_RUNNING=>1,&Sys::Virt::Domain::STATE_BLOCKED=>1);
|
||||
|
||||
$doreq = shift;
|
||||
my $level = shift;
|
||||
my $noderange = $request->{node};
|
||||
|
@ -1,8 +1,6 @@
|
||||
#!/usr/bin/env perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
package xCAT_plugin::xen;
|
||||
my $libvirtsupport;
|
||||
$libvirtsupport = eval { require Sys::Virt; };
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
@ -12,13 +10,11 @@ use xCAT::GlobalDef;
|
||||
use xCAT::NodeRange;
|
||||
use xCAT_monitoring::monitorctrl;
|
||||
|
||||
#use Net::SNMP qw(:snmp INTEGER);
|
||||
use xCAT::Table;
|
||||
use XML::Simple qw(XMLout);
|
||||
use Thread qw(yield);
|
||||
use IO::Socket;
|
||||
use IO::Select;
|
||||
use SNMP;
|
||||
use strict;
|
||||
#use warnings;
|
||||
my %vm_comm_pids;
|
||||
@ -573,15 +569,6 @@ sub preprocess_request {
|
||||
my $request = shift;
|
||||
if ($request->{_xcatdest}) { return [$request]; } #exit if preprocessed
|
||||
my $callback=shift;
|
||||
unless ($libvirtsupport) { #Try to see if conditions changed since last check (no xCATd restart for it to take effect)
|
||||
$libvirtsupport = eval { require Sys::Virt; };
|
||||
}
|
||||
unless ($libvirtsupport) { #Still no Sys::Virt module
|
||||
$callback->({error=>"Sys::Virt perl module missing, unable to fulfill Xen plugin requirements",errorcode=>[42]});
|
||||
return [];
|
||||
}
|
||||
require Sys::Virt::Domain;
|
||||
%runningstates = (&Sys::Virt::Domain::STATE_NOSTATE=>1,&Sys::Virt::Domain::STATE_RUNNING=>1,&Sys::Virt::Domain::STATE_BLOCKED=>1);
|
||||
my @requests;
|
||||
|
||||
my $noderange = $request->{node}; #Should be arrayref
|
||||
@ -657,6 +644,15 @@ sub process_request {
|
||||
}
|
||||
exit 0;
|
||||
};
|
||||
#makes sense to check it here anyway, this way we avoid the main process
|
||||
#sucking up ram with Sys::Virt
|
||||
my $libvirtsupport = eval { require Sys::Virt; };
|
||||
unless ($libvirtsupport) { #Still no Sys::Virt module
|
||||
$callback->({error=>"Sys::Virt perl module missing, unable to fulfill Xen plugin requirements",errorcode=>[42]});
|
||||
return [];
|
||||
}
|
||||
require Sys::Virt::Domain;
|
||||
%runningstates = (&Sys::Virt::Domain::STATE_NOSTATE=>1,&Sys::Virt::Domain::STATE_RUNNING=>1,&Sys::Virt::Domain::STATE_BLOCKED=>1);
|
||||
|
||||
my $request = shift;
|
||||
my $callback = shift;
|
||||
|
Loading…
x
Reference in New Issue
Block a user