File: //usr/lib/python3/dist-packages/landscape/lib/__pycache__/vm_info.cpython-38.pyc
U
���cd � @ sX d Z ddlZddlmZmZ dZddd�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_vendorZproduct_name�/c C sh t | �rdS t| �rdS tj�| d�}tD ]4}tj�||�}tj�|�sJq*t|�}|r*| S q*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
s openvzs xenzsys/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 �/runc C s8 dD ].}t j�| |�}t j�|�rt|��� S qdS )zu
Return a string with the type of container the client is running in, if
any, an empty string otherwise.
)Zcontainer_typezsystemd/container� )r r r r r �strip)�run_path�filenamer r r r �get_container_info'