mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #3181 from melodous/devel
HP-UX virtualization facts
This commit is contained in:
commit
936e61fc28
1 changed files with 39 additions and 0 deletions
|
@ -1875,6 +1875,45 @@ class LinuxVirtual(Virtual):
|
|||
self.facts['virtualization_role'] = 'host'
|
||||
return
|
||||
|
||||
class HPUXVirtual(Virtual):
|
||||
"""
|
||||
This is a HP-UX specific subclass of Virtual. It defines
|
||||
- virtualization_type
|
||||
- virtualization_role
|
||||
"""
|
||||
platform = 'HP-UX'
|
||||
|
||||
def __init__(self):
|
||||
Virtual.__init__(self)
|
||||
|
||||
def populate(self):
|
||||
self.get_virtual_facts()
|
||||
return self.facts
|
||||
|
||||
def get_virtual_facts(self):
|
||||
if os.path.exists('/usr/sbin/vecheck'):
|
||||
rc, out, err = module.run_command("/usr/sbin/vecheck")
|
||||
if rc == 0:
|
||||
self.facts['virtualization_type'] = 'guest'
|
||||
self.facts['virtualization_role'] = 'HP vPar'
|
||||
if os.path.exists('/opt/hpvm/bin/hpvminfo'):
|
||||
rc, out, err = module.run_command("/opt/hpvm/bin/hpvminfo")
|
||||
if rc == 0 and re.match('.*Running.*HPVM vPar.*', out):
|
||||
self.facts['virtualization_type'] = 'guest'
|
||||
self.facts['virtualization_role'] = 'HPVM vPar'
|
||||
elif rc == 0 and re.match('.*Running.*HPVM guest.*', out):
|
||||
self.facts['virtualization_type'] = 'guest'
|
||||
self.facts['virtualization_role'] = 'HPVM IVM'
|
||||
elif rc == 0 and re.match('.*Running.*HPVM host.*', out):
|
||||
self.facts['virtualization_type'] = 'host'
|
||||
self.facts['virtualization_role'] = 'HPVM'
|
||||
if os.path.exists('/usr/sbin/parstatus'):
|
||||
rc, out, err = module.run_command("/usr/sbin/parstatus")
|
||||
if rc == 0:
|
||||
self.facts['virtualization_type'] = 'guest'
|
||||
self.facts['virtualization_role'] = 'HP nPar'
|
||||
|
||||
|
||||
class SunOSVirtual(Virtual):
|
||||
"""
|
||||
This is a SunOS-specific subclass of Virtual. It defines
|
||||
|
|
Loading…
Reference in a new issue