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
5e68143c
Commit
5e68143c
authored
Feb 13, 2013
by
Maykel Moya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check presence of files under /proc before opening them
parent
8b27085c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
22 deletions
+24
-22
library/setup
+24
-22
No files found.
library/setup
View file @
5e68143c
...
...
@@ -967,31 +967,33 @@ class LinuxVirtual(Virtual):
self
.
facts
[
'virtualization_role'
]
=
'guest'
return
for
line
in
open
(
'/proc/self/status'
)
.
readlines
():
if
re
.
match
(
'^VxID:
\
d+'
,
line
):
self
.
facts
[
'virtualization_type'
]
=
'linux_vserver'
if
re
.
match
(
'^VxID: 0'
,
line
):
self
.
facts
[
'virtualization_role'
]
=
'host'
if
os
.
path
.
exists
(
'/proc/self/status'
):
for
line
in
open
(
'/proc/self/status'
)
.
readlines
():
if
re
.
match
(
'^VxID:
\
d+'
,
line
):
self
.
facts
[
'virtualization_type'
]
=
'linux_vserver'
if
re
.
match
(
'^VxID: 0'
,
line
):
self
.
facts
[
'virtualization_role'
]
=
'host'
else
:
self
.
facts
[
'virtualization_role'
]
=
'guest'
return
if
os
.
path
.
exists
(
'/proc/cpuinfo'
):
for
line
in
open
(
'/proc/cpuinfo'
)
.
readlines
():
if
re
.
match
(
'^model name.*QEMU Virtual CPU'
,
line
):
self
.
facts
[
'virtualization_type'
]
=
'kvm'
elif
re
.
match
(
'^vendor_id.*User Mode Linux'
,
line
):
self
.
facts
[
'virtualization_type'
]
=
'uml'
elif
re
.
match
(
'^model name.*UML'
,
line
):
self
.
facts
[
'virtualization_type'
]
=
'uml'
elif
re
.
match
(
'^vendor_id.*PowerVM Lx86'
,
line
):
self
.
facts
[
'virtualization_type'
]
=
'powervm_lx86'
elif
re
.
match
(
'^vendor_id.*IBM/S390'
,
line
):
self
.
facts
[
'virtualization_type'
]
=
'ibm_systemz'
else
:
self
.
facts
[
'virtualization_role'
]
=
'guest'
continue
self
.
facts
[
'virtualization_role'
]
=
'guest'
return
for
line
in
open
(
'/proc/cpuinfo'
)
.
readlines
():
if
re
.
match
(
'^model name.*QEMU Virtual CPU'
,
line
):
self
.
facts
[
'virtualization_type'
]
=
'kvm'
elif
re
.
match
(
'^vendor_id.*User Mode Linux'
,
line
):
self
.
facts
[
'virtualization_type'
]
=
'uml'
elif
re
.
match
(
'^model name.*UML'
,
line
):
self
.
facts
[
'virtualization_type'
]
=
'uml'
elif
re
.
match
(
'^vendor_id.*PowerVM Lx86'
,
line
):
self
.
facts
[
'virtualization_type'
]
=
'powervm_lx86'
elif
re
.
match
(
'^vendor_id.*IBM/S390'
,
line
):
self
.
facts
[
'virtualization_type'
]
=
'ibm_systemz'
else
:
continue
self
.
facts
[
'virtualization_role'
]
=
'guest'
return
# Beware that we can have both kvm and virtualbox running on a single system
if
os
.
path
.
exists
(
"/proc/modules"
):
modules
=
[]
...
...
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