Streamline code
This commit is contained in:
parent
d75681abdc
commit
4301a33b97
1 changed files with 8 additions and 18 deletions
26
setup
26
setup
|
@ -776,28 +776,18 @@ class LinuxVirtual(Virtual):
|
||||||
for line in open('/proc/cpuinfo').readlines():
|
for line in open('/proc/cpuinfo').readlines():
|
||||||
if re.match('^model name.*QEMU Virtual CPU', line):
|
if re.match('^model name.*QEMU Virtual CPU', line):
|
||||||
self.facts['virtualization_type'] = 'kvm'
|
self.facts['virtualization_type'] = 'kvm'
|
||||||
self.facts['virtualization_role'] = 'guest'
|
elif re.match('^vendor_id.*User Mode Linux', line):
|
||||||
return
|
|
||||||
|
|
||||||
if re.match('^vendor_id.*User Mode Linux', line):
|
|
||||||
self.facts['virtualization_type'] = 'uml'
|
self.facts['virtualization_type'] = 'uml'
|
||||||
self.facts['virtualization_role'] = 'guest'
|
elif re.match('^model name.*UML', line):
|
||||||
return
|
|
||||||
|
|
||||||
if re.match('^model name.*UML', line):
|
|
||||||
self.facts['virtualization_type'] = 'uml'
|
self.facts['virtualization_type'] = 'uml'
|
||||||
self.facts['virtualization_role'] = 'guest'
|
elif re.match('^vendor_id.*PowerVM Lx86', line):
|
||||||
return
|
|
||||||
|
|
||||||
if re.match('^vendor_id.*PowerVM Lx86', line):
|
|
||||||
self.facts['virtualization_type'] = 'powervm_lx86'
|
self.facts['virtualization_type'] = 'powervm_lx86'
|
||||||
self.facts['virtualization_role'] = 'guest'
|
elif re.match('^vendor_id.*IBM/S390', line):
|
||||||
return
|
|
||||||
|
|
||||||
if re.match('^vendor_id.*IBM/S390', line):
|
|
||||||
self.facts['virtualization_type'] = 'ibm_systemz'
|
self.facts['virtualization_type'] = 'ibm_systemz'
|
||||||
self.facts['virtualization_role'] = 'guest'
|
else:
|
||||||
return
|
continue
|
||||||
|
self.facts['virtualization_role'] = 'guest'
|
||||||
|
return
|
||||||
|
|
||||||
# Beware that we can have both kvm and virtualbox running on a single system
|
# Beware that we can have both kvm and virtualbox running on a single system
|
||||||
if os.path.exists("/proc/modules"):
|
if os.path.exists("/proc/modules"):
|
||||||
|
|
Loading…
Reference in a new issue