Repository URL to install this package:
Version:
3.3.29 ▾
|
ó ̍EYc @ s¤ d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z e j e Z d e j f d YZ d S( iÿÿÿÿN( t log( t _( t _utils( t constants( t exceptions( t baseutilst HostUtilsc B s e Z d Z d Z d Z d Z d Z d Z d Z e j Z d Z d Z d Z d d Z d Z d Z d Z d Z d d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z! d Z" d Z# d Z$ RS(! t Msvm_Processort Msvm_Memoryt Msvm_NumaNodes Central Processori i iB i9 s //./root/cimv2t .c C s8 t t | j | | j | j d d g | _ d S( Nt privilegest Shutdown( t superR t __init__t _get_wmi_connt _wmi_cimv2_namespacet _conn_cimv2( t selft host( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyR 1 s c C s| | j j d } g } x] | D]U } i | j d 6| j d 6| j d 6| j d 6| j d 6| j d 6} | j | q W| 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 Architecturet Namet Manufacturert MaxClockSpeedt NumberOfCorest NumberOfLogicalProcessors( R t queryR R R R R R t append( R t cpust cpus_listt cput cpu_info( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt get_cpus_info6 s c C s t j j j | S( s1 Checks if the host's CPUs have the given feature.( t ctypest windllt kernel32t IsProcessorFeaturePresent( R t feature_key( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt is_cpu_feature_presentL s c C s2 | j j d d } t | j t | j f S( s~ Returns a tuple with total visible memory and free physical memory. The returned values are expressed in KB. sL SELECT TotalVisibleMemorySize, FreePhysicalMemory FROM win32_operatingsystemi ( R R t intt TotalVisibleMemorySizet FreePhysicalMemory( R t mem_info( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt get_memory_infoP s c C s6 | j j d | d } t | j t | j f S( 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. sA SELECT Size, FreeSpace FROM win32_logicaldisk WHERE DeviceID='%s'i ( R R R' t Sizet FreeSpace( R t drivet logical_disk( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt get_volume_info^ s i c C s7 | j } t t t | j d | | | g k S( 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 ( t get_windows_versiont listt mapR' t split( R t majort minort buildt version_str( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt check_min_windows_versionm s c C s2 t j s+ | j j d } | j t _ n t j S( s8 Returns a string representing the host's kernel version.i ( R t _windows_versionR t Win32_OperatingSystemt Version( R R; ( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyR1 v s c C s t j } t j | S( s) Returns the list of locally assigned IPs.( t sockett gethostnameR t get_ips( R t hostname( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt get_local_ips} s c C s t j j j S( s# Returns host uptime in miliseconds.( R! R" R# t GetTickCount64( R ( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt get_host_tick_count64 s c C sx | j j d } | t j k r5 | j | j n? | t j k rW | j | j n t t d i | d 6 d S( Ni s6 Host %(action)s is not supported by the Hyper-V drivert action( R R; R t HOST_POWER_ACTION_SHUTDOWNt Win32Shutdownt _HOST_FORCED_SHUTDOWNt HOST_POWER_ACTION_REBOOTt _HOST_FORCED_REBOOTt NotImplementedErrorR ( R RD t win32_os( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt host_power_action s c C s0 | j d d r" t j t j g St j g Sd S( 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']) i i N( R9 R t IMAGE_PROP_VM_GEN_1t IMAGE_PROP_VM_GEN_2( R ( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt get_supported_vm_types s c C s | j S( N( t _DEFAULT_VM_GENERATION( R ( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt get_default_vm_generation¡ s c C s t | j j d | d k S( s/ Checks if the given feature exists on the host.t IDi ( t lenR t Win32_ServerFeature( R t feature_id( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt check_server_feature¤ s c C sV | j j } g } | j j d g } | j j d g } x| D]} | j j d | j } g | D] } | j ^ qn } | j | | } | s® t j d qF n | j | | } | sÙ t j d qF n i | j j d d d 6| j d 6| j d 6t g | D] } | j j d d ^ q d 6d d 6} | j | qF W| 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. t NumberOfBlockst DeviceIDt AntecedentsL Could not find memory information for NUMA node. Skipping node measurements.sI Could not find CPU information for NUMA node. Skipping node measurements.s \iÿÿÿÿt idt memoryt memory_usaget cpuseti t cpu_usage( t _connR R R t Msvm_HostedDependencyt path_t Dependentt _get_numa_memory_infot LOGt warningt _get_numa_cpu_infot NodeIDR4 RW t CurrentlyConsumableMemoryBlockst setRX R ( R t numa_nodest nodes_infot system_memoryt processorst nodet numa_assoct itemt numa_node_assoct memory_infoR t ct node_info( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt get_numa_nodes¨ s2 0 c C sv g } g | D] } | j j ^ q } x6 | D]. } | j j | k r2 | j | q2 q2 W| rr | d Sd S( Ni ( Ra t upperR ( R Rq Rl Rr t xt pathsR[ ( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyRc ß s % c C sh g } g | D] } | j j ^ q } x6 | D]. } | j j | k r2 | j | q2 q2 W| S( N( Ra Rv R ( R Rq Rm R Rw Rx t proc( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyRf é s % c C so g } | j j d t } xM | D]E } | j i | j d 6| j d 6| j d 6| j d 6| j d 6 q" W| S( s Returns information about the GPUs used for RemoteFX. :returns: list with dictionaries containing information about each GPU used for RemoteFX. t EnabledForVirtualizationt namet driver_versiont total_video_ramt available_video_ramt directx_version( R_ t Msvm_Physical3dGraphicsProcessort TrueR R t DriverVersiont TotalVideoMemoryt AvailableVideoMemoryt DirectXVersion( R t gpust all_gpust gpu( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt get_remotefx_gpu_infoò s c C sY | j j d } | j s4 t j t d n | j sU t j t d n d S( s® Validates that the host supports RemoteFX. :raises exceptions.HyperVRemoteFXException: if the host has no GPU that supports DirectX 11, or SLAT. i sQ To enable RemoteFX on Hyper-V at least one GPU supporting DirectX 11 is required.sM To enable RemoteFX on Hyper-V it is required that the host GPUs support SLAT.N( R_ t Msvm_Synth3dVideoPoolt IsGpuCapableR t HyperVRemoteFXExceptionR t IsSlatCapable( R t synth_3d_video_pool( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt verify_host_remotefx_capability s c C s t S( s Checks if the host is guarded. :returns: False, only Windows / Hyper-V Server 2016 or newer can be guarded. ( t False( R ( ( sK /home/tvault/.virtenv/lib/python2.7/site-packages/os_win/utils/hostutils.pyt is_host_guarded s c C s t S( 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.pyt supports_nested_virtualization s c C s g S( 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.pyt get_pci_passthrough_devices# s N(% t __name__t __module__t NoneR: t _MSVM_PROCESSORt _MSVM_MEMORYt _MSVM_NUMA_NODEt _CENTRAL_PROCESSORRI RG R RM RP t FEATURE_RDS_VIRTUALIZATIONt FEATURE_MPIOR R R R&