update storage

This commit is contained in:
Mickael BOURNEUF 2024-11-27 15:17:33 +01:00
parent 55bef3ed30
commit 70a934f55c
3 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,6 @@
from typing import List, Optional from typing import List, Optional
import uuid import uuid
from pydantic import UUID4, BaseModel, ConfigDict, Field from pydantic import UUID1, UUID4, BaseModel, ConfigDict, Field
class Cluster(BaseModel): class Cluster(BaseModel):
model_config = ConfigDict(from_attributes=True) model_config = ConfigDict(from_attributes=True)
@ -8,5 +8,5 @@ class Cluster(BaseModel):
id: UUID4 id: UUID4
name: str name: str
compute_id: UUID4 compute_id: UUID4
storage_id: UUID4 storage_id: UUID1
network_switch_id: UUID4 network_switch_id: UUID4

View File

@ -26,4 +26,4 @@ class DatacenterCreate(BaseModel):
id:Optional[UUID4] = Field(default_factory=lambda:uuid.uuid4()) id:Optional[UUID4] = Field(default_factory=lambda:uuid.uuid4())
name:str name:str
cluster_id:UUID4 cluster_id:UUID4
storage_pool_id:Optional[UUID4] storage_pool_id:Optional[UUID4] = Field(default=None)

View File

@ -1,5 +1,6 @@
from typing import List, Optional from typing import List, Optional
from pydantic import UUID4, BaseModel, ConfigDict, Field from uuid import UUID
from pydantic import UUID1, UUID4, BaseModel, ConfigDict, Field
from pydantic_xml import attr from pydantic_xml import attr
from ..libvirt.dom import config as configDom from ..libvirt.dom import config as configDom
@ -28,7 +29,7 @@ class StoragePool(BaseModel):
class Storage(BaseModel): class Storage(BaseModel):
model_config = ConfigDict(from_attributes=True) model_config = ConfigDict(from_attributes=True)
id:UUID4 = Field() id:UUID1 = Field()
name:str = Field() name:str = Field()
pool: Optional[List[StoragePool]] = Field(default=[], alias='storage_pool') pool: Optional[List[StoragePool]] = Field(default=[], alias='storage_pool')