From bb7b58e072b6f5b91a0c1b65f76076dc5536a21f Mon Sep 17 00:00:00 2001 From: Mickael B Date: Wed, 9 Oct 2024 12:47:06 +0200 Subject: [PATCH] update --- api/network.py | 2 -- api/storage.py | 25 ++++++++++++------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/api/network.py b/api/network.py index e21f0e4..33209f1 100644 --- a/api/network.py +++ b/api/network.py @@ -4,8 +4,6 @@ from pydantic_xml import element, attr from pydantic import UUID4, BaseModel, ConfigDict, Field from pydantic_extra_types.mac_address import MacAddress -from deevirt_common.lib.virt import vm as vmVirt - class lsp(BaseModel): model_config = ConfigDict(from_attributes=True) diff --git a/api/storage.py b/api/storage.py index edcff58..628286e 100644 --- a/api/storage.py +++ b/api/storage.py @@ -1,8 +1,7 @@ from typing import List -from pydantic_xml import element, attr from pydantic import UUID4, BaseModel, ConfigDict, Field -from deevirt_common.lib.virt import vm as vmVirt +from deevirt_schema.libvirt.dom import config as configDom class VMHardDisk(BaseModel): model_config = ConfigDict(from_attributes=True) @@ -30,27 +29,27 @@ class StorageBlock(BaseModel): size:int = Field() vm_hard_disk:List[VMHardDisk] = Field() -class DiskDriver(vmVirt.DiskDriver): +class DiskDriver(configDom.DevicesDiskDriver): name:str = Field(default="qemu") - type:vmVirt.DiskDriver.enumType = Field(default=vmVirt.DiskDriver.enumType.raw) + type:configDom.DevicesDiskDriver.enumType = Field(default=configDom.DevicesDiskDriver.enumType.raw) -class DiskAuthSecret(vmVirt.DiskAuthSecret): - type:vmVirt.DiskAuthSecret.enumType = Field(default=vmVirt.DiskAuthSecret.enumType.ceph) +class DiskAuthSecret(configDom.DevicesDiskAuthSecret): + type:configDom.DevicesDiskAuthSecret.enumType = Field(default=configDom.DevicesDiskAuthSecret.enumType.ceph) -class DiskAuth(vmVirt.DiskAuth): +class DiskAuth(configDom.DevicesDiskAuth): secret:DiskAuthSecret = Field(default=DiskAuthSecret()) -class DiskSourceHost(vmVirt.DiskSourceHost): +class DiskSourceHost(configDom.DevicesDiskSourceHost): port:int = Field(default=6689) -class DiskSource(vmVirt.DiskSource): - protocol:vmVirt.DiskSource.enumProtocol = Field(default=vmVirt.DiskSource.enumProtocol.rbd) +class DiskSource(configDom.DevicesDiskSource): + protocol:configDom.DevicesDiskSource.enumProtocol = Field(default=configDom.DevicesDiskSource.enumProtocol.rbd) -class DiskTarget(vmVirt.DiskTarget): +class DiskTarget(configDom.DevicesDiskTarget): bus:str = Field(default="virtio") -class Disk(vmVirt.Disk): - type:vmVirt.Disk.enumType = Field(default=vmVirt.Disk.enumType.network) +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())