Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/landscape/lib/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/landscape/lib/vm_info.pyc

ó
ÍÿŠTc@sbdZddlZddlmZdd„Zdd„Zd„Zd	„Zd
„Zd„Z	dS(sG
Network introspection utilities using ioctl and the /proc filesystem.
iÿÿÿÿN(t	read_filet/csn‡fd†}tˆƒrdStˆƒr/dStjjˆdƒ}tjj|ƒr`t|ƒStˆƒSdS(sö
    Return a string with the virtualization type if it's known, an empty string
    otherwise.

    It loops through some possible configurations and return a string with
    the name of the technology being used or None if there's no match
    cstjjˆ|ƒS(N(tostpathtjoin(R(t	root_path(s9/usr/lib/python2.7/dist-packages/landscape/lib/vm_info.pytjoin_root_pathstopenvztxenssys/class/dmi/id/sys_vendorN(t
_is_vm_openvzt
_is_vm_xenRRRtexistst_get_vm_by_vendort_get_vm_legacy(RRtsys_vendor_path((Rs9/usr/lib/python2.7/dist-packages/landscape/lib/vm_info.pytget_vm_info	s
s/run/container_typecCs&tjj|ƒr"t|ƒjƒSdS(su
    Return a string with the type of container the client is running in, if
    any, an empty string otherwise.
    t(RRRRtstrip(R((s9/usr/lib/python2.7/dist-packages/landscape/lib/vm_info.pytget_container_info scCsugdD]}tjj||ƒ^q}ttjj|ƒrAtStjj|dƒ}tjj|ƒottj|ƒS(s*Check if the host is virtualized with Xen.sproc/sys/xensproc/xenssys/bus/xen/devices(sproc/sys/xensproc/xen(RRRtfilterRtTruetisdirtlistdir(RRt	xen_pathstsys_xen_path((s9/usr/lib/python2.7/dist-packages/landscape/lib/vm_info.pyR
(s%cCstjjtjj|dƒƒS(s-Check if the host is virtualized with OpenVZ.sproc/vz(RRRR(R((s9/usr/lib/python2.7/dist-packages/landscape/lib/vm_info.pyR	7scCsXt|ƒjƒ}d
ddddddf}x$|D]\}}||kr4|Sq4WdS(s?Return the VM type string (possibly empty) based on the vendor.tbochstkvmtgoogletgcetinnotekt
virtualboxt	microsoftthypervt	openstacktqemutvmwareR(RR(RR(RR(RR (R!R(R"R(R#R#(Rtlower(Rtvendortcontent_vendors_maptnametvm_type((s9/usr/lib/python2.7/dist-packages/landscape/lib/vm_info.pyR<s	cCsNyttjj|dƒƒ}Wnttfk
r9dSXd|krJdSdS(sBCheck if the host is virtualized looking at /proc/cpuinfo content.sproc/cpuinfoRR"R(RRRRtIOErrortOSError(Rtcpuinfo((s9/usr/lib/python2.7/dist-packages/landscape/lib/vm_info.pyR
Os(
t__doc__Rtlandscape.lib.fsRRRR
R	RR
(((s9/usr/lib/python2.7/dist-packages/landscape/lib/vm_info.pyt<module>s