%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/smartos_virt.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddl	m
Z
eje�Z
dZd�Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�ZdS(u8
virst compatibility module for managing VMs on SmartOS
i(tabsolute_importtunicode_literalstprint_functionN(tCommandExecutionErroruvirtcC@s>tjjj�r+tjjjd�r+tStdjt�fS(u"
    Provides virt on SmartOS
    uvmadmu6{0} module can only be loaded on SmartOS compute nodes(	tsalttutilstplatformtis_smartos_globalzonetpathtwhicht__virtualname__tFalsetformat(((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pyt__virtual__scK@std|�S(u�
    Initialize a new VM

    CLI Example:

    .. code-block:: bash

        salt '*' virt.init image_uuid='...' alias='...' [...]
    uvmadm.create(t__salt__(tkwargs((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pytinit$s
cC@s�tddt�}dg}x�|D]{}|jdjd|jd�d||djd	�d
||djd�d
||djd�d||d��q#W|S(u�
    Return a list of virtual machine names on the minion

    CLI Example:

    .. code-block:: bash

        salt '*' virt.list_domains
    u
vmadm.listtkeyeduLUUID                                  TYPE  RAM      STATE             ALIASu){vmuuid}{vmtype}{vmram}{vmstate}{vmalias}tvmuuidi&tvmtypeutypeitvmramurami	tvmstateustateitvmaliasualias(RtTruetappendRtljust(tdatatvmstvm((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pytlist_domains1s
	
cC@stddddd�S(u�
    Return a list of uuids for active virtual machine on the minion

    CLI Example:

    .. code-block:: bash

        salt '*' virt.list_active_vms
    u
vmadm.listtsearchustate='running'torderuuuid(R(((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pytlist_active_vmsHs
cC@stddddd�S(u�
    Return a list of uuids for inactive virtual machine on the minion

    CLI Example:

    .. code-block:: bash

        salt '*' virt.list_inactive_vms
    u
vmadm.listRustate='stopped'Ruuuid(R(((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pytlist_inactive_vmsUs
cC@std|�S(u�
    Return a dict with information about the specified VM on this CN

    CLI Example:

    .. code-block:: bash

        salt '*' virt.vm_info <domain>
    u	vmadm.get(R(tdomain((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pytvm_infobs
cC@s9|t�krtd��ntd|�|t�kS(ur
    Start a defined domain

    CLI Example:

    .. code-block:: bash

        salt '*' virt.start <domain>
    u#The specified vm is already runninguvmadm.start(R RR(R"((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pytstartos
cC@s9|t�krtd��ntd|�|t�kS(u�
    Send a soft shutdown signal to the named vm

    CLI Example:

    .. code-block:: bash

        salt '*' virt.shutdown <domain>
    u#The specified vm is already stoppedu
vmadm.stop(R!RR(R"((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pytshutdown�s
cC@s9|t�krtd��ntd|�|t�kS(u}
    Reboot a domain via ACPI request

    CLI Example:

    .. code-block:: bash

        salt '*' virt.reboot <domain>
    uThe specified vm is stoppeduvmadm.reboot(R!RRR (R"((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pytreboot�s
cC@s,|t�krtd��ntd|�S(u�
    Hard power down the virtual machine, this is equivalent to powering off the hardware.

    CLI Example:

    .. code-block:: bash

        salt '*' virt.destroy <domain>
    uThe specified vm is stoppeduvmadm.delete(R!RR(R"((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pytstop�s
cC@sRtdddjd|�dd�}t|�dkrFtd��n|d	dS(
u�
    Return VM virtualization type : OS or KVM

    CLI Example:

    .. code-block:: bash

        salt '*' virt.vm_virt_type <domain>
    uvmadm.lookupRuuuid={uuid}tuuidRutypeiu&We can't determine the type of this VMi(RRtlenR(R"tret((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pytvm_virt_type�s
%cC@s�t|�}|dkr/tdd|d|�S|dkrRtdd|d|�S|dkr�tjd�tdd|d|�Std	��tS(
u�
    Change the amount of memory allocated to VM.
    <memory> is to be specified in MB.

    Note for KVM : this would require a restart of the VM.

    CLI Example:

    .. code-block:: bash

        salt '*' virt.setmem <domain> 512
    uOSuvmadm.updateRtmax_physical_memoryuLXuKVMu-Changes will be applied after the VM restart.tramuUnknown VM type(R+RtlogtwarningRR(R"tmemoryR((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pytsetmem�s

cC@s~g}tdddjd|�dd�}t|�dkrLtd��n.x'|d	dD]}|j|d
�q[W|SdS(u�
    Return a list off MAC addresses from the named VM

    CLI Example:

    .. code-block:: bash

        salt '*' virt.get_macs <domain>
    uvmadm.lookupRuuuid={uuid}R(Runicsiu(We can't find the MAC address of this VMiumacN(RRR)RR(R"tmacsR*tnic((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pytget_macs�s
%(t__doc__t
__future__RRRtloggingtsalt.utils.pathRtsalt.utils.platformtsalt.exceptionsRt	getLoggert__name__R.R
R
RRR R!R#R$R%R&R'R+R1R4(((s=/usr/lib/python2.7/site-packages/salt/modules/smartos_virt.pyt<module>s(		
		
	
	
						

Zerion Mini Shell 1.0