HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/landscape/lib/__pycache__/vm_info.cpython-38.pyc
U

���cd�@sXdZddlZddlmZmZdZddd�Zdd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)zG
Network introspection utilities using ioctl and the /proc filesystem.
�N)�read_binary_file�read_text_file)Z
sys_vendorZchassis_vendorZbios_vendorZproduct_name�/cCsht|�rdSt|�rdStj�|d�}tD]4}tj�||�}tj�|�sJq*t|�}|r*|Sq*t|�S)a
    Return a bytestring with the virtualization type if it's known, an empty
    bytestring otherwise.

    It loops through some possible configurations and return a bytestring with
    the name of the technology being used or None if there's no match
    sopenvzsxenzsys/class/dmi/id)	�
_is_vm_openvz�
_is_vm_xen�os�path�join�	DMI_FILES�exists�_get_vm_by_vendor�_get_vm_legacy)�	root_pathZ
dmi_info_pathZ
dmi_info_fileZdmi_vendor_path�vendor�r�7/usr/lib/python3/dist-packages/landscape/lib/vm_info.py�get_vm_infos
r�/runcCs8dD].}tj�||�}tj�|�rt|���SqdS)zu
    Return a string with the type of container the client is running in, if
    any, an empty string otherwise.
    )Zcontainer_typezsystemd/container�)rrr	rr�strip)�run_path�filenamerrrr�get_container_info's
rcCs$tj�|d�}tj�|�o"t�|�S)z*Check if the host is virtualized with Xen.zsys/bus/xen/devices)rrr	�isdir�listdir)rZsys_xen_pathrrrr3srcCstj�tj�|d��S)z-Check if the host is virtualized with OpenVZ.zproc/vz)rrrr	)rrrrr:srcCs6t|dd���}d}|D]\}}||kr|SqdS)zDReturn the VM type byte string (possibly empty) based on the vendor.i)�limit)
)s
amazon ec2�kvm)sbochsr)sdigitaloceanr)sgooglesgce)sinnoteks
virtualbox)s	microsoftshyperv)snutanixr)s	openstackr)sqemur)rr)�vmwarer)srhevr)s	parallelsr�)r�lower)Zsys_vendor_pathrZcontent_vendors_map�nameZvm_typerrrr?s
rc	CsBzttj�|d��}Wnttfk
r0YdSXd|kr>dSdS)zBCheck if the host is virtualized looking at /proc/cpuinfo content.zproc/cpuinforZqemur)rrrr	�IOError�OSError)rZcpuinforrrr
[sr
)r)r)�__doc__rZlandscape.lib.fsrrr
rrrrrr
rrrr�<module>s