Jira (FACT-2834) Hardcoded proc0 processor name in resolvers/aix/architecture_resolver.rb and related files

24 views
Skip to first unread message

Donatas Rimkus (Jira)

unread,
Oct 8, 2020, 7:10:04 AM10/8/20
to puppe...@googlegroups.com
Donatas Rimkus created an issue
 
Facter / Bug FACT-2834
Hardcoded proc0 processor name in resolvers/aix/architecture_resolver.rb and related files
Issue Type: Bug Bug
Assignee: Unassigned
Components: Facter 4
Created: 2020/10/08 4:09 AM
Priority: Normal Normal
Reporter: Donatas Rimkus

There is a hardcoded "proc0" reference to a processor name in AIX in the following files:

lib/facter/resolvers/aix/architecture_resolver.rb
spec/facter/resolvers/aix/architecture_resolver_spec.rb
spec/facter/resolvers/aix/processors_spec.rb
spec/fixtures/processors_cuat
spec/fixtures/processors_cudv

If a processor with this name is not present on the system, executing facter produces the following errors (on facter 2.5.1 that we actually use in our environment):

lsattr: 0514-519 The following device was not found in the customized
{{ device configuration database:}}
{{ proc0}}

I understand that facter 4 does not use lsattr command anymore, but queries the ODM instead. Nevertheless the hardcoded "proc0" in the code suggests that the issue is present in newest version as well.

 

The issue

If VCPU assignment for an AIX LPAR is reduced, it can happen that proc0 is deleted or unconfigured (set to the Defined state). This would lead to the following outcomes:

  • proc0 deleted:  unable to determine system architecture because the expected device "proc0" is not there
  • proc0 Defined: might detect architecture incorrectly. This can happen for example if proc0 was unconfigured (set to Defined) on one architecture machine (e.g. POWER8), and then moved to different one (e.g. POWER9). The details of the Defined processor resource will still show POWER8, which is incorrect.
    Example:
    [root@sibwi110:/home/root(22)]# lsdev | grep proc | head 2proc0 Available 00-00 Processorproc2 Defined 00-02 Processor[root@sibwi110:/home/root(23)]# lsattr -El proc0 }}{{frequency 4190000000 Processor Speed Falsesmt_enabled true Processor SMT enabled Falsesmt_threads 8 Processor SMT threads Falsestate enable Processor state Falsetype PowerPC_POWER8 Processor type False   <----- current/correct architecture[root@sibwi110:/home/root(24)]# lsattr El proc2frequency 4208000000 Processor Speed Falsesmt_enabled true Processor SMT enabled Falsesmt_threads 2 Processor SMT threads Falsestate enable Processor state Falsetype PowerPC_POWER6 Processor type False  <---- wrong, recorded on previous machine{{[root@sibwi110:/home/root(25)]# }}

Proposed solution

In order to mitigate this, I suggest to replace the hardcoded "proc0" by a dynamic value, which can be queried in the ODM. All active processors (in Available state) will report the same correct architecture, therefore it's enough to query just one of them.

The active (i.e. Available) processors can be identified by "status = 1" value in CuDv ODM object class. A command line example to do this could be:

odmget -q "PdDvLn = processor/sys/proc_rspc and status = 1" CuDv | grep name | head -1

For example:

[root@sibwi110:/home/root(31)]# odmget -q "PdDvLn = processor/sys/proc_rspc and status = 1" CuDv | grep name | head -1
{{ name = "proc0"}}

 

Another example on a server where "proc0" does not exist:

