diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 58deaf7a8..3e3342d23 100644 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -395,6 +395,44 @@ sub getobjdefs xCAT::MsgUtils->message("E", $rsp, $::callback); } } + } elsif (($objtype eq 'auditlog') || ($objtype eq 'eventlog')) { + # Special case for auditlog/eventlog + # All the auditlog/eventlog attributes are in auditlog/eventlog table, + # Do not need to read the table multiple times for each attribute. + # The auditlog/eventlog is likely be very big over time, + # performance is a big concern with the general logic + my @TableRowArray = xCAT::DBobjUtils->getDBtable($objtype); + foreach my $objname (sort @{$type_obj{$objtype}}) { + if (@TableRowArray) + { + my $foundinfo = 0; + foreach my $entry (@TableRowArray) + { + if ($entry->{recid} eq $objname) + { + foreach my $k (keys %{$entry}) + { + # recid is the object name, do not need to be in the attributes list + if ($k eq 'recid') { next; } + if (defined($entry->{$k}) ) { + $foundinfo++; + if ($verbose == 1) { + $objhash{$objname}{$k} = "$entry->{$k}\t(Table:$objtype - Key:$k)"; + } else { + $objhash{$objname}{$k} = $entry->{$k}; + } + } + } + if ($foundinfo) + { + $objhash{$objname}{'objtype'} = $objtype; + } + # There should not be multiple entries with the same recid + last; + } # end if($entry-> + } # end foreach my $entry + } # end if(@TableTowArray + } # end foreach my $objname } else { # get the object type decription from Schema.pm my $datatype = $xCAT::Schema::defspec{$objtype}; diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index efb85c7f4..2e17bf0ac 100644 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -803,6 +803,10 @@ sub processArgs # for every type of data object get the list of defined objects foreach my $t (keys %{xCAT::Schema::defspec}) { + # exclude the auditlog and eventlog, + # the auditlog and eventlog tables might be very big + # use lsdef -t auditlog or lsdef -t eventlog instead + if (($t eq 'auditlog') || ($t eq 'eventlog')) { next; } $::objectsfrom_opta = 1;