From 9878dd2cf81a17585eb5f09b3c5d50cc943f40da Mon Sep 17 00:00:00 2001 From: chenhao <852066789@qq.com> Date: Tue, 2 Sep 2025 20:56:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(image):=20=E6=B7=BB=E5=8A=A0=E8=99=9A?= =?UTF-8?q?=E6=8B=9F=E6=9C=BA=E5=85=8B=E9=9A=86=E5=8A=9F=E8=83=BD=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=9B=B8=E5=85=B3=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 ExternalTorrentClient 接口,用于调用第三方 API - 在 ImageVirtualMachinesServiceImpl 中实现虚拟机克隆功能 - 优化虚拟机启动、关闭、销毁和重启操作 - 在 application.yml 中添加外部 API 客户端配置 - 更新 ExternalApiClient 接口,增加获取虚拟机信息的方法 --- .../project/entity/dto/VmInfoDTO.java | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 nex-be/src/main/java/com/unisinsight/project/entity/dto/VmInfoDTO.java diff --git a/nex-be/src/main/java/com/unisinsight/project/entity/dto/VmInfoDTO.java b/nex-be/src/main/java/com/unisinsight/project/entity/dto/VmInfoDTO.java new file mode 100644 index 0000000..841c4ab --- /dev/null +++ b/nex-be/src/main/java/com/unisinsight/project/entity/dto/VmInfoDTO.java @@ -0,0 +1,161 @@ +package com.unisinsight.project.entity.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author : ch + * @version : 1.0 + * @ClassName : VmInfoDTO + * @Description : 虚拟机详细信息DTO + * @DATE : Created in 2025/9/2 + */ +@Data +public class VmInfoDTO { + + @JsonProperty("name") + private String name; + + @JsonProperty("uuid") + private String uuid; + + @JsonProperty("state") + private String state; + + @JsonProperty("vcpus") + private Integer vcpus; + + @JsonProperty("memory") + private Integer memory; + + @JsonProperty("memory_mb") + private Integer memoryMb; + + @JsonProperty("autostart") + private Integer autostart; + + @JsonProperty("persistent") + private Integer persistent; + + @JsonProperty("os_type") + private String osType; + + @JsonProperty("os_variant") + private String osVariant; + + @JsonProperty("created_at") + private Long createdAt; + + @JsonProperty("disk_size") + private Double diskSize; + + @JsonProperty("firmware_type") + private String firmwareType; + + @JsonProperty("disks") + private List disks; + + @JsonProperty("network_interfaces") + private List networkInterfaces; + + @JsonProperty("vnc") + private VncInfo vnc; + + @JsonProperty("auto_mount_virtio") + private Boolean autoMountVirtio; + + @JsonProperty("virtio_win_path") + private String virtioWinPath; + + @JsonProperty("iso_path") + private String isoPath; + + @JsonProperty("disk_path") + private String diskPath; + + @JsonProperty("storage_pool_name") + private String storagePoolName; + + @JsonProperty("interfaces") + private List interfaces; + + @JsonProperty("network_name") + private String networkName; + + @JsonProperty("disk_format") + private String diskFormat; + + @JsonProperty("status") + private String status; + + @JsonProperty("mac_address") + private String macAddress; + + @JsonProperty("vnc_port") + private String vncPort; + + @JsonProperty("description") + private String description; + + @JsonProperty("updated_at") + private Long updatedAt; + + @Data + public static class DiskInfo { + @JsonProperty("device") + private String device; + + @JsonProperty("file") + private String file; + + @JsonProperty("bus") + private String bus; + } + + @Data + public static class NetworkInterface { + @JsonProperty("mac") + private String mac; + + @JsonProperty("network") + private String network; + } + + @Data + public static class VncInfo { + @JsonProperty("port") + private String port; + + @JsonProperty("autoport") + private Boolean autoport; + + @JsonProperty("listen") + private String listen; + } + + @Data + public static class InterfaceInfo { + @JsonProperty("name") + private String name; + + @JsonProperty("mac") + private String mac; + + @JsonProperty("addresses") + private List addresses; + } + + @Data + public static class AddressInfo { + @JsonProperty("addr") + private String addr; + + @JsonProperty("prefix") + private Integer prefix; + + @JsonProperty("type") + private Integer type; + } +} \ No newline at end of file