%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/lvs.pyc

�
���^c@@sKdZddlmZmZmZddlZddljj	Z	ddl
mZidd6Ze	j
d��Zd�Zd	�Zddd
d�Zdddd�Zddd
�Zdddddd�Zdddddd�Zdddd�Zd�Zd�Zddd�Zddd�Zddd�Zdddd�ZdS(u(
Support for LVS (Linux Virtual Server)
i(tabsolute_importtprint_functiontunicode_literalsN(t
SaltExceptionulistulist_cC@stjjjd�S(Nuipvsadm(tsalttutilstpathtwhich(((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pyt__detect_osscC@st�stdfSdS(u<
    Only load if ipvsadm command exists on the system.
    uQThe lvs execution module cannot be loaded: the ipvsadm binary is not in the path.ulvs(RtFalse(((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pyt__virtual__s	
cK@sd}d|kr|drd|kr�|ddkrR|dj|d�7}n`|ddkr||dj|d�7}n6|ddkr�|d	j|d�7}ntd
��|d=ntd��d|kr|dr|d
j|d�7}|d=qqntd��|d=nd|kr|dr|dj|d�7}d|kr�|dr�|ddkr{|d7}nF|ddkr�|d7}n)|ddkr�|d7}ntd��|d=nd|kr|dr|dj|d�7}|d=qntd��|d=n|S(uB

    Build a well-formatted ipvsadm command based on kwargs.
    uuservice_addressuprotocolutcpu -t {0}uudpu -u {0}ufwmarku -f {0}u8Error: Only support tcp, udp and fwmark service protocolu Error: protocol should specifiedu	scheduleru -s {0}u'Error: service_address should specifieduserver_addressu -r {0}upacket_forward_methodudru -gutunnelu -iunatu -mu&Error: only support dr, tunnel and natuweightu -w {0}u&Error: server_address should specified(tformatR(tkwargstcmd((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pyt
_build_cmd$sJ










uwlcc	C@sgdjt�td|d|d|��}td|dt�}|dr]|dj�}nt}|S(	up
    Add a virtual service.

    protocol
        The service protocol(only support tcp, udp and fwmark service).

    service_address
        The LVS service address.

    scheduler
        Algorithm for allocating TCP connections and UDP datagrams to real servers.


    CLI Example:

    .. code-block:: bash

        salt '*' lvs.add_service tcp 1.1.1.1:80 rr
    u
{0} -A {1}tprotocoltservice_addresst	schedulerucmd.run_alltpython_shelluretcodeustderr(RRRt__salt__R	tstriptTrue(RRRR
touttret((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pytadd_serviceXs
c	C@sgdjt�td|d|d|��}td|dt�}|dr]|dj�}nt}|S(	ut
    Edit the virtual service.

    protocol
        The service protocol(only support tcp, udp and fwmark service).

    service_address
        The LVS service address.

    scheduler
        Algorithm for allocating TCP connections and UDP datagrams to real servers.


    CLI Example:

    .. code-block:: bash

        salt '*' lvs.edit_service tcp 1.1.1.1:80 rr
    u
{0} -E {1}RRRucmd.run_allRuretcodeustderr(RRRRR	RR(RRRR
RR((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pytedit_service{s
cC@sadjt�td|d|��}td|dt�}|drW|dj�}nt}|S(u

    Delete the virtual service.

    protocol
        The service protocol(only support tcp, udp and fwmark service).

    service_address
        The LVS service address.


    CLI Example:

    .. code-block:: bash

        salt '*' lvs.delete_service tcp 1.1.1.1:80
    u
{0} -D {1}RRucmd.run_allRuretcodeustderr(RRRRR	RR(RRR
RR((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pytdelete_service�s
udric	K@svdjt�td|d|d|d|d||��}td|dt�}|d	rl|d
j�}nt}|S(uh

    Add a real server to a virtual service.

    protocol
        The service protocol(only support ``tcp``, ``udp`` and ``fwmark`` service).

    service_address
        The LVS service address.

    server_address
        The real server address.

    packet_forward_method
        The LVS packet forwarding method(``dr`` for direct routing, ``tunnel`` for tunneling, ``nat`` for network access translation).

    weight
        The capacity  of a server relative to the others in the pool.


    CLI Example:

    .. code-block:: bash

        salt '*' lvs.add_server tcp 1.1.1.1:80 192.168.0.11:8080 nat 1
    u
{0} -a {1}RRtserver_addresstpacket_forward_methodtweightucmd.run_allRuretcodeustderr(RRRRR	RR(	RRRRRRR
RR((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pyt
add_server�s
c	K@svdjt�td|d|d|d|d||��}td|dt�}|d	rl|d
j�}nt}|S(uj

    Edit a real server to a virtual service.

    protocol
        The service protocol(only support ``tcp``, ``udp`` and ``fwmark`` service).

    service_address
        The LVS service address.

    server_address
        The real server address.

    packet_forward_method
        The LVS packet forwarding method(``dr`` for direct routing, ``tunnel`` for tunneling, ``nat`` for network access translation).

    weight
        The capacity  of a server relative to the others in the pool.


    CLI Example:

    .. code-block:: bash

        salt '*' lvs.edit_server tcp 1.1.1.1:80 192.168.0.11:8080 nat 1
    u
{0} -e {1}RRRRRucmd.run_allRuretcodeustderr(RRRRR	RR(	RRRRRRR
RR((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pytedit_server�s
c	C@sgdjt�td|d|d|��}td|dt�}|dr]|dj�}nt}|S(	uy

    Delete the realserver from the virtual service.

    protocol
        The service protocol(only support ``tcp``, ``udp`` and ``fwmark`` service).

    service_address
        The LVS service address.

    server_address
        The real server address.


    CLI Example:

    .. code-block:: bash

        salt '*' lvs.delete_server tcp 1.1.1.1:80 192.168.0.11:8080
    u
{0} -d {1}RRRucmd.run_allRuretcodeustderr(RRRRR	RR(RRRR
RR((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pyt
delete_servers
cC@sOdjt��}td|dt�}|drE|dj�}nt}|S(uq

    Clear the virtual server table

    CLI Example:

    .. code-block:: bash

        salt '*' lvs.clear
    u{0} -Cucmd.run_allRuretcodeustderr(RRRR	RR(R
RR((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pytclear<s
cC@s,djt��}td|dt�}|S(us

    Get the virtual server rules

    CLI Example:

    .. code-block:: bash

        salt '*' lvs.get_rules
    u	{0} -S -nucmd.runR(RRRR	(R
R((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pyt	get_rulesTscC@s�|r-djt�td|d|��}ndjt��}td|dt�}|drr|dj�}n|d	j�}|S(
u�

    List the virtual server table if service_address is not specified. If a service_address is selected, list this service only.

    CLI Example:

    .. code-block:: bash

        salt '*' lvs.list
    u
{0} -L {1} -nRRu	{0} -L -nucmd.run_allRuretcodeustderrustdout(RRRRR	R(RRR
RR((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pytlist_fs
cC@s||r-djt�td|d|��}ndjt��}td|dt�}|drr|dj�}nt}|S(	u�

    Zero the packet, byte and rate counters in a service or all services.

    CLI Example:

    .. code-block:: bash

        salt '*' lvs.zero
    u
{0} -Z {1}RRu{0} -Zucmd.run_allRuretcodeustderr(RRRRR	RR(RRR
RR((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pytzero�s
cK@skdjtd|d||��}|s4|d7}nt�}|j|�}|dkrat}nd}|S(u�

    Check the virtual service exists.

    CLI Example:

    .. code-block:: bash

        salt '*' lvs.check_service tcp 1.1.1.1:80
    u{0}RRu i����uError: service not exists(RRR"tfindR(RRRR
t	all_rulesRR((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pyt
check_service�s
		c	K@sqdjtd|d|d||��}|s:|d7}nt�}|j|�}|dkrgt}nd}|S(u�

    Check the real server exists in the specified service.

    CLI Example:

    .. code-block:: bash

         salt '*' lvs.check_server tcp 1.1.1.1:80 192.168.0.11:8080
    u{0}RRRu i����uError: server not exists(RRR"R%R(RRRRR
R&RR((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pytcheck_server�s
		(t__doc__t
__future__RRRtsalt.utils.pathRtsalt.utils.decoratorsRt
decoratorstsalt.exceptionsRt__func_alias__tmemoizeRR
RtNoneRRRRRR R!R"R#R$R'R((((s4/usr/lib/python2.7/site-packages/salt/modules/lvs.pyt<module>s*
	
	4## --$		

Zerion Mini Shell 1.0