I have not tried this, but can you append the following to your desres.pm 
file?

@{$defspec{group}->{'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',
    },
);

Or simplify the code like this:
my @nodeattrs=
(
    {          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',
    },
);
push(@{$defspec{node}->{'attrs'}}, @nodeattrs);
push(@{$defspec{group}->{'attrs'}}, @nodeattrs);

Ling

Ling Gao
Poughkeepsie Unix Development Lab
IBM Systems and Technology Group
Internal: T/L 293-5692 
External: [email protected], 845-433-5692

"I never worry about the future. It comes soon enough." --- Albert 
Einstein 



From:   "Pocina, Goran" <[email protected]>
To:     xCAT Users Mailing list <[email protected]>
Date:   02/13/2013 05:10 PM
Subject:        Re: [xcat-user] "lsdef -t group" doesn't list data from 
custom tables.



For nodes we normally use lsdef, and it works great, showing our custom 
table data whether its assigned at the node level, or via a group.
 
A “nodegrpls” would be all we’d need, I think, to easily copy groups. I’m 
sure we could tweak the output and pipe it to “mkdef –z” to copy groups.
 
Thanks,
 
Goran
 
From: Jarrod B Johnson [mailto:[email protected]] 
Sent: Wednesday, February 13, 2013 4:49 PM
To: xCAT Users Mailing list
Subject: Re: [xcat-user] "lsdef -t group" doesn't list data from custom 
tables.
 
I think that the 'object definitions' aren't extensible in the same manner 
that the table schema is....

The issue is basically, the tables and columns must be defined.  It is an 
optional step for developer to describe the way that an object definition 
maps to the table.  Schema plugins can therefore extend the tables without 
extending the object definitions.  It's a tad more complicated than I'd 
like.....  

For nodes, do you normally use nodels or do you prefer lsdef?  For  nodels 
equivalent, I could whip up a 'nodegrpls' in short order.  In a more 
medium term future, we can probably extend the customization support to 
allow for custom object definition attirbutes.

"Pocina, Goran" ---02/13/2013 01:34:01 PM---When we list the attributes of 
the nodes, everything looks good, whether we’re listing attributes fo

From: "Pocina, Goran" <[email protected]>
To: xCAT Users Mailing list <[email protected]>
Date: 02/13/2013 01:34 PM
Subject: Re: [xcat-user] "lsdef -t group" doesn't list data from custom 
tables.




When we list the attributes of the nodes, everything looks good, whether 
we’re listing attributes for a single node, or a group of nodes. 
 
The problem occurs when we list the attributes of a group.  We should see 
some attributes that start with “x_” be we don’t.  The group does, in 
fact, have additional attributes, but lsdef isn’t showing them.
 
[root@drdkvm0003 xcat]# lsdef -l -t group -o 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
 
Tabdump shows the group definition, as does the “nodels –b” command in the 
initial post:
 
[root@drdkvm0003 xcat]# tabdump x_desres | grep -E "node|cm-lev"
#node,x_desresrepo,x_v2repo,x_updrepo,x_partinfo,comments,disable
"cm-lev","repo-c5desres","repo-anton-v2-lev","repo-c59updates","part.default",,
 
 
 
From: Lissa Valletta [mailto:[email protected]] 
Sent: Wednesday, February 13, 2013 4:16 PM
To: xCAT Users Mailing list
Cc: 'xCAT Users Mailing list'
Subject: Re: [xcat-user] "lsdef -t group" doesn't list data from custom 
tables.
 
I think maybe you are not using the correct form of lsdef    You are 
listing the attributes of the group (1)  Do you not want to do the second 
one ( 2).

1)To list all the attributes of the group "service".

           lsdef -l -t group -o service

2) To list all the attributes of the nodes that are members of the
          group "service".

           lsdef -t node -l service

Lissa K. Valletta
8-3/B10
Poughkeepsie, NY 12601
(tie 293) 433-3102



"Pocina, Goran" ---02/13/2013 03:50:56 PM---Hi, We use xCAT's excellent 
custom table feature to add our own node/group specific table: x_desres.

From: "Pocina, Goran" <[email protected]>
To: "'xCAT Users Mailing list'" <[email protected]>
Date: 02/13/2013 03:50 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/xcat-user
------------------------------------------------------------------------------
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
------------------------------------------------------------------------------
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


<<image/gif>>

<<image/gif>>

------------------------------------------------------------------------------
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

Reply via email to