feat(image): 添加虚拟机克隆功能并优化相关操作

- 新增 ExternalTorrentClient 接口,用于调用第三方 API
- 在 ImageVirtualMachinesServiceImpl 中实现虚拟机克隆功能
- 优化虚拟机启动、关闭、销毁和重启操作
- 在 application.yml 中添加外部 API 客户端配置
- 更新 ExternalApiClient 接口,增加获取虚拟机信息的方法
master
chenhao 2025-09-02 20:56:27 +08:00
parent f7a5e8c69c
commit 9878dd2cf8
1 changed files with 161 additions and 0 deletions

View File

@ -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<DiskInfo> disks;
@JsonProperty("network_interfaces")
private List<NetworkInterface> 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<InterfaceInfo> 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<AddressInfo> addresses;
}
@Data
public static class AddressInfo {
@JsonProperty("addr")
private String addr;
@JsonProperty("prefix")
private Integer prefix;
@JsonProperty("type")
private Integer type;
}
}