{{[root@aix-lpar:/home/root(3)]# lsdev | grep proc }}
proc4 Defined 00-04 Processor
proc8 Available 00-08 Processor
[root@aix-lpar:/home/root(4)]# odmget -q "PdDvLn = processor/sys/proc_rspc and status = 1" CuDv | grep name | head -1
{{ name = "proc8"}}

 

For reference, here are the full stanzas on the latter LPAR:

[root@aix-lpar:/home/root(5)]# odmget -q "PdDvLn = processor/sys/proc_rspc" CuDv

CuDv:
    name = "proc4"
    }}{{status = 0
    }}{{chgstatus = 3
    }}{{ddins = ""
    }}{{location = "00-04"
    }}{{parent = "sysplanar0"
    }}{{connwhere = "P4"
    }}{{PdDvLn = "processor/sys/proc_rspc"

 

CuDv:
    }}{{name = "proc8"
    }}{{status = 1
    }}{{chgstatus = 2
    }}{{ddins = ""
    }}{{location = "00-08"
    }}{{parent = "sysplanar0"
    }}{{connwhere = "P8"
    }}{{ PdDvLn = "processor/sys/proc_rspc"

 

 

 

 

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Donatas Rimkus (Jira)

unread,
Oct 8, 2020, 7:11:04 AM10/8/20
to puppe...@googlegroups.com
Donatas Rimkus updated an issue
Change By: Donatas Rimkus
There is a hardcoded "proc0" reference to a processor name in AIX in the following files:

lib/facter/resolvers/aix/architecture_resolver.rb
spec/facter/resolvers/aix/architecture_resolver_spec.rb
spec/facter/resolvers/aix/processors_spec.rb
spec/fixtures/processors_cuat
spec/fixtures/processors_cudv

If a processor with this name is not present on the system, executing facter produces the following errors (on facter 2.5.1 that we actually use in our environment):

{{lsattr: 0514-519 The following device was not found in the customized}}
\ {{ device configuration database:}}
\
{{ proc0}}


I understand that facter 4 does not use lsattr command anymore, but queries the ODM instead. Nevertheless the hardcoded "proc0" in the code suggests that the issue is present in newest version as well.

 
h2. The issue


If VCPU assignment for an AIX LPAR is reduced, it can happen that proc0 is deleted or unconfigured (set to the Defined state). This would lead to the following outcomes:
* proc0 deleted:  unable to determine system architecture because the expected device "proc0" is not there
* proc0 Defined: might detect architecture incorrectly. This can happen for example if proc0 was unconfigured (set to Defined) on one architecture machine (e.g. POWER8), and then moved to different one (e.g. POWER9). The details of the Defined processor resource will still show POWER8, which is incorrect.
Example:
{{[root@sibwi110:/home/root(22)]# lsdev | grep proc | head -2
- }}{{proc0 Available 00-00 Processor}}{{proc2 Defined 00-02 Processor}}{{[root@sibwi110:/home/root(23)]# lsattr -El proc0 }}{{frequency 4190000000 Processor Speed False}}{{smt_enabled true Processor SMT enabled False}}{{smt_threads 8 Processor SMT threads False}}{{state enable Processor state False}}{{type PowerPC_POWER8 Processor type False   <----- - current/correct architecture}}{{[root@sibwi110:/home/root(24)]# lsattr -El proc2 - }}{{frequency 4208000000 Processor Speed False}}{{smt_enabled true Processor SMT enabled False}}{{smt_threads 2 Processor SMT threads False}}{{state enable Processor state False}}{{type PowerPC_POWER6 Processor type False  <---- - wrong, recorded on previous machine}}{{[root@sibwi110:/home/root(25)]# }}

h2. Proposed solution

Donatas Rimkus (Jira)

unread,
Oct 8, 2020, 7:12:04 AM10/8/20
to puppe...@googlegroups.com
Donatas Rimkus updated an issue
There is a hardcoded "proc0" reference to a processor name in AIX in the following files:

lib/facter/resolvers/aix/architecture_resolver.rb
spec/facter/resolvers/aix/architecture_resolver_spec.rb
spec/facter/resolvers/aix/processors_spec.rb
spec/fixtures/processors_cuat
spec/fixtures/processors_cudv

If a processor with this name is not present on the system, executing facter produces the following errors (on facter 2.5.1 that we actually use in our environment):

{{
{{ lsattr: 0514-519 The following device was not found in the customized}} }}
\ {{ device configuration database:}}
\ {{  
proc0}}


I understand that facter 4 does not use lsattr command anymore, but queries the ODM instead. Nevertheless the hardcoded "proc0" in the code suggests that the issue is present in newest version as well.

 
h2. The issue

If VCPU assignment for an AIX LPAR is reduced, it can happen that proc0 is deleted or unconfigured (set to the Defined state). This would lead to the following outcomes:
* proc0 deleted:  unable to determine system architecture because the expected device "proc0" is not there
* proc0 Defined: might detect architecture incorrectly. This can happen for example if proc0 was unconfigured (set to Defined) on one architecture machine (e.g. POWER8), and then moved to different one (e.g. POWER9). The details of the Defined processor resource will still show POWER8, which is incorrect.
Example:
{{[root@sibwi110:/home/root(22)]# lsdev | grep proc | head -2-}}{{proc0 Available 00-00 Processor}}{{proc2 Defined 00-02 Processor}}{{[root@sibwi110:/home/root(23)]# lsattr -El proc0 }}{{frequency 4190000000 Processor Speed False - }}{{smt_enabled true Processor SMT enabled False}}{{smt_threads 8 Processor SMT threads False}}{{state enable Processor state False}}{{type PowerPC_POWER8 Processor type False   <---- - current/correct architecture}}{{[root@sibwi110:/home/root(24)]# lsattr -El proc2-}}{{frequency 4208000000 Processor Speed False}}{{smt_enabled true Processor SMT enabled False}}{{smt_threads 2 Processor SMT threads False}}{{state enable Processor state False}}{{type PowerPC_POWER6 Processor type False  <---- wrong, recorded on previous machine}}{{[root@sibwi110:/home/root(25)]# }}
{{ [root@sibwi110:/home/root(31)]# odmget -q "PdDvLn = processor/sys/proc_rspc and status = 1" CuDv | grep name | head -1}} }}

Donatas Rimkus (Jira)

unread,
Oct 8, 2020, 7:13:04 AM10/8/20
to puppe...@googlegroups.com

Donatas Rimkus (Jira)

unread,
Oct 8, 2020, 7:32:04 AM10/8/20
to puppe...@googlegroups.com
Donatas Rimkus updated an issue
There is a hardcoded "proc0" reference to a processor name in AIX in the following files:

lib/facter/resolvers/aix/architecture_resolver.rb
spec/facter/resolvers/aix/architecture_resolver_spec.rb
spec/facter/resolvers/aix/processors_spec.rb
spec/fixtures/processors_cuat
spec/fixtures/processors_cudv

If a processor with this name is not present on the system, executing facter produces the following errors (on facter 2.5.1 that we actually use in our environment):

{{lsattr: 0514-519 The following device was not found in the customized}}
\{{ device configuration database:}}
\{{ proc0}}

I understand that facter 4 does not use lsattr command anymore, but queries the ODM instead. Nevertheless the hardcoded "proc0" in the code suggests that the issue is present in newest version as well.

 
h2. The issue

If VCPU assignment for an AIX LPAR is reduced, it can happen that proc0 is deleted or unconfigured (set to the Defined state). This would lead to the following outcomes:
* proc0 deleted:  unable to determine system architecture because the expected device "proc0" is not there
* proc0 Defined: might detect architecture incorrectly. This can happen for example if proc0 was unconfigured (set to Defined) on one architecture machine (e.g. POWER8), and then moved to different one (e.g. POWER9). The details of the Defined processor resource will still show POWER8, which is incorrect.

Example:
{{[root@sibwi110:/home/root(
22 36 )]# lsdev | grep proc | head -2 - }}
{{proc0 Available 00-00 Processor}}
{{proc2 Defined 00-02 Processor}}
{{[root@sibwi110:/home/root( 23 37 )]# lsattr -El proc0 }}
{{frequency 4190000000 Processor Speed False}}
{{smt_enabled true Processor SMT enabled False}}
{{smt_threads 8 Processor SMT threads False}}
{{state enable Processor state False}}
{{type PowerPC_POWER8 Processor type False    <----- current/correct architecture }}
{{[root@sibwi110:/home/root( 24 38 )]# lsattr -El proc2- }} {{frequency 4208000000 Processor Speed False}}{{smt_enabled true Processor SMT enabled False}}{{smt_threads 2 Processor SMT threads False}}{{state enable Processor state False}}{{type PowerPC_POWER6 Processor type False  <---- wrong, recorded on previous machine}}{{[root@sibwi110:/home/root(25)]# }}

Donatas Rimkus (Jira)

unread,
Oct 8, 2020, 7:33:05 AM10/8/20
to puppe...@googlegroups.com

Donatas Rimkus (Jira)

unread,
Oct 8, 2020, 7:34:04 AM10/8/20
to puppe...@googlegroups.com
Donatas Rimkus updated an issue
Change By: Donatas Rimkus
Affects Version/s: FACT 2.5.1
Affects Version/s: FACT 4.0.38

Mihai Buzgau (Jira)

unread,
Oct 9, 2020, 2:43:03 AM10/9/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Oct 9, 2020, 2:43:04 AM10/9/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Oct 9, 2020, 2:44:03 AM10/9/20
to puppe...@googlegroups.com

Sebastian Miclea (Jira)

unread,
Oct 14, 2020, 9:23:03 AM10/14/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Oct 14, 2020, 10:06:03 AM10/14/20
to puppe...@googlegroups.com

Oana Tanasoiu (Jira)

unread,
Oct 15, 2020, 2:35:04 AM10/15/20
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages