Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Customer]Postscripts set in groups don't apply correctly to nodes inheriting postscripts from multiple groups #115

Closed
samveen opened this issue Aug 24, 2015 · 8 comments

Comments

@samveen
Copy link
Member

samveen commented Aug 24, 2015

Postscript definitions for relevant groups:

[root@inframgtlivexcatmn1 ~]# lsdef -t group -o AllRackA25-AU121,ID-LZD-ALICE-STAG,centos7,ilo,all -i postscripts
Object name: AllRackA25-AU121
    postscripts=
Object name: ID-LZD-ALICE-STAG
    postscripts=
Object name: all
    postscripts=
Object name: centos7
    postscripts=disableNetwork_Manager,alter_yum_centos,enable_epel_centos
Object name: ilo
    postscripts=

Relevant node fields:

[root@inframgtlivexcatmn1 ~]# lsdef -t node -o idlzdstagalice1 -i groups,postscripts
Object name: idlzdstagalice1
    groups=AllRackA25-AU121,ID-LZD-ALICE-STAG,centos7,ilo,all
    postscripts=syslog,remoteshell,syncfiles,disableNetwork_Manager,alter_yum_centos,enable_epel_centos

Changing the post scripts:

[root@inframgtlivexcatmn1 ~]# chdef -t group -o AllRackA25-AU121 -p postscripts=confignics
1 object definitions have been created or modified.
[root@inframgtlivexcatmn1 ~]# lsdef -t group -o AllRackA25-AU121,ID-LZD-ALICE-STAG,centos7,ilo,all -i postscripts
Object name: AllRackA25-AU121
    postscripts=confignics
Object name: ID-LZD-ALICE-STAG
    postscripts=
Object name: all
    postscripts=
Object name: centos7
    postscripts=disableNetwork_Manager,alter_yum_centos,enable_epel_centos
Object name: ilo
    postscripts=

Relevant postscripts after changes to group:

[root@inframgtlivexcatmn1 ~]# lsdef -t node -o idlzdstagalice1 -i groups,postscripts
Object name: idlzdstagalice1
    groups=AllRackA25-AU121,ID-LZD-ALICE-STAG,centos7,ilo,all
    postscripts=syslog,remoteshell,syncfiles,confignics

Change back to old config:

[root@inframgtlivexcatmn1 ~]# chdef -t group -o AllRackA25-AU121 -m postscripts=confignics
1 object definitions have been created or modified.
[root@inframgtlivexcatmn1 ~]# lsdef -t group -o AllRackA25-AU121,ID-LZD-ALICE-STAG,centos7,ilo,all -i postscripts
Object name: AllRackA25-AU121
    postscripts=
Object name: ID-LZD-ALICE-STAG
    postscripts=
Object name: all
    postscripts=
Object name: centos7
    postscripts=disableNetwork_Manager,alter_yum_centos,enable_epel_centos
Object name: ilo
    postscripts=
[root@inframgtlivexcatmn1 ~]# lsdef -t node -o idlzdstagalice1 -i groups,postscripts
Object name: idlzdstagalice1
    groups=AllRackA25-AU121,ID-LZD-ALICE-STAG,centos7,ilo,all
    postscripts=syslog,remoteshell,syncfiles,disableNetwork_Manager,alter_yum_centos,enable_epel_centos

Expected value is that the postscripts for all the node's groups should be applied to the node in the groups' order, not just the first group with poscripts.

[root@inframgtlivexcatmn1 ~]# lsdef -t node -o idlzdstagalice1 -i groups,postscripts
Object name: idlzdstagalice1
    groups=AllRackA25-AU121,ID-LZD-ALICE-STAG,centos7,ilo,all
    postscripts=syslog,remoteshell,syncfiles,confignics,disableNetwork_Manager,alter_yum_centos,enable_epel_centos

This problem may apply to other fields which should combine values from multiple groups, and may be a consequence of fields that must not be overridden (as in, later groups shouldn't be able to override prior values, set by higher priority/earlier groups).

NOTE: Due to the nature of the problem, this may actually be a feature request instead of a bug report. I'm investigating the code to see if I can figure out a solution.

@daniceexi
Copy link
Contributor

@samveen
The current logic to apply the attribute from node group is to use the node specific first, if no, use the attribute from group which is the 'first one' of all groups for the node. 'first one' means the first group when xcat code traversing all the groups.

You should take a look of the code in table.pm->getNodeAttribs_nosub_returnany()

@daniceexi
Copy link
Contributor

@jjohnson42

Do you know the background that why xCAT group mechanism did not consider to concatenate attributes, but just select one of them?

I saw there was code logic to handle the keyword 'NEXTRECORD' which can be used to do the similar thing to append attribute value to another from group, do you know the use case of this feature?

@samveen
Copy link
Member Author

samveen commented Aug 31, 2015

@daniceexi
Yes, this behaviour required for most fields. However when it comes to set based fields for nodes(like postscripts and postbootscripts), this might not be the way to go.

@jjohnson42
As daniceexi said, it would be great to get some historical perspective on the xCAT group mechanics as they currently are versus the bevaviour I'm looking for with regards to postscripts.

@whowutwut whowutwut added this to the 2.12 milestone Nov 9, 2015
@samveen
Copy link
Member Author

samveen commented Nov 13, 2015

Possible design:

  • New site variable: heirarchicalpostscripts (Table:site - Key:heirarchicalpostscripts).
  • If False(or unset), preserve current behaviour.
  • If True, change behaviour of xCAT data model to group postscripts of all groups in a node's group list appended to site default postscripts. Order of groups is order of postscripts and ordered set semantics apply to the set of postscripts. (duplicate scripts are added just once, and priority is first incidence of the script. Site default scripts have highest priority(?)). Postscripts set for a node (postscripts.postscripts for node==$nodename) should be added to the end of the above set, instead of the current behaviour which is to override node postscripts with the first seen group postscripts.

@tingtli tingtli changed the title Postscripts set in groups don't apply correctly to nodes inheriting postscripts from multiple groups [Customer]Postscripts set in groups don't apply correctly to nodes inheriting postscripts from multiple groups Mar 23, 2016
@chenglch
Copy link
Contributor

Hi @samveen , if you set group attribute of AllRackA25-AU121 in postscripts table like this:
"AllRackA25-AU121","confignics,+=NEXTRECORD",,,
the attributes in centos7 group may be added to the end of confignics.

I prepare to add a site variable heirarchicalattrtable like
"heirarchicalattrtable","postscripts,prescripts"
which means the attributes in postscripts table and postscripts table will not be override but will be added to the end of the above set (except the repeat one).

Does this solve your problem ?

@samveen
Copy link
Member Author

samveen commented Apr 11, 2016

@chenglch , Yes, I think that would solve my problems very well. The design I proposed was just an idea, and I think that your approach to make this a more general design for all attributes is a great improvement to the design I proposed.
My apologies on the delayed response, as I have been busy with another project.

chenglch added a commit to chenglch/xcat-core that referenced this issue Apr 22, 2016
'heirarchicalattrs' is added in site table to apply attributes
from multiple groups in order.

close-issue xcat2#115
@samveen
Copy link
Member Author

samveen commented Apr 29, 2016

@chenglch Elegantly done.

@daniceexi This can be closed at your convenience.

@arif-ali
Copy link
Contributor

👍 nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants