From 4e008d7895ada4a6632f6775078dca4ad401d3af Mon Sep 17 00:00:00 2001 From: mellor Date: Fri, 26 Sep 2014 03:54:52 -0700 Subject: [PATCH] enhance for p8 hardware discovery --- xCAT-server/sbin/xcatd | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index f2cad92f7..3ad667574 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -542,8 +542,15 @@ sub do_discovery_process { my $vintage = time(); $dispatch_requests=0; populate_site_hash(); + populate_vpd_hash(); + populate_ppc_hash(); while (not $quit) { - if ((time()-$vintage)> 15) { populate_site_hash(); } #site table reread every 15 second + if ((time()-$vintage)> 15) { + populate_site_hash(); + populate_vpd_hash(); + populate_ppc_hash(); + $vintage = time(); + } #site table reread every 15 second my $msg = fd_retrieve($broker); my $data; my $client; @@ -2035,6 +2042,29 @@ sub populate_site_hash { } } +sub populate_vpd_hash { + %::XCATVPDHASH=(); + my $vpdtab = xCAT::Table->new('vpd',-create=>0); + unless ($vpdtab) {return;} + my @entries = $vpdtab->getAllAttribs(qw/node serial mtm/); + foreach (@entries) { + unless ($_->{mtm} and $_->{serial}) {next;} + my $mtms = $_->{mtm}."*".$_->{serial}; + push @{$::XCATVPDHASH{$mtms}}, $_->{node}; + } +} +sub populate_ppc_hash { + %::XCATPPCHASH=(); + my $ppctab = xCAT::Table->new('ppc',-create=>0); + unless ($ppctab) {return;} + my @entries = $ppctab->getAllAttribs(qw/node nodetype/); + foreach (@entries) { + if ($_->{nodetype} and $_->{nodetype} eq 'pbmc') { + $::XCATPPCHASH{$_->{node}}=$_->{nodetype}; + } + } +} + sub send_response { my $response = shift; my $sock = shift;