Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/openstack/cloud/__pycache__/_block_storage.cpython-39.pyc
Ðазад
a t�hh� � @ sj d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlmZ dd� Z G d d � d ej �ZdS )� N)�exc)� _normalize)�_utils)�proxy)�utilsc C s | D ]}|d dvr dS qdS )z;If there are any volumes not in a steady state, don't cache�status)� available�errorzin-useFT� )�volumes�volumer r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/openstack/cloud/_block_storage.py�_no_pending_volumes s r c @ s~ e Zd Zejed�dQdd��Ze�� dRdd��ZdSdd �Zd d� Z dTdd �Z dUdd�Zdd� ZdVdd�Z dWdd�ZdXdd�ZdYdd�Zdd� Zdd� Zdd � ZdZd!d"�Zd[d#d$�Zd%d&� Ze�d'd(d)d*�d\d+d,��Zd-d.� Zd]d/d0�Zd^d1d2�Zd_d3d4�Zd`d5d6�Zdad7d8�Zdbd9d:�Zdcd;d<�Z ddd=d>�Z!ded?d@�Z"dfdAdB�Z#dgdCdD�Z$dEdF� Z%dGdH� Z&dIdJ� Z'dKdL� Z(dMdN� Z)dOdP� Z*dS )h�BlockStorageCloudMixin)Zshould_cache_fnTc s� � ��fdd�� |st �d� d}t|�D ]`}g �t��j�d��}d|vrb��|�dg �� q�z� |� W q�W q* tj y� Y q*0 q*�j �dj|d �� �� �jd �d��S )zZList all available volumes. :returns: A list of volume ``munch.Munch``. c s� �� | �dg �� d }| �dg �D ]$}d|v r"d|d kr"|d } qHq"|r�z� t��j�|��� W n* tjy� �j�dj | d�� � Y n0 d S )Nr � volumes_links�rel�next�hrefz7While listing volumes, could not find next link {link}.)�link) �extend�getr �_json_response� block_storager �OpenStackCloudURINotFound�log�debug�format)�data�endpointr ��_list�selfr r r r + s$ � ��z2BlockStorageCloudMixin.list_volumes.<locals>._listzEcache argument to list_volumes is deprecated. Use invalidate instead.� z/volumes/detailr r z_List volumes failed to retrieve all volumes after {attempts} attempts. Returning what we found.)�attemptsN)�keyr )�warnings�warn�ranger r r r r r r r r r Z_normalize_volumes�_get_and_munchify)r! �cacher# �_r r r r �list_volumes$ s2 � ���z#BlockStorageCloudMixin.list_volumesc C s6 | j jdtdd�d�}tj|dd�}| �| �d|��S )z_List all available volume types. :returns: A list of volume ``munch.Munch``. z/types�None)Z is_public��paramszError fetching volume_type list�� error_message�volume_types)r r �dictr r Z_normalize_volume_typesr( )r! � get_extra�respr r r r �list_volume_types^ s �� �z(BlockStorageCloudMixin.list_volume_typesNc C s t �| d||�S )a� Get a volume by name or ID. :param name_or_id: Name or ID of the volume. :param filters: A dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: { 'last_name': 'Smith', 'other': { 'gender': 'Female' } } OR A string containing a jmespath expression for further filtering. Example:: "[?last_name==`Smith`] | [?other.gender]==`Female`]" :returns: A volume ``munch.Munch`` or None if no matching volume is found. r �r Z_get_entity�r! � name_or_id�filtersr r r � get_volumen s z!BlockStorageCloudMixin.get_volumec C s@ | j �dj|d��}tj|dj|d�d�}| �| �d|��}|S )zn Get a volume by ID :param id: ID of the volume. :returns: A volume ``munch.Munch``. z /volumes/{id}��idz!Error getting volume with ID {id}r/ r �r r r r r �_normalize_volumer( )r! r<