diff --git a/deevirt_schema/api/__init__.py b/deevirt_schema/api/__init__.py index e69de29..753661d 100644 --- a/deevirt_schema/api/__init__.py +++ b/deevirt_schema/api/__init__.py @@ -0,0 +1,5 @@ +from . import cluster as cluster_schema +from . import datacenter as datacenter_schema +from . import network as network_schema +from . import storage as storage_schema +from . import vm as vm_schema \ No newline at end of file diff --git a/deevirt_schema/api/vm.py b/deevirt_schema/api/vm.py index 6515bae..bfcdabc 100644 --- a/deevirt_schema/api/vm.py +++ b/deevirt_schema/api/vm.py @@ -1,9 +1,11 @@ +from enum import Enum from typing import List, Optional from uuid import uuid4 from pydantic import UUID4, Field, ConfigDict from pydantic import BaseModel as _BaseModel from ..libvirt.dom import config as configDom +from deevirt_schema.libvirt.dom.events import LifeCycle class BaseModel(_BaseModel): class Config: @@ -193,6 +195,18 @@ class VMGetDevices(Devices): interfaces:Optional[List[VMGetDevicesInterface]] = Field(default=None, description="Interfaces réseau") class VMGet(VM): + class StateEnum(Enum): + NOSTATE = 0 + RUNNING = 1 + BLOCKED = 2 + PAUSED = 3 + SHUTDOWN = 4 + SHUTOFF = 5 + CRASHED = 6 + PMSUSPENDED = 7 + LAST = 8 + + state:StateEnum = Field(default=None) vcpu:VMGetVCPU = Field() gen_id:Optional[UUID4] = Field(default=None) os:VMGetOS = Field(default=VMGetOS(), description="Options VM: Options de démarrage.") diff --git a/deevirt_schema/libvirt/dom/events.py b/deevirt_schema/libvirt/dom/events.py index 3b608dd..67b2756 100644 --- a/deevirt_schema/libvirt/dom/events.py +++ b/deevirt_schema/libvirt/dom/events.py @@ -3,6 +3,13 @@ from typing import List, Optional from uuid import UUID from pydantic import UUID4, BaseModel, Field +class HostAlive(BaseModel): + class Status(Enum): + UP = 1 + DOWN = 2 + + status:Status = Field(default=Status.DOWN) + class LifeCycle(BaseModel): class EventType(Enum): @@ -71,6 +78,7 @@ class LifeCycle(BaseModel): datacenter_id:UUID4 = Field() vm_id:UUID = Field() action:EventType = Field() + config:Optional[str] = Field() class GraphicsAddr(BaseModel): family:int = Field() diff --git a/setup.py b/setup.py index 3a116ee..62fcb87 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import find_packages, setup setup( name='deevirt_schema', - version='0.1.26', + version='0.1.27', description='Deevirt Schema', url='https://git.celeonet.fr/Deevirt/deevirt_schema.git', author='Celeonet',