In answer to your "Question 1", to have the *def group commands recognize your attrs, you need to also set them in $defspec group entries:
@{$defspec{group}->{'attrs'}} = ( { attr_name => 'x_desresrepo', tabentry => 'x_desres.x_desresrepo', access_tabentry => 'x_desres.node=attr:node', }, : : ); If you take a quick look at the way xCAT does this in /opt/xcat/lib/perl/xCAT/Schema.pm, we set an array to all the common attrs and then push that array onto both $defspec{node} and $defspec{group} to only have the attr def in one place and to make sure both objects are kept in sync: my @nodeattrs = ( {attr_name => 'nodetype', tabentry => 'nodetype.nodetype', access_tabentry => 'nodetype.node=attr:node', }, : : ); push(@{$defspec{node}->{'attrs'}}, @nodeattrs); push(@{$defspec{group}->{'attrs'}}, @nodeattrs); To answer your "Question 2", lsdef -z, mkdef -z is probably the easiest way to copy a def object to get all the attrs set correctly in all the tables. With the above fix, you should be able to handle all your custom group attrs as well. Linda Mellor From: "Pocina, Goran" <goran.poc...@deshawresearch.com> To: "'xCAT Users Mailing list'" <xcat-user@lists.sourceforge.net> Date: 02/13/2013 03:49 PM Subject: [xcat-user] "lsdef -t group" doesn't list data from custom tables. 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 xCAT-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xcat-user
<<inline: graycol.gif>>
------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________ xCAT-user mailing list xCAT-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xcat-user