from typing import List from pydantic import UUID4, BaseModel, ConfigDict, Field from deevirt_schema.libvirt.dom import config as configDom class VMHardDisk(BaseModel): model_config = ConfigDict(from_attributes=True) vm_id:UUID4 storage_block:UUID4 = Field(alias="storage_block_rbd_id") class Storage(BaseModel): model_config = ConfigDict(from_attributes=True) id:UUID4 = Field() name:str = Field() class StoragePool(BaseModel): model_config = ConfigDict(from_attributes=True) id:UUID4 = Field() name:str = Field() class StorageBlock(BaseModel): model_config = ConfigDict(from_attributes=True) id:UUID4 = Field() name:str = Field() size:int = Field() vm_hard_disk:List[VMHardDisk] = Field() class DiskDriver(configDom.DevicesDiskDriver): name:str = Field(default="qemu") type:configDom.DevicesDiskDriver.enumType = Field(default=configDom.DevicesDiskDriver.enumType.raw) class DiskAuthSecret(configDom.DevicesDiskAuthSecret): type:configDom.DevicesDiskAuthSecret.enumType = Field(default=configDom.DevicesDiskAuthSecret.enumType.ceph) class DiskAuth(configDom.DevicesDiskAuth): secret:DiskAuthSecret = Field(default=DiskAuthSecret()) class DiskSourceHost(configDom.DevicesDiskSourceHost): port:int = Field(default=6689) class DiskSource(configDom.DevicesDiskSource): protocol:configDom.DevicesDiskSource.enumProtocol = Field(default=configDom.DevicesDiskSource.enumProtocol.rbd) class DiskTarget(configDom.DevicesDiskTarget): bus:str = Field(default="virtio") class Disk(configDom.DevicesDisk): type:configDom.DevicesDisk.enumType = Field(default=configDom.DevicesDisk.enumType.network) device:str = Field(default="disk") driver:DiskDriver = Field(default=DiskDriver()) source:DiskSource = Field(default=DiskSource()) target:DiskTarget = Field(default=DiskTarget()) size:int = Field(default=0) class DiskCreate(Disk): size:int = Field() order:int = Field(default=0, json_schema_extra={"hidden": True}) class DiskAttached(BaseModel): order:int = Field() class BlockCreate(BaseModel): size:int = Field()