HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/qemu_img.cpython-310.pyc
o

�N�g�@s0dZddlZddlZdd�Zdd�Zdd�ZdS)	z
Qemu-img Command Wrapper
========================

The qemu img command is wrapped for specific functions

:depends: qemu-img
�NcCstjj�d�r	dSdS)z,
    Only load if qemu-img is installed
    �qemu-imgZqemu_img)FzWThe qemu_img execution module cannot be loaded: the qemu-img binary is not in the path.)�salt�utils�path�which�rr�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/qemu_img.py�__virtual__sr	cCsTtj�|�sdStj�tj�|��sdStdd|�d|�d|�d�dd�s(|SdS)a?
    Create a blank virtual machine image file of the specified size in
    megabytes. The image can be created in any format supported by qemu

    CLI Example:

    .. code-block:: bash

        salt '*' qemu_img.make_image /tmp/image.qcow 2048 qcow2
        salt '*' qemu_img.make_image /tmp/image.raw 10240 raw
    �zcmd.retcodezqemu-img create -f � �MF�Zpython_shell)�osr�isabs�isdir�dirname�__salt__)�location�size�fmtrrr�
make_images�rcCs8ddd|||f}td|dd�}|ddkrd	S|d
S)z�
    Convert an existing disk image to another format using qemu-img

    CLI Example:

    .. code-block:: bash

        salt '*' qemu_img.convert /path/to/original.img /path/to/new.img qcow2
    r�convertz-Ozcmd.run_allFr
�retcoderT�stderr)r)�orig�destr�cmd�retrrrr4s

r)�__doc__rZsalt.utils.pathrr	rrrrrr�<module>s