Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / os_win / utils / hostutils.pyc
Size: Mime:
ó
̍EYc@s¤ddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZej
eƒZdejfd	„ƒYZdS(
iÿÿÿÿN(tlog(t_(t_utils(t	constants(t
exceptions(t	baseutilst	HostUtilscBseZd ZdZdZdZdZdZdZ	e
jZdZ
dZdZd	d
„Zd„Zd„Zd
„Zd„Zdd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"d„Z#d„Z$RS(!tMsvm_ProcessortMsvm_Memoryt
Msvm_NumaNodesCentral ProcessoriiiBi9s//./root/cimv2t.cCs8tt|ƒj|ƒ|j|jddgƒ|_dS(Nt
privilegestShutdown(tsuperRt__init__t
_get_wmi_connt_wmi_cimv2_namespacet_conn_cimv2(tselfthost((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyR1scCs||jjdƒ}g}x]|D]U}i|jd6|jd6|jd6|jd6|jd6|jd6}|j|ƒqW|S(s@Returns dictionary containing information about the host's CPUs.sSELECT Architecture, Name, Manufacturer, MaxClockSpeed, NumberOfCores, NumberOfLogicalProcessors FROM Win32_Processor WHERE ProcessorType = 3tArchitecturetNametManufacturert
MaxClockSpeedt
NumberOfCorestNumberOfLogicalProcessors(	RtqueryRRRRRRtappend(Rtcpust	cpus_listtcputcpu_info((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt
get_cpus_info6s		






cCstjjj|ƒS(s1Checks if the host's CPUs have the given feature.(tctypestwindlltkernel32tIsProcessorFeaturePresent(Rtfeature_key((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytis_cpu_feature_presentLscCs2|jjdƒd}t|jƒt|jƒfS(s~Returns a tuple with total visible memory and free physical memory.

        The returned values are expressed in KB.
        sLSELECT TotalVisibleMemorySize, FreePhysicalMemory FROM win32_operatingsystemi(RRtinttTotalVisibleMemorySizetFreePhysicalMemory(Rtmem_info((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytget_memory_infoPscCs6|jjd|ƒd}t|jƒt|jƒfS(sãReturns a tuple with total size and free space of the given drive.

        Returned values are expressed in bytes.

        :param drive: the drive letter of the logical disk whose information
            is required.
        sASELECT Size, FreeSpace FROM win32_logicaldisk WHERE DeviceID='%s'i(RRR'tSizet	FreeSpace(Rtdrivetlogical_disk((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytget_volume_info^s	icCs7|jƒ}ttt|jdƒƒƒ|||gkS(s­Compares the host's kernel version with the given version.

        :returns: True if the host's kernel version is higher or equal to
            the given version.
        R
(tget_windows_versiontlisttmapR'tsplit(Rtmajortminortbuildtversion_str((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytcheck_min_windows_versionmscCs2tjs+|jjƒd}|jt_ntjS(s8Returns a string representing the host's kernel version.i(Rt_windows_versionRtWin32_OperatingSystemtVersion(RR;((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyR1vs	cCstjƒ}tj|ƒS(s)Returns the list of locally assigned IPs.(tsockettgethostnameRtget_ips(Rthostname((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt
get_local_ips}scCstjjjƒS(s#Returns host uptime in miliseconds.(R!R"R#tGetTickCount64(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytget_host_tick_count64‚scCsx|jjƒd}|tjkr5|j|jƒn?|tjkrW|j|jƒntt	dƒi|d6ƒ‚dS(Nis6Host %(action)s is not supported by the Hyper-V drivertaction(
RR;RtHOST_POWER_ACTION_SHUTDOWNt
Win32Shutdownt_HOST_FORCED_SHUTDOWNtHOST_POWER_ACTION_REBOOTt_HOST_FORCED_REBOOTtNotImplementedErrorR(RRDtwin32_os((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pythost_power_action†s	cCs0|jddƒr"tjtjgStjgSdS(s÷Get the supported Hyper-V VM generations.

        Hyper-V Generation 2 VMs are supported in Windows 8.1,
        Windows Server / Hyper-V Server 2012 R2 or newer.

        :returns: array of supported VM generations (ex. ['hyperv-gen1'])
        iiN(R9RtIMAGE_PROP_VM_GEN_1tIMAGE_PROP_VM_GEN_2(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytget_supported_vm_types’s	
cCs|jS(N(t_DEFAULT_VM_GENERATION(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytget_default_vm_generation¡scCst|jjd|ƒƒdkS(s/Checks if the given feature exists on the host.tIDi(tlenRtWin32_ServerFeature(Rt
feature_id((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytcheck_server_feature¤sc
CsV|jjƒ}g}|jjdgƒ}|jjdgƒ}x|D]}|jjd|jƒƒ}g|D]}|j^qn}|j||ƒ}	|	s®tj	dƒqFn|j
||ƒ}
|
sÙtj	dƒqFni|jjdƒdd6|	j
d	6|jd
6tg|
D]}|jjdƒd^qƒd6dd
6}|j|ƒqFW|S(s»Returns the host's list of NUMA nodes.

        :returns: list of dictionaries containing information about each
            host NUMA node. Each host has at least one NUMA node.
        tNumberOfBlockstDeviceIDt
AntecedentsLCould not find memory information for NUMA node. Skipping node measurements.sICould not find CPU information for NUMA node. Skipping node measurements.s\iÿÿÿÿtidtmemorytmemory_usagetcpusetit	cpu_usage(t_connR	RRtMsvm_HostedDependencytpath_t	Dependentt_get_numa_memory_infotLOGtwarningt_get_numa_cpu_infotNodeIDR4RWtCurrentlyConsumableMemoryBlockstsetRXR(
Rt
numa_nodest
nodes_infot
system_memoryt
processorstnodet
numa_assoctitemtnuma_node_assoctmemory_infoRtct	node_info((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytget_numa_nodes¨s2
			



0
cCsvg}g|D]}|jƒjƒ^q
}x6|D].}|jƒjƒ|kr2|j|ƒq2q2W|rr|dSdS(Ni(RatupperR(RRqRlRrtxtpathsR[((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyRcßs%
cCshg}g|D]}|jƒjƒ^q
}x6|D].}|jƒjƒ|kr2|j|ƒq2q2W|S(N(RaRvR(RRqRmRRwRxtproc((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyRfés%
cCsog}|jjdtƒ}xM|D]E}|ji|jd6|jd6|jd6|jd6|jd6ƒq"W|S(s­Returns information about the GPUs used for RemoteFX.

        :returns: list with dictionaries containing information about each
            GPU used for RemoteFX.
        tEnabledForVirtualizationtnametdriver_versionttotal_video_ramtavailable_video_ramtdirectx_version(	R_t Msvm_Physical3dGraphicsProcessortTrueRRt
DriverVersiontTotalVideoMemorytAvailableVideoMemorytDirectXVersion(Rtgpustall_gpustgpu((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytget_remotefx_gpu_infoòs	



cCsY|jjƒd}|js4tjtdƒƒ‚n|jsUtjtdƒƒ‚ndS(s®Validates that the host supports RemoteFX.

        :raises exceptions.HyperVRemoteFXException: if the host has no GPU
            that supports DirectX 11, or SLAT.
        isQTo enable RemoteFX on Hyper-V at least one GPU supporting DirectX 11 is required.sMTo enable RemoteFX on Hyper-V it is required that the host GPUs support SLAT.N(R_tMsvm_Synth3dVideoPooltIsGpuCapableRtHyperVRemoteFXExceptionRt
IsSlatCapable(Rtsynth_3d_video_pool((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytverify_host_remotefx_capabilitys		cCstS(s‰Checks if the host is guarded.

        :returns: False, only Windows / Hyper-V Server 2016 or newer can be
            guarded.
        (tFalse(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytis_host_guardedscCstS(s­Checks if the host supports nested virtualization.

        :returns: False, only Windows / Hyper-V Server 2016 or newer supports
            nested virtualization.
        (R(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytsupports_nested_virtualizationscCsgS(sÅGet host PCI devices path.

        Discrete device assignment is supported only on Windows / Hyper-V
        Server 2016 or newer.

        :returns: a list of the assignable PCI devices.
        ((R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pytget_pci_passthrough_devices#s	N(%t__name__t
__module__tNoneR:t_MSVM_PROCESSORt_MSVM_MEMORYt_MSVM_NUMA_NODEt_CENTRAL_PROCESSORRIRGRRMRPtFEATURE_RDS_VIRTUALIZATIONtFEATURE_MPIORRR R&R+R0R9R1RARCRLRORQRVRuRcRfR‰RR‘R’R“(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyRs@														7	
						(R!R=toslo_logRtloggingtos_win._i18nRtos_winRRRtos_win.utilsRt	getLoggerR”Rdt
BaseUtilsVirtR(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt<module>s