This commit is contained in:
ge
2023-11-06 17:47:56 +03:00
parent ffa7605201
commit 76969a37e3
16 changed files with 158 additions and 48 deletions

View File

@ -1,5 +1,5 @@
{% if versions %}
<h3>{{ _('Versions') }}</h3>
<h3>{{ _('Версии') }}</h3>
<ul>
{%- for item in versions %}
<li><a href="{{ item.url }}">{{ item.name }}</a></li>

View File

@ -1,35 +1,32 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import os
import sys
sys.path.insert(0, os.path.abspath('../../compute'))
# Project information
project = 'Compute'
copyright = '2023, Compute Authors'
author = 'Compute Authors'
release = '0.1.0'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = []
# Sphinx general settings
extensions = [
'sphinx.ext.autodoc',
'sphinx_multiversion',
]
templates_path = ['_templates']
exclude_patterns = []
language = 'ru'
extensions = [
"sphinx_multiversion",
]
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
# HTML output settings
html_theme = 'alabaster'
html_static_path = ['_static']
html_sidebars = [
"versioning.html",
]
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html',
'searchbox.html',
'donate.html',
'versioning.html',
]
}

View File

@ -4,8 +4,9 @@ Compute Service
Документация библиотеки для управления Compute-инстансами.
.. toctree::
:maxdepth: 2
:caption: Contents:
:maxdepth: 1
python-api/index
Индексы и таблицы
-----------------

View File

@ -0,0 +1,47 @@
Python API
==========
API позволяет выполнять действия над инстансами программно. Ниже описано пример
изменения параметров и запуска инстанса `myinstance`.
.. code-block:: python
import logging
from compute import Session
logging.basicConfig(level=logging.DEBUG)
with Session() as session:
instance = session.get_instance('myinstance')
instance.set_vcpus(4)
instance.start()
instance.set_autostart(enabled=True)
Контекстный менеджер :class:`Session` предоставляет абстракцию над :class:`libvirt.virConnect`
и возвращает объекты других классов настоящей билиотеки.
Представление сущностей
-----------------------
Такие сущности как Сompute-инстанс представлены в виде классов. Эти классы напрямую
вызывают методы libvirt для выполнения операций на гипервизоре. Пример класса — :data:`Volume`.
Конфигурационные файлы различных объектов libvirt в compute описаны специальными
датаклассами. Датакласс хранит в своих свойствах параметры объекта и может вернуть XML
конфиг для libvirt с помощью метода ``to_xml()``. Пример — :py:class:`VolumeConfig`.
Для валидации входных данных используются модели `Pydantic <https://docs.pydantic.dev/>`_.
Пример — :py:class:`VolumeSchema`.
Документация модулей
--------------------
.. toctree::
:maxdepth: 4
session
instance/index
storage

View File

@ -0,0 +1,5 @@
``guest_agent``
===============
.. automodule:: compute.instance.guest_agent
:members:

View File

@ -0,0 +1,10 @@
``instance``
============
.. toctree::
:maxdepth: 1
:caption: Содержание:
instance
guest_agent
schemas

View File

@ -0,0 +1,6 @@
``instance``
============
.. automodule:: compute.instance.instance
:members:
:special-members:

View File

@ -0,0 +1,5 @@
``schemas``
===========
.. automodule:: compute.instance.schemas
:members:

View File

@ -0,0 +1,9 @@
``session``
===========
.. autoclass:: compute.Session
:members:
:special-members:
.. autoclass:: compute.session.Capabilities
:members:

View File

@ -0,0 +1,14 @@
``storage``
===========
``compute.storage.pool``
------------------------
.. automodule:: compute.storage.pool
:members:
``compute.storage.volume``
--------------------------
.. automodule:: compute.storage.volume
:members: