modification sur DATACENTER Schema
This commit is contained in:
parent
0c7d70eb2d
commit
83385dbabc
|
@ -16,7 +16,7 @@ class Datacenter(BaseModel):
|
|||
id:UUID4
|
||||
name:str
|
||||
cluster_id:UUID4
|
||||
storage_pool_id:UUID4
|
||||
storage_pool_id:Optional[UUID4]
|
||||
vm:List[VM] = Field(default=[])
|
||||
|
||||
class DatacenterCreate(BaseModel):
|
||||
|
@ -26,4 +26,4 @@ class DatacenterCreate(BaseModel):
|
|||
id:Optional[UUID4] = Field(default_factory=lambda:uuid.uuid4())
|
||||
name:str
|
||||
cluster_id:UUID4
|
||||
storage_pool_id:UUID4
|
||||
storage_pool_id:Optional[UUID4]
|
|
@ -1,4 +1,4 @@
|
|||
from typing import List
|
||||
from typing import List, Optional
|
||||
from pydantic import UUID4, BaseModel, ConfigDict, Field
|
||||
from pydantic_xml import attr
|
||||
|
||||
|
@ -10,18 +10,6 @@ class VMHardDisk(BaseModel):
|
|||
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)
|
||||
|
||||
|
@ -30,6 +18,20 @@ class StorageBlock(BaseModel):
|
|||
size:int = Field()
|
||||
vm_hard_disk:List[VMHardDisk] = Field()
|
||||
|
||||
class StoragePool(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id:UUID4 = Field()
|
||||
name:str = Field()
|
||||
block:Optional[List[StorageBlock]] = Field(default=[], alias='block')
|
||||
|
||||
class Storage(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id:UUID4 = Field()
|
||||
name:str = Field()
|
||||
pool: Optional[List[StoragePool]] = Field(default=[], alias='pool')
|
||||
|
||||
class DiskDriver(configDom.DevicesDiskDriver):
|
||||
name:str = Field(default="qemu")
|
||||
type:configDom.DevicesDiskDriver.typeEnum = Field(default=configDom.DevicesDiskDriver.typeEnum.raw)
|
||||
|
|
Loading…
Reference in New Issue