Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
4afc0a5c
Commit
4afc0a5c
authored
May 31, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3044 from chrisgardner/solaris_facts
Solaris facts
parents
d5182f5c
2b71ab67
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
5 deletions
+37
-5
library/system/setup
+37
-5
No files found.
library/system/setup
View file @
4afc0a5c
...
...
@@ -668,15 +668,47 @@ class SunOSHardware(Hardware):
return
self
.
facts
def
get_cpu_facts
(
self
):
rc
,
out
,
err
=
module
.
run_command
(
"/usr/sbin/psrinfo -v"
)
physid
=
0
sockets
=
{}
rc
,
out
,
err
=
module
.
run_command
(
"/usr/bin/kstat cpu_info"
)
self
.
facts
[
'processor'
]
=
[]
for
line
in
out
.
split
(
'
\n
'
):
if
'processor operates'
in
line
:
if
len
(
line
)
<
1
:
continue
data
=
line
.
split
(
None
,
1
)
key
=
data
[
0
]
.
strip
()
# "brand" works on Solaris 10 & 11. "implementation" for Solaris 9.
if
key
==
'module:'
:
brand
=
''
elif
key
==
'brand'
:
brand
=
data
[
1
]
.
strip
()
elif
key
==
'clock_MHz'
:
clock_mhz
=
data
[
1
]
.
strip
()
elif
key
==
'implementation'
:
processor
=
brand
or
data
[
1
]
.
strip
()
# Add clock speed to description for SPARC CPU
if
self
.
facts
[
'machine'
]
!=
'i86pc'
:
processor
+=
" @ "
+
clock_mhz
+
"MHz"
if
'processor'
not
in
self
.
facts
:
self
.
facts
[
'processor'
]
=
[]
self
.
facts
[
'processor'
]
.
append
(
line
.
strip
())
self
.
facts
[
'processor_cores'
]
=
'NA'
self
.
facts
[
'processor_count'
]
=
len
(
self
.
facts
[
'processor'
])
self
.
facts
[
'processor'
]
.
append
(
processor
)
elif
key
==
'chip_id'
:
physid
=
data
[
1
]
.
strip
()
if
physid
not
in
sockets
:
sockets
[
physid
]
=
1
else
:
sockets
[
physid
]
+=
1
# Counting cores on Solaris can be complicated.
# https://blogs.oracle.com/mandalika/entry/solaris_show_me_the_cpu
# Treat 'processor_count' as physical sockets and 'processor_cores' as
# virtual CPUs visisble to Solaris. Not a true count of cores for modern SPARC as
# these processors have: sockets -> cores -> threads/virtual CPU.
if
len
(
sockets
)
>
0
:
self
.
facts
[
'processor_count'
]
=
len
(
sockets
)
self
.
facts
[
'processor_cores'
]
=
reduce
(
lambda
x
,
y
:
x
+
y
,
sockets
.
values
())
else
:
self
.
facts
[
'processor_cores'
]
=
'NA'
self
.
facts
[
'processor_count'
]
=
len
(
self
.
facts
[
'processor'
])
def
get_memory_facts
(
self
):
rc
,
out
,
err
=
module
.
run_command
([
"/usr/sbin/prtconf"
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment