added support for user plugable database table. Phase 2
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2595 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
8bf5cd26ed
commit
dd9da780a0
@ -103,13 +103,19 @@ sub buildcreatestmt
|
||||
my $descr = shift;
|
||||
my $retv = "CREATE TABLE $tabn (\n ";
|
||||
my $col;
|
||||
my $types=$descr->{types};
|
||||
foreach $col (@{$descr->{cols}})
|
||||
{
|
||||
if (isAKey(\@{$descr->{keys}},$col)) { # keys need defined length
|
||||
$retv .= "\"$col\" VARCHAR(128)";
|
||||
} else {
|
||||
$retv .= "\"$col\" TEXT";
|
||||
}
|
||||
if (($types) && ($types->{$col})) {
|
||||
$retv .= "\"$col\"" . $types->{$col};
|
||||
} else {
|
||||
if (isAKey(\@{$descr->{keys}},$col)) { # keys need defined length
|
||||
$retv .= "\"$col\" VARCHAR(128)";
|
||||
} else {
|
||||
$retv .= "\"$col\" TEXT";
|
||||
}
|
||||
}
|
||||
|
||||
if (grep /^$col$/, @{$descr->{required}})
|
||||
{
|
||||
$retv .= " NOT NULL";
|
||||
|
@ -11,15 +11,23 @@ package xCAT_schema::Sample;
|
||||
# jobid, status, node, jobstatus are the column names. Change them to your like.
|
||||
# Each table must have a 'disable' column.
|
||||
# 5 change the keys
|
||||
# 6 change the table descriptions and column descriptions to your like.
|
||||
# 7 restart the the xcatd, the tables will be automatically generated.
|
||||
# 8 do above steps on all the service nodes.
|
||||
# 6 change the data types. The default data type is TEXT if not specified.
|
||||
# The supported data types are:
|
||||
# REAL,CHAR,TEXT,DATE,TIME,FLOAT,BIGINT,DOUBLE,STRING,
|
||||
# BINARY,DECIMAL,BOOLEAN,INTEGER,VARCHAR,SMALLINT,TIMESTAMP
|
||||
# 7 change the table descriptions and column descriptions to your like.
|
||||
# 8 restart the the xcatd, the tables will be automatically generated.
|
||||
# 9 copy the file to all the service nodes and restart the xcatd on all the service node.
|
||||
#
|
||||
###############################################################################
|
||||
%tabspec = (
|
||||
lljob => {
|
||||
cols => [qw(jobid status disable)], #do not change 'disable, it is required by xCAT
|
||||
keys => [qw(jobid)],
|
||||
required => [qw(jobid)],
|
||||
types => {
|
||||
jobid => 'INTEGER',
|
||||
},
|
||||
table_desc => 'Stores jobs.',
|
||||
descriptions => {
|
||||
jobid => 'The job id.',
|
||||
@ -28,13 +36,19 @@ package xCAT_schema::Sample;
|
||||
},
|
||||
},
|
||||
llnode => {
|
||||
cols => [qw(node jobid jobstatus disable)],
|
||||
cols => [qw(node jobid jobstatus cpu_usage disable)],
|
||||
keys => [qw(node)],
|
||||
required => [qw(node jobid)],
|
||||
types => {
|
||||
jobid => 'INTEGER',
|
||||
cpu_usage => 'FLOAT',
|
||||
},
|
||||
table_desc => 'Stores the node status.',
|
||||
descriptions => {
|
||||
node=> 'The node.',
|
||||
jobid => 'The job that runs on the node.',
|
||||
jobstatus => 'The status of the job on the node.',
|
||||
cpu_usage => 'The percent of cpu usage on the node.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
},
|
||||
@ -85,6 +99,10 @@ package xCAT_schema::Sample;
|
||||
tabentry => 'llnode.jobstatus',
|
||||
access_tabentry => 'llnode.node=attr:node',
|
||||
},
|
||||
{ attr_name => 'cpu',
|
||||
tabentry => 'llnode.cpu_usage',
|
||||
access_tabentry => 'llnode.node=attr:node',
|
||||
},
|
||||
);
|
||||
1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user