From e15c3791dc007117776729b4d3a2e50fdfd590b3 Mon Sep 17 00:00:00 2001 From: linggao Date: Tue, 13 Jan 2009 21:29:34 +0000 Subject: [PATCH] more on plugable DB schema. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2596 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/ExtTab.pm | 7 ++++++- perl-xCAT/xCAT/Schema.pm | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/ExtTab.pm b/perl-xCAT/xCAT/ExtTab.pm index 9b63afe09..1aa8edf57 100644 --- a/perl-xCAT/xCAT/ExtTab.pm +++ b/perl-xCAT/xCAT/ExtTab.pm @@ -33,7 +33,11 @@ foreach (@extSchema) { if (${"xCAT_schema::" . "$modname" . "::"}{tabspec}) { my %tabspec=%{${"xCAT_schema::" . "$modname" . "::"}{tabspec}}; foreach my $tabname (keys(%tabspec)) { - $ext_tabspec{$tabname}=$tabspec{$tabname}; + if (exists($ext_tabspec{$tabname})) { + xCAT::MsgUtils->message('ES', "\n Warning: File $file: the table name $tabname is used by other applications. Please rename the table.\n"); + } else { + $ext_tabspec{$tabname}=$tabspec{$tabname}; + } } } else { xCAT::MsgUtils->message('ES', "\n Warning: Cannot find \%tabspec variable in the user defined database table schema file $file\n"); @@ -105,6 +109,7 @@ foreach (@extSchema) { sub updateTables { #print "\nupdateTables\n"; + print "\n"; foreach (keys %ext_tabspec) { my $table= xCAT::Table->new($_,-create=>1,-autocommit=>1); } diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 7ed5c0c5c..8b94fce31 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -589,7 +589,11 @@ performance => { # adding user defined external tables ################################################## foreach my $tabname (keys(%xCAT::ExtTab::ext_tabspec)) { - $tabspec{$tabname}=$xCAT::ExtTab::ext_tabspec{$tabname}; + if (exists($tabspec{$tabname})) { + xCAT::MsgUtils->message('ES', "\n Warning: Conflict when adding user defined tablespec. Duplicate table name: $tabname. \n"); + } else { + $tabspec{$tabname}=$xCAT::ExtTab::ext_tabspec{$tabname}; + } }