Hi,
We use xCAT's excellent custom table feature to add our own node/group specific
table: x_desres. The code
for desres.pm follows at the end. We can pretty much use our custom table
values just as we would
any native xCAT table values, include assigning group names to the "node"
column. Very nice. Here's
an example of a node that inherits some of its x_desres table values from the
group "cm-lev". :
[root@drdkvm0003 xCAT]# tabdump -d x_desres # x_desres table defintion
node: The node.
x_desresrepo: repos to use during build.
x_v2repo: repos to use during build.
x_updrepo: repo to update to after 1st boot.
x_partinfo: Disk partitioning info.
comments: Any user-written notes.
disable: Set to 'yes' or '1' to comment out this row.
[root@drdkvm0003 xCAT]# nodels -b develkv7 x_desres
develkv7: x_desres.x_v2repo: repo-anton-v2-lev (inherited from group cm-lev)
develkv7: x_desres.x_desresrepo: repo-c5desres (inherited from group cm-lev)
develkv7: x_desres.x_updrepo: repo-c59updates (inherited from group cm-lev)
develkv7: x_desres.x_partinfo: part.default (inherited from group cm-lev)
develkv7: x_desres.node: develkv7
develkv7: x_desres.comments: Do not create part.bogus. It must not exist.
(inherited from group all)
develkv7: x_desres.disable:
[root@drdkvm0003 xCAT]# lsdef -t node develkv7 | tail
. . .
primarynic=eth0
profile=cm-lev
provmethod=install
status=booted
statustime=02-08-2013 10:41:06
tftpserver=149.77.53.252
x_desresrepo=repo-c5desres
x_partinfo=part.default
x_updrepo=repo-c59updates
x_v2repo=repo-anton-v2-lev
However though "lsdef -t node", above, shows values from x_desres that are
inherited from a group cm-lev, "lsdef -t group cm-dev" doesn't:
[root@drdkvm0003 xCAT]# lsdef -t group cm-lev
Object name: cm-lev
addkcmdline=sshd
arch=x86_64
grouptype=static
installnic=eth0
interface=eth0
members=develkv7
mgt=ipmi
netboot=pxe
nfsserver=149.77.53.252
os=centos5.9
postbootscripts=updcentos repo-c59updates/x86_64
postscripts=cm_test,cm-lev repo-anton-v2,desres-fix411
primarynic=eth0
profile=cm-lev
provmethod=install
tftpserver=149.77.53.252
This appears to be a display problem only, as the group definition works as
it's supposed to. Everything
works, and our custom values are accessible at all stages of the build, for
Kickstart preprocessing, via
netcat from a postscripts, etc.
Question 1. Is this a *feature* of "lsdef -t group", or is this something we
can fix ourselves in our
desres.pm table definition?
Question 2. To copy groups we currently pipe the output of "lsdef -z -t group"
to "mkdef -z", after
filtering to fix things like group name and membership. If this "lsdef -t
group" behavior is a feature,
is there another way to copy groups that preserves our custom table values?
Thanks,
Goran
PS. Here's our custom table definition:
/opt/xcat/lib/perl/xCAT_schema/desres.pm
[root@drdkvm0003 xcat]# cat /opt/xcat/lib/perl/xCAT_schema/desres.pm
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
package xCAT_schema::desres;
#################################################################################
# This is a sample code that contains the user defined user database schema
defination.
# Here is a list of things you can do to add DB tables to xCAT database.
# 1 Copy this file to /opt/xcat/lib/perl/xCAT_schema directory, rename it
# to your chosen schema name.
. . .
###############################################################################
%tabspec = (
x_desres => {
cols => [qw(node x_desresrepo x_v2repo x_updrepo x_partinfo comments
disable)],
keys => [qw(node)],
required => [qw(node)],
types => {
x_desresrepo => 'TEXT',
x_v2repo => 'TEXT',
x_updrepo => 'TEXT',
x_partinfo => 'TEXT',
},
compress =>'YES',
tablespace =>'XCATTBS32K',
table_desc => 'Stores the node repos.',
descriptions => {
node=> 'The node.',
x_desresrepo => 'repos to use during build.',
x_v2repo => 'repos to use during build.',
x_updrepo => 'repo to update to after 1st boot.',
x_partinfo => 'Disk partitioning info.',
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
},
},
); # end of tabspec definition
##################################################################
# The following %defspec is OPTIONAL. You only need to define it
# if you want your tables to work with xCAT object abstraction layer
# commands such as lsdef, mkdef, chdef and rmdef.
#
# Note: The xCAT database accessting commands such as
# tabdump, chtab, gettab, nodels, nodeadd, nodech, etc.
# still work without it.
#
# Please make sure that any new object name and attribute name
# should start with "x_".
##################################################################
#object 'node' already defined in /opt/xcat/lib/perl/xCAT/Schema.pm.
#Here we just add x_desresrepo, x_v2repo, x_updrepo and x_partinfo attributes
to the node object
@{$defspec{node}->{'attrs'}} =
(
{ attr_name => 'x_desresrepo',
tabentry => 'x_desres.x_desresrepo',
access_tabentry => 'x_desres.node=attr:node',
},
{ attr_name => 'x_v2repo',
tabentry => 'x_desres.x_v2repo',
access_tabentry => 'x_desres.node=attr:node',
},
{ attr_name => 'x_updrepo',
tabentry => 'x_desres.x_updrepo',
access_tabentry => 'x_desres.node=attr:node',
},
{ attr_name => 'x_partinfo',
tabentry => 'x_desres.x_partinfo',
access_tabentry => 'x_desres.node=attr:node',
},
);
1;
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
xCAT-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xcat-user