modification sur NETWORK Schema

This commit is contained in:
Jonathan Gohier 2024-10-15 13:54:41 +02:00
parent fcd61bf583
commit 0c7d70eb2d
2 changed files with 15 additions and 12 deletions

View File

@ -1,7 +1,8 @@
from typing import List
from pydantic import UUID4, BaseModel, ConfigDict, Field
from pydantic_xml import attr
from deevirt_schema.libvirt.dom import config as configDom
from ..libvirt.dom import config as configDom
class VMHardDisk(BaseModel):
model_config = ConfigDict(from_attributes=True)
@ -31,10 +32,10 @@ class StorageBlock(BaseModel):
class DiskDriver(configDom.DevicesDiskDriver):
name:str = Field(default="qemu")
type:configDom.DevicesDiskDriver.enumType = Field(default=configDom.DevicesDiskDriver.enumType.raw)
type:configDom.DevicesDiskDriver.typeEnum = Field(default=configDom.DevicesDiskDriver.typeEnum.raw)
class DiskAuthSecret(configDom.DevicesDiskAuthSecret):
type:configDom.DevicesDiskAuthSecret.enumType = Field(default=configDom.DevicesDiskAuthSecret.enumType.ceph)
type:configDom.DevicesDiskAuthSecret.typeEnum = Field(default=configDom.DevicesDiskAuthSecret.typeEnum.ceph)
class DiskAuth(configDom.DevicesDiskAuth):
secret:DiskAuthSecret = Field(default=DiskAuthSecret())
@ -43,13 +44,15 @@ class DiskSourceHost(configDom.DevicesDiskSourceHost):
port:int = Field(default=6689)
class DiskSource(configDom.DevicesDiskSource):
protocol:configDom.DevicesDiskSource.enumProtocol = Field(default=configDom.DevicesDiskSource.enumProtocol.rbd)
name:str = Field(default="source")
protocol:configDom.DevicesDiskSource.protocolEnum = Field(default=configDom.DevicesDiskSource.protocolEnum.rbd)
class DiskTarget(configDom.DevicesDiskTarget):
dev:str = Field(default="dev")
bus:str = Field(default="virtio")
class Disk(configDom.DevicesDisk):
type:configDom.DevicesDisk.enumType = Field(default=configDom.DevicesDisk.enumType.network)
type:configDom.DevicesDisk.typeEnum = Field(default=configDom.DevicesDisk.typeEnum.network)
device:str = Field(default="disk")
driver:DiskDriver = Field(default=DiskDriver())
source:DiskSource = Field(default=DiskSource())

View File

@ -40,10 +40,10 @@ class OSBootOrder(BaseModel):
class OSInfo(BaseModel):
model_config = ConfigDict(from_attributes=True)
name:str = Field(alias="os.name")
version:str = Field(alias="os.version-id")
machine:str = Field(alias="os.machine")
kernel:str = Field(alias="os.kernel-release")
name:str = Field(alias="os.name", serialization_alias="os_name")
version:str = Field(alias="os.version-id", serialization_alias="os_version")
machine:str = Field(alias="os.machine", serialization_alias="os_machine")
kernel:str = Field(alias="os.kernel-release", serialization_alias="os_kernel_release")
class OS(BaseModel):
firmware:configDom.OS.firmwareEnum = Field(default=configDom.OS.firmwareEnum.bios, description="Microprogramme")
@ -124,10 +124,10 @@ class Devices(BaseModel):
cdrom:Optional[DevicesCDROM] = Field(default=None, description="CDROM virtuel")
interfaces:Optional[List[DevicesInterface]] = Field(default=None, description="Interfaces réseau")
graphics:Optional[Graphics] = Field(default=None, description="Console VNC")
audio:Audio = Field(default=None, description="Carte Audio")
video:Video = Field(default=None, description="Carte Vidéo")
audio:Optional[Audio] = Field(default=None, description="Carte Audio")
video:Optional[Video] = Field(default=None, description="Carte Vidéo")
watchdog:Watchdog = Field(default=None, description="Chien de garde")
tpm:TPM = Field(default=None, description="Puce de sécurité")
tpm:Optional[TPM] = Field(default=None, description="Puce de sécurité")
class VM(BaseModel):
model_config = ConfigDict(from_attributes=True)