File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/cloud/clouds/__pycache__/libvirt.cpython-310.pyc
Back
o ;j_ � @ sn d Z ddlZddlZddlZddlmZ ddlmZ ddlZ ddl mZmZm Z mZ zddlZddlmZ dZW n eyC dZY nw dddd d d dd�Zd ZdZe�e�Zdd� Zerdejedd� dd� Zdd� Zdd� Zdd� Zd8dd�Zd8dd�Z d8dd�Z!d d!� Z"d"d#� Z#d9d$d%�Z$d&d'� Z%d(d)� Z&d8d*d+�Z'd,d-� Z(d.d/� Z)d0d1� Z*d2d3� Z+d4d5� Z,d6d7� Z-dS ):a Libvirt Cloud Module ==================== Example provider: .. code-block:: yaml # A provider maps to a libvirt instance my-libvirt-config: driver: libvirt # url: "qemu+ssh://user@remotekvm/system?socket=/var/run/libvirt/libvirt-sock" url: qemu:///system Example profile: .. code-block:: yaml base-itest: # points back at provider configuration e.g. the libvirt daemon to talk to provider: my-libvirt-config base_domain: base-image # ip_source = [ ip-learning | qemu-agent ] ip_source: ip-learning # clone_strategy = [ quick | full ] clone_strategy: quick ssh_username: vagrant # has_ssh_agent: True password: vagrant # if /tmp is mounted noexec do workaround deploy_command: sh /tmp/.saltcloud/deploy.sh # -F makes the bootstrap script overwrite existing config # which make reprovisioning a box work script_args: -F grains: sushi: more tasty # point at the another master at another port minion: master: 192.168.16.1 master_port: 5506 Tested on: - Fedora 26 (libvirt 3.2.1, qemu 2.9.1) - Fedora 25 (libvirt 1.3.3.2, qemu 2.6.1) - Fedora 23 (libvirt 1.2.18, qemu 2.4.1) - Centos 7 (libvirt 1.2.17, qemu 1.5.3) � N)�ElementTree)�SaltCloudConfigError�SaltCloudExecutionFailure�SaltCloudNotFound�SaltCloudSystemExit)�libvirtErrorTFZrunningZpaused�shutdownZcrashed)r � � � � � � zn<filterref filter='clean-traffic'> <parameter name='CTRL_IP_LEARNING' value='any'/> </filterref>�libvirtc C s t �d|� dS )z> Redirect stderr prints from libvirt to salt logging. zlibvirt error %sN)�log�debug)�ctx�error� r �M/opt/saltstack/salt/lib/python3.10/site-packages/salt/cloud/clouds/libvirt.py�libvirt_error_handlerg s r )�fr c C s t sdS t� du rdS tS )a� This function determines whether or not to make this cloud module available upon execution. Most often, it uses get_configured_provider() to determine if the necessary configuration has been set up. It may also check for necessary imports decide whether to load the module. In most cases, it will return a True or False value. If the name of the driver used does not match the filename, then that name should be returned instead of True. @return True|False|str )Fz2Unable to locate or import python libvirt library.F)Fz)The 'libvirt' provider is not configured.)�HAS_LIBVIRT�get_configured_provider�__virtualname__r r r r �__virtual__r s r c C s"