File manager - Edit - /opt/imh-python/lib/python2.7/site-packages/rads/ha.pyc
Back
� �]c @ s� d Z d d l Z d d l m Z m Z m Z m Z d d l Z d d l m Z d d l m Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d S( s Virtuozzo HA common functions i����N( t CalledProcessErrort check_outputt Popent PIPE( t errprint( t HAErrorc C s t d t j � d k � S( s- Checks if Virtuozzo is in /etc/redhat-releaset Virtuozzoi ( t boolt platformt linux_distribution( ( ( s6 /opt/imh-python/lib/python2.7/site-packages/rads/ha.pyt check_if_vz s c C s! t j � d j d � d } | S( s Returns major version of OSi t .i ( R R t split( t version( ( s6 /opt/imh-python/lib/python2.7/site-packages/rads/ha.pyt get_os_maj_version s c C s t t � o t � d k � S( s+ checks if havp in name and if platform is 7t 7( R R R ( ( ( s6 /opt/imh-python/lib/python2.7/site-packages/rads/ha.pyt check_vz7 s c C s� d d d d d | g } y t | d t d t �} Wn t k rV t d | � t SX| j � \ } } | j d k r| t S| j � d } t t | � d k � S( sm returns True if the container is running on this HA node, False if it isn't or if some other error occurss /usr/bin/prlctlt lists -Hs -ot statust stdoutt stderrs7 OSError exception running "prlctl list -H -o status %s"i t running( R R t OSErrorR t Falset communicatet returncodeR R t str( t ctidt prlctl_list_cmdt prlctl_list_runt prlctl_list_outt prlctl_list_errR ( ( s6 /opt/imh-python/lib/python2.7/site-packages/rads/ha.pyt is_container_running s c C s� d d d d d | g } y t | d t d t �} Wn t k rV t d | � d SX| j � \ } } | j d k r� t d | | j | f � d S| j � d } t | � S( s� Obtain the name (aka legacy CTID) of a container. The input ctid will be either a legacy CTID or a UUID depending whether we are on VZ6 or VZ7s /usr/bin/prlctlR s -Hs -ot nameR R s5 OSError exception running "prlctl list -H -o name %s"i s; Error: "prlctl list -H -o name %s" returned %s STDERR: %sN( R R R R t NoneR R R R ( R R R R R R! ( ( s6 /opt/imh-python/lib/python2.7/site-packages/rads/ha.pyt get_name&