Remove Qemu binary code

This commit is contained in:
grossmj 2022-07-31 12:21:33 +02:00
parent a2338d905b
commit 2773bb5d3b
12 changed files with 9 additions and 118 deletions

View File

@ -32,10 +32,6 @@ export class MockedQemuService {
return of(qemuTemplate);
}
public getBinaries(controller:Controller ) {
return of([]);
}
public getImages(controller:Controller ) {
return of([]);
}
@ -105,10 +101,6 @@ xdescribe('AddQemuVmTemplateComponent', () => {
component.memoryForm.controls['ramMemory'].setValue(0);
component.diskForm.controls['fileName'].setValue('file name');
component.chosenImage = 'path';
component.selectedBinary = {
path: 'path',
version: 'version',
};
component.newImageSelected = true;
component.controller = { id: 1 } as Controller ;
@ -124,10 +116,6 @@ xdescribe('AddQemuVmTemplateComponent', () => {
component.memoryForm.controls['ramMemory'].setValue(0);
component.diskForm.controls['fileName'].setValue('file name');
component.chosenImage = 'path';
component.selectedBinary = {
path: 'path',
version: 'version',
};
component.newImageSelected = true;
component.controller = { id: 1 } as Controller ;
@ -142,10 +130,6 @@ xdescribe('AddQemuVmTemplateComponent', () => {
component.memoryForm.controls['binary'].setValue('binary');
component.diskForm.controls['fileName'].setValue('file name');
component.chosenImage = 'path';
component.selectedBinary = {
path: 'path',
version: 'version',
};
component.newImageSelected = true;
component.controller = { id: 1 } as Controller ;

View File

@ -25,10 +25,8 @@ import { ToasterService } from '../../../../services/toaster.service';
})
export class AddQemuVmTemplateComponent implements OnInit {
controller:Controller ;
qemuBinaries: QemuBinary[] = [];
selectPlatform: string[] = [];
selectedPlatform: string;
selectedBinary: QemuBinary;
ramMemory: number;
consoleTypes: string[] = [];
newImageSelected: boolean = false;
@ -108,12 +106,6 @@ export class AddQemuVmTemplateComponent implements OnInit {
this.qemuTemplate = qemuTemplate;
});
this.qemuService.getBinaries(this.controller).subscribe((qemuBinaries: QemuBinary[]) => {
this.qemuBinaries = qemuBinaries;
if (this.qemuBinaries[0]) this.selectedBinary = this.qemuBinaries[0];
});
this.qemuService.getImages(this.controller).subscribe((qemuImages: QemuImage[]) => {
this.qemuImages = qemuImages;
});
@ -175,7 +167,6 @@ export class AddQemuVmTemplateComponent implements OnInit {
addTemplate() {
if (!this.nameForm.invalid && !this.memoryForm.invalid && (this.selectedImage || this.chosenImage)) {
this.qemuTemplate.ram = +this.memoryForm.get('ramMemory').value;
this.qemuTemplate.qemu_path = this.selectedBinary.path;
this.qemuTemplate.platform = this.selectedPlatform;
if (this.newImageSelected) {

View File

@ -16,7 +16,6 @@ import { ToasterService } from '../../../../services/toaster.service';
})
export class CopyQemuVmTemplateComponent implements OnInit {
controller:Controller ;
qemuBinaries: QemuBinary[] = [];
templateName: string = '';
qemuTemplate: QemuTemplate;
nameForm: FormGroup;

View File

@ -61,13 +61,6 @@
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="qemuTemplate.cpus" placeholder="vCPUs" />
</mat-form-field>
<mat-form-field class="form-field">
<mat-select placeholder="Qemu binary" [(ngModel)]="qemuTemplate.qemu_path">
<mat-option *ngFor="let binary of binaries" [value]="binary.path">
{{ binary.path }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="form-field">
<mat-select placeholder="Boot priority" [(ngModel)]="qemuTemplate.boot_priority">
<mat-option *ngFor="let priority of bootPriorities" [value]="priority[1]">

View File

@ -31,10 +31,6 @@ export class MockedQemuService {
return of(qemuTemplate);
}
public getBinaries(controller:Controller ) {
return of([]);
}
public getImages(controller:Controller ) {
return of([]);
}

View File

@ -27,7 +27,6 @@ export class QemuVmTemplateDetailsComponent implements OnInit {
onCloseOptions = [];
categories = [];
priorities: string[] = [];
binaries: QemuBinary[] = [];
activateCpuThrottling: boolean = true;
isConfiguratorOpened: boolean = false;
displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type', 'actions'];
@ -57,15 +56,10 @@ export class QemuVmTemplateDetailsComponent implements OnInit {
const template_id = this.route.snapshot.paramMap.get('template_id');
this.controllerService.get(parseInt(controller_id, 10)).then((controller:Controller ) => {
this.controller = controller;
this.getConfiguration();
this.qemuService.getTemplate(this.controller, template_id).subscribe((qemuTemplate: QemuTemplate) => {
this.qemuTemplate = qemuTemplate;
this.fillCustomAdapters();
this.qemuService.getBinaries(controller).subscribe((qemuBinaries: QemuBinary[]) => {
this.binaries = qemuBinaries;
});
});
});
}

View File

@ -77,7 +77,7 @@
</ng-container>
<!-- <ng-container matColumnDef="expandedDetail">
<mat-cell *matCellDef="let detail">
<mat-cell *matCellDef="let detail">
The symbol for {{detail.element}}
</mat-cell>
</ng-container> -->
@ -85,14 +85,14 @@
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
<!-- <mat-row
<!-- <mat-row
*matRowDef="let row; columns: displayedColumns;"
matRipple
class="element-row"
matRipple
class="element-row"
[class.expanded]="expandedElement == row"
(click)="expandedElement = row">
</mat-row>
<mat-row
<mat-row
*matRowDef="let row; columns: ['expandedDetail']; when: isExpansionDetailRow"
[@detailExpand]="row.element == expandedElement ? 'expanded' : 'collapsed'"
style="overflow: hidden">
@ -131,19 +131,6 @@
<mat-card [hidden]="!(!isLinuxPlatform || applianceToInstall.dynamips)">
<div *ngIf="applianceToInstall.qemu">
<div>
Qemu binary<br />
<mat-select
class="selection-group"
placeholder="Qemu binary"
[(ngModel)]="selectedBinary"
[ngModelOptions]="{ standalone: true }"
>
<mat-option *ngFor="let binary of qemuBinaries" [value]="binary">
{{ binary.path }}
</mat-option>
</mat-select>
</div>
<div>
Install required files
<button
@ -154,7 +141,7 @@
>
<mat-icon aria-label="Refresh list of images">refresh</mat-icon></button
><br />
<div>
<div>
<div *ngFor="let version of applianceToInstall.versions">
<div class="list-item">
<span>{{ applianceToInstall.name }} version {{ version.name }}</span>
@ -225,7 +212,7 @@
[uploader]="uploaderImage"
/>
<button class="button" mat-raised-button (click)="file2.click()">Import</button>
<button
class="button"
mat-raised-button
@ -305,7 +292,7 @@
</div>
<div *ngIf="applianceToInstall.docker">
<button mat-raised-button color="primary" (click)="createDockerTemplate()" class="create-button">
Create docker template
</button>

View File

@ -65,9 +65,6 @@ export class NewTemplateDialogComponent implements OnInit {
public isLinuxPlatform = false;
private isLocalComputerChosen = false;
public qemuBinaries: QemuBinary[] = [];
public selectedBinary: QemuBinary;
public categories: string[] = ['all categories', 'router', 'multilayer_switch', 'guest', 'firewall'];
public category: string = 'all categories';
public displayedColumns: string[] = ['name', 'emulator', 'vendor', 'actions'];
@ -126,10 +123,6 @@ export class NewTemplateDialogComponent implements OnInit {
});
});
this.qemuService.getBinaries(this.controller).subscribe((binaries) => {
this.qemuBinaries = binaries;
});
this.qemuService.getImages(this.controller).subscribe((qemuImages) => {
this.qemuImages = qemuImages;
});
@ -336,30 +329,6 @@ export class NewTemplateDialogComponent implements OnInit {
this.applianceToInstall = object;
setTimeout(() => {
this.stepper.next();
if (this.applianceToInstall.qemu) {
setTimeout(() => {
if (this.qemuBinaries.length) {
if (this.applianceToInstall.qemu.arch === 'x86_64') {
let filtered_binaries = this.qemuBinaries.filter((n) => n.path.includes('qemu-system-x86_64'));
if (filtered_binaries.length) {
this.selectedBinary = filtered_binaries[0];
}
} else if (this.applianceToInstall.qemu.arch === 'i386') {
let filtered_binaries = this.qemuBinaries.filter((n) => n.path.includes('qemu-system-i386'));
if (filtered_binaries.length) {
this.selectedBinary = filtered_binaries[0];
}
} else if (this.applianceToInstall.qemu.arch === 'x86_64') {
let filtered_binaries = this.qemuBinaries.filter((n) => n.path.includes('qemu-system-arm'));
if (filtered_binaries.length) {
this.selectedBinary = filtered_binaries[0];
}
} else {
this.selectedBinary = this.qemuBinaries[0];
}
}
}, 100);
}
}, 100);
}
@ -642,12 +611,8 @@ export class NewTemplateDialogComponent implements OnInit {
return;
}
if (!this.selectedBinary) {
this.toasterService.error('Please select QEMU binary first');
return;
}
let qemuTemplate: QemuTemplate = new QemuTemplate();
qemuTemplate.platform = this.applianceToInstall.qemu.arch;
qemuTemplate.ram = this.applianceToInstall.qemu.ram;
qemuTemplate.adapters = this.applianceToInstall.qemu.adapters;
qemuTemplate.adapter_type = this.applianceToInstall.qemu.adapter_type;
@ -662,7 +627,6 @@ export class NewTemplateDialogComponent implements OnInit {
qemuTemplate.first_port_name = this.applianceToInstall.first_port_name;
qemuTemplate.port_name_format = this.applianceToInstall.port_name_format;
qemuTemplate.symbol = this.applianceToInstall.symbol;
qemuTemplate.qemu_path = this.selectedBinary.path;
qemuTemplate.compute_id = 'local';
qemuTemplate.template_id = uuid();
qemuTemplate.hda_disk_image = version.images.hda_disk_image;

View File

@ -21,7 +21,6 @@ export class ConfiguratorDialogCloudComponent implements OnInit {
name: string;
generalSettingsForm: FormGroup;
consoleTypes: string[] = [];
binaries: QemuBinary[] = [];
onCloseOptions = [];
bootPriorities = [];
diskInterfaces: string[] = [];

View File

@ -25,13 +25,6 @@
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="node.properties.cpus" placeholder="vCPUs" />
</mat-form-field>
<mat-form-field class="form-field">
<mat-select placeholder="Qemu binary" [(ngModel)]="node.properties.qemu_path">
<mat-option *ngFor="let binary of binaries" [value]="binary.path">
{{ binary.path }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="form-field">
<mat-select placeholder="Boot priority" [(ngModel)]="node.properties.boot_priority">
<mat-option *ngFor="let priority of bootPriorities" [value]="priority[1]">

View File

@ -23,7 +23,6 @@ export class ConfiguratorDialogQemuComponent implements OnInit {
name: string;
generalSettingsForm: FormGroup;
consoleTypes: string[] = [];
binaries: QemuBinary[] = [];
onCloseOptions = [];
bootPriorities = [];
diskInterfaces: string[] = [];
@ -63,10 +62,6 @@ export class ConfiguratorDialogQemuComponent implements OnInit {
this.getConfiguration();
});
this.qemuService.getBinaries(this.controller).subscribe((qemuBinaries: QemuBinary[]) => {
this.binaries = qemuBinaries;
});
this.qemuService.getImages(this.controller).subscribe((qemuImages: QemuImage[]) => {
this.qemuImages = qemuImages;
});

View File

@ -23,10 +23,6 @@ export class QemuService {
return `${controller.protocol}//${controller.host}:${controller.port}/images/upload/${filename}`;
}
getBinaries(controller:Controller ): Observable<QemuBinary[]> {
return this.httpController.get<QemuBinary[]>(controller, '/computes/local/qemu/binaries') as Observable<QemuBinary[]>;
}
getImages(controller:Controller ): Observable<any> {
return this.httpController.get<QemuImage[]>(controller, '/images?image_type=qemu') as Observable<QemuImage[]>;
}