Add support for QCow2 file format in web ui
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -17,12 +17,11 @@ export type VMState =
|
||||
| "PowerManagementSuspended"
|
||||
| "Other";
|
||||
|
||||
export type DiskAllocType = "Sparse" | "Fixed";
|
||||
export type VMFileDisk = BaseFileVMDisk & (RawVMDisk | QCow2Disk);
|
||||
|
||||
export interface VMDisk {
|
||||
export interface BaseFileVMDisk {
|
||||
size: number;
|
||||
name: string;
|
||||
alloc_type: DiskAllocType;
|
||||
delete: boolean;
|
||||
|
||||
// application attribute
|
||||
@ -30,6 +29,17 @@ export interface VMDisk {
|
||||
deleteType?: "keepfile" | "deletefile";
|
||||
}
|
||||
|
||||
export type DiskAllocType = "Sparse" | "Fixed";
|
||||
|
||||
interface RawVMDisk {
|
||||
format: "Raw";
|
||||
alloc_type: DiskAllocType;
|
||||
}
|
||||
|
||||
interface QCow2Disk {
|
||||
format: "QCow2";
|
||||
}
|
||||
|
||||
export interface VMNetInterfaceFilterParams {
|
||||
name: string;
|
||||
value: string;
|
||||
@ -70,7 +80,7 @@ interface VMInfoInterface {
|
||||
number_vcpu: number;
|
||||
vnc_access: boolean;
|
||||
iso_files: string[];
|
||||
disks: VMDisk[];
|
||||
file_disks: VMFileDisk[];
|
||||
networks: VMNetInterface[];
|
||||
tpm_module: boolean;
|
||||
}
|
||||
@ -88,7 +98,7 @@ export class VMInfo implements VMInfoInterface {
|
||||
memory: number;
|
||||
vnc_access: boolean;
|
||||
iso_files: string[];
|
||||
disks: VMDisk[];
|
||||
file_disks: VMFileDisk[];
|
||||
networks: VMNetInterface[];
|
||||
tpm_module: boolean;
|
||||
|
||||
@ -105,7 +115,7 @@ export class VMInfo implements VMInfoInterface {
|
||||
this.memory = int.memory;
|
||||
this.vnc_access = int.vnc_access;
|
||||
this.iso_files = int.iso_files;
|
||||
this.disks = int.disks;
|
||||
this.file_disks = int.file_disks;
|
||||
this.networks = int.networks;
|
||||
this.tpm_module = int.tpm_module;
|
||||
}
|
||||
@ -119,7 +129,7 @@ export class VMInfo implements VMInfoInterface {
|
||||
number_vcpu: 1,
|
||||
vnc_access: true,
|
||||
iso_files: [],
|
||||
disks: [],
|
||||
file_disks: [],
|
||||
networks: [],
|
||||
tpm_module: true,
|
||||
});
|
||||
@ -194,8 +204,8 @@ export class VMApi {
|
||||
*/
|
||||
static async UpdateSingle(vm: VMInfo): Promise<VMInfo> {
|
||||
// Process disks list, looking for removal
|
||||
vm.disks = vm.disks.filter((d) => d.deleteType !== "keepfile");
|
||||
vm.disks.forEach((d) => {
|
||||
vm.file_disks = vm.file_disks.filter((d) => d.deleteType !== "keepfile");
|
||||
vm.file_disks.forEach((d) => {
|
||||
if (d.deleteType === "deletefile") d.delete = true;
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user