ajout de la config xml et la gestion de l'état de la VM.

This commit is contained in:
Mickael BOURNEUF 2024-11-11 18:24:42 +01:00
parent 9d7c516245
commit a88e7672f8
4 changed files with 28 additions and 1 deletions

View File

@ -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

View File

@ -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.")

View File

@ -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()

View File

@ -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',