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
f2742348
Commit
f2742348
authored
Jan 07, 2015
by
Adam Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only add the overhead for each iteration of cpuinfo parsing if Xen is detected
parent
3729259b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
lib/ansible/module_utils/facts.py
+19
-7
No files found.
lib/ansible/module_utils/facts.py
View file @
f2742348
...
...
@@ -609,7 +609,17 @@ class LinuxHardware(Hardware):
coreid
=
0
sockets
=
{}
cores
=
{}
xen
=
False
xen_paravirt
=
False
if
os
.
path
.
exists
(
'/proc/xen'
):
xen
=
True
try
:
if
open
(
'/sys/hypervisor/type'
)
.
readline
()
.
strip
()
==
'xen'
:
xen
=
True
except
IOError
:
pass
if
not
os
.
access
(
"/proc/cpuinfo"
,
os
.
R_OK
):
return
self
.
facts
[
'processor'
]
=
[]
...
...
@@ -617,6 +627,15 @@ class LinuxHardware(Hardware):
data
=
line
.
split
(
":"
,
1
)
key
=
data
[
0
]
.
strip
()
if
xen
:
if
key
==
'flags'
:
# Check for vme cpu flag, Xen paravirt does not expose this.
# Need to detect Xen paravirt because it exposes cpuinfo
# differently than Xen HVM or KVM and causes reporting of
# only a single cpu core.
if
'vme'
not
in
data
:
xen_paravirt
=
True
# model name is for Intel arch, Processor (mind the uppercase P)
# works for some ARM devices, like the Sheevaplug.
if
key
==
'model name'
or
key
==
'Processor'
or
key
==
'vendor_id'
:
...
...
@@ -628,13 +647,6 @@ class LinuxHardware(Hardware):
if
key
==
'model name'
:
model_name_occurrence
+=
1
i
+=
1
elif
key
==
'flags'
:
# Check for vme cpu flag, Xen paravirt does not expose this.
# Need to detect Xen paravirt because it exposes cpuinfo
# differently than Xen HVM or KVM and causes reporting of
# only a single cpu core.
if
'vme'
not
in
data
:
xen_paravirt
=
True
elif
key
==
'physical id'
:
physid
=
data
[
1
]
.
strip
()
if
physid
not
in
sockets
:
...
...
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