mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
add XEN support to virt.py
This commit is contained in:
parent
7ad3728290
commit
09860b447c
@ -501,7 +501,7 @@ def virt_type():
|
||||
|
||||
def is_kvm_hyper():
|
||||
'''
|
||||
Returns a bool whether or not this node is a hypervisor
|
||||
Returns a bool whether or not this node is a KVM hypervisor
|
||||
|
||||
CLI Example::
|
||||
|
||||
@ -512,3 +512,27 @@ def is_kvm_hyper():
|
||||
if 'kvm_' not in open('/proc/modules').read():
|
||||
return False
|
||||
return 'libvirtd' in __salt__['cmd.run'](__grains__['ps'])
|
||||
|
||||
def is_xen_hyper():
|
||||
'''
|
||||
Returns a bool whether or not this node is a XEN hypervisor
|
||||
|
||||
CLI Example::
|
||||
|
||||
salt '*' virt.is_xen_hyper
|
||||
'''
|
||||
if __grains__['virtual_subtype'] != 'Xen Dom0':
|
||||
return False
|
||||
if 'xen_' not in open('/proc/modules').read():
|
||||
return False
|
||||
return 'libvirtd' in __salt__['cmd.run'](__grains__['ps'])
|
||||
|
||||
def is_hyper():
|
||||
'''
|
||||
Returns a bool whether or not this nos is a hypervisor of any kind
|
||||
|
||||
CLI Example::
|
||||
|
||||
salt '*' virt.is_hyper
|
||||
'''
|
||||
return is_xen_hyper() or is_kvm_hyper()
|
||||
|
Loading…
Reference in New Issue
Block a user