modification sur NETWORK Schema
This commit is contained in:
parent
fcd61bf583
commit
0c7d70eb2d
|
@ -1,7 +1,8 @@
|
||||||
from typing import List
|
from typing import List
|
||||||
from pydantic import UUID4, BaseModel, ConfigDict, Field
|
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):
|
class VMHardDisk(BaseModel):
|
||||||
model_config = ConfigDict(from_attributes=True)
|
model_config = ConfigDict(from_attributes=True)
|
||||||
|
@ -31,10 +32,10 @@ class StorageBlock(BaseModel):
|
||||||
|
|
||||||
class DiskDriver(configDom.DevicesDiskDriver):
|
class DiskDriver(configDom.DevicesDiskDriver):
|
||||||
name:str = Field(default="qemu")
|
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):
|
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):
|
class DiskAuth(configDom.DevicesDiskAuth):
|
||||||
secret:DiskAuthSecret = Field(default=DiskAuthSecret())
|
secret:DiskAuthSecret = Field(default=DiskAuthSecret())
|
||||||
|
@ -43,13 +44,15 @@ class DiskSourceHost(configDom.DevicesDiskSourceHost):
|
||||||
port:int = Field(default=6689)
|
port:int = Field(default=6689)
|
||||||
|
|
||||||
class DiskSource(configDom.DevicesDiskSource):
|
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):
|
class DiskTarget(configDom.DevicesDiskTarget):
|
||||||
|
dev:str = Field(default="dev")
|
||||||
bus:str = Field(default="virtio")
|
bus:str = Field(default="virtio")
|
||||||
|
|
||||||
class Disk(configDom.DevicesDisk):
|
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")
|
device:str = Field(default="disk")
|
||||||
driver:DiskDriver = Field(default=DiskDriver())
|
driver:DiskDriver = Field(default=DiskDriver())
|
||||||
source:DiskSource = Field(default=DiskSource())
|
source:DiskSource = Field(default=DiskSource())
|
||||||
|
|
14
api/vm.py
14
api/vm.py
|
@ -40,10 +40,10 @@ class OSBootOrder(BaseModel):
|
||||||
class OSInfo(BaseModel):
|
class OSInfo(BaseModel):
|
||||||
model_config = ConfigDict(from_attributes=True)
|
model_config = ConfigDict(from_attributes=True)
|
||||||
|
|
||||||
name:str = Field(alias="os.name")
|
name:str = Field(alias="os.name", serialization_alias="os_name")
|
||||||
version:str = Field(alias="os.version-id")
|
version:str = Field(alias="os.version-id", serialization_alias="os_version")
|
||||||
machine:str = Field(alias="os.machine")
|
machine:str = Field(alias="os.machine", serialization_alias="os_machine")
|
||||||
kernel:str = Field(alias="os.kernel-release")
|
kernel:str = Field(alias="os.kernel-release", serialization_alias="os_kernel_release")
|
||||||
|
|
||||||
class OS(BaseModel):
|
class OS(BaseModel):
|
||||||
firmware:configDom.OS.firmwareEnum = Field(default=configDom.OS.firmwareEnum.bios, description="Microprogramme")
|
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")
|
cdrom:Optional[DevicesCDROM] = Field(default=None, description="CDROM virtuel")
|
||||||
interfaces:Optional[List[DevicesInterface]] = Field(default=None, description="Interfaces réseau")
|
interfaces:Optional[List[DevicesInterface]] = Field(default=None, description="Interfaces réseau")
|
||||||
graphics:Optional[Graphics] = Field(default=None, description="Console VNC")
|
graphics:Optional[Graphics] = Field(default=None, description="Console VNC")
|
||||||
audio:Audio = Field(default=None, description="Carte Audio")
|
audio:Optional[Audio] = Field(default=None, description="Carte Audio")
|
||||||
video:Video = Field(default=None, description="Carte Vidéo")
|
video:Optional[Video] = Field(default=None, description="Carte Vidéo")
|
||||||
watchdog:Watchdog = Field(default=None, description="Chien de garde")
|
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):
|
class VM(BaseModel):
|
||||||
model_config = ConfigDict(from_attributes=True)
|
model_config = ConfigDict(from_attributes=True)
|
||||||
|
|
Loading…
Reference in New Issue