Merge pull request #1370 from GNS3/bugfixRemovedQemuCode/1363

Bugfix removed qemu code/1363
This commit is contained in:
Jeremy Grossmann 2022-08-03 11:13:45 +02:00 committed by GitHub
commit cb48ea2715
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 82 additions and 151 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,19 +106,12 @@ 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;
});
this.selectPlatform = this.configurationService.getPlatform();
this.selectedPlatform = this.selectPlatform[0];
this.consoleTypes = this.configurationService.getConsoleTypes();
});
@ -175,9 +166,7 @@ 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) {
this.qemuTemplate.hda_disk_image = this.diskForm.get('fileName').value;
} else {

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

@ -54,6 +54,13 @@
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="form-field">
<mat-select placeholder="Platform" [(ngModel)]="qemuTemplate.platform">
<mat-option *ngFor="let platform of selectPlatform" [value]="platform">
{{ platform }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="form-field">
<input matInput type="number" [(ngModel)]="qemuTemplate.ram" placeholder="RAM" />
<span matSuffix>MB</span>
@ -61,13 +68,7 @@
<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,9 +31,6 @@ export class MockedQemuService {
return of(qemuTemplate);
}
public getBinaries(controller:Controller ) {
return of([]);
}
public getImages(controller:Controller ) {
return of([]);

View File

@ -27,11 +27,13 @@ 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'];
generalSettingsForm: FormGroup;
selectPlatform: string[] = [];
selectedPlatform: string;
@ViewChild('customAdaptersConfigurator')
customAdaptersConfigurator: CustomAdaptersComponent;
@ -62,12 +64,10 @@ export class QemuVmTemplateDetailsComponent implements OnInit {
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;
});
});
});
this.selectPlatform = this.configurationService.getPlatform();
}
getConfiguration() {

View File

@ -1,7 +1,20 @@
<div class="content" [ngClass]="{ shadowed: isSymbolSelectionOpened }">
<div class="default-header">
<div class="row">
<h1 class="col">VPCS device configuration</h1>
<div class="col col-md-1">
<button
class="top-button"
*ngIf="controller"
class="cancel-button"
mat-button
(click)="goBack()"
>
<mat-icon>arrow_back</mat-icon>
</button>
</div>
<div class="col col-md-11">
<h1 class="col">VPCS device configuration</h1>
</div>
</div>
</div>
<div class="default-content" *ngIf="vpcsTemplate">

View File

@ -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

View File

@ -65,8 +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';
@ -126,10 +124,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 +330,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,11 +612,6 @@ export class NewTemplateDialogComponent implements OnInit {
return;
}
if (!this.selectedBinary) {
this.toasterService.error('Please select QEMU binary first');
return;
}
let qemuTemplate: QemuTemplate = new QemuTemplate();
qemuTemplate.ram = this.applianceToInstall.qemu.ram;
qemuTemplate.adapters = this.applianceToInstall.qemu.adapters;
@ -662,13 +627,13 @@ 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;
qemuTemplate.hdb_disk_image = version.images.hdb_disk_image;
qemuTemplate.template_type = 'qemu';
qemuTemplate.usage = this.applianceToInstall.usage;
qemuTemplate.platform = this.applianceToInstall.qemu.arch;
const dialogRef = this.dialog.open(TemplateNameDialogComponent, {
width: '400px',

View File

@ -40,56 +40,57 @@
</mat-tab>
<mat-tab label="Miscellaneous">
<form [formGroup]="generalSettingsForm">
<mat-form-field class="form-field">
<input
matInput type="text"
[(ngModel)]="node.name"
formControlName="name"
placeholder="Name">
</mat-form-field>
</form>
<mat-form-field class="select">
<mat-select
placeholder="Console type"
[(ngModel)]="node.console_type">
<mat-option *ngFor="let type of consoleTypes" [value]="type">
{{type}}
</mat-option>
</mat-select>
</mat-form-field>
<form [formGroup]="generalSettingsForm">
<mat-form-field class="form-field">
<input
matInput type="text"
[(ngModel)]="node.properties.remote_console_host"
placeholder="Console host">
</mat-form-field>
<mat-form-field class="form-field">
<input
matInput type="text"
[(ngModel)]="node.properties.remote_console_port"
placeholder="Console port">
</mat-form-field>
<mat-form-field class="form-field">
<input
matInput type="text"
[(ngModel)]="node.properties.remote_console_http_path"
placeholder="Console HTTP path">
<input matInput type="text" [(ngModel)]="node.name" formControlName="name" placeholder="Name" />
</mat-form-field>
</form>
<mat-form-field class="select">
<mat-select placeholder="Console type" [(ngModel)]="node.console_type">
<mat-option *ngFor="let type of consoleTypes" [value]="type">
{{ type }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="form-field">
<input
matInput
type="text"
[(ngModel)]="node.properties.remote_console_host"
placeholder="Console host"
/>
</mat-form-field>
<mat-form-field class="form-field">
<input
matInput
type="text"
[(ngModel)]="node.properties.remote_console_port"
placeholder="Console port"
/>
</mat-form-field>
<mat-form-field class="form-field">
<input
matInput
type="text"
[(ngModel)]="node.properties.remote_console_http_path"
placeholder="Console HTTP path"
/>
</mat-form-field>
</mat-tab>
<mat-tab label="Usage">
<mat-form-field class="form-field">
<textarea matInput type="text" [(ngModel)]="node.properties.usage"></textarea>
</mat-form-field>
<mat-form-field class="form-field">
<textarea matInput type="text" [(ngModel)]="node.properties.usage"></textarea>
</mat-form-field>
</mat-tab>
</mat-tab-group>
</mat-card><div>
</mat-card>
<div></div>
</div>
</div>
</div>
<div mat-dialog-actions>
<button mat-button (click)="onCancelClick()" color="accent">Cancel</button>
<button mat-button (click)="onSaveClick()" tabindex="2" mat-raised-button color="primary">Apply</button>
<div mat-dialog-actions>
<button mat-button (click)="onCancelClick()" color="accent">Cancel</button>
<button mat-button (click)="onSaveClick()" tabindex="2" mat-raised-button color="primary">Apply</button>
</div>
</div>

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

@ -11,6 +11,13 @@
<mat-form-field class="form-field">
<input matInput type="text" formControlName="name" [(ngModel)]="node.name" placeholder="Name" />
</mat-form-field>
<mat-form-field class="form-field">
<mat-select placeholder="Platform" [(ngModel)]="node.properties.platform" [ngModelOptions]="{ standalone: true }">
<mat-option *ngFor="let platform of selectPlatform" [value]="platform">
{{ platform }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="form-field">
<input
matInput
@ -25,13 +32,7 @@
<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[] = [];
@ -31,6 +30,7 @@ export class ConfiguratorDialogQemuComponent implements OnInit {
displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type', 'actions'];
networkTypes = [];
qemuImages: QemuImage[] = [];
selectPlatform: string[] = [];
private conf = {
autoFocus: false,
@ -63,13 +63,11 @@ 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;
});
this.selectPlatform = this.qemuConfigurationService.getPlatform();
}
openQemuImageCreator() {

View File

@ -23,9 +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[]>;