From 9f61f0391702b524bd34e0707487ad964cf1b686 Mon Sep 17 00:00:00 2001 From: Rajnikant Lodhi Date: Mon, 17 Oct 2022 15:03:50 +0530 Subject: [PATCH 1/6] Resoleve web-ui seems to not send the correct custom adapters list webui custom network adapter option for node #1339 --- .../custom-adapters-table/custom-adapters-table.component.ts | 2 ++ .../common/custom-adapters/custom-adapters.component.ts | 2 ++ .../qemu-vm-template-details.component.ts | 4 ++++ .../virtual-box-template-details.component.ts | 5 +++++ .../vmware-template-details.component.ts | 4 ++++ .../configurator/qemu/configurator-qemu.component.ts | 4 +++- src/app/models/qemu/qemu-custom-adapter.ts | 3 +++ 7 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.ts b/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.ts index ea34cf465..efee7b05c 100644 --- a/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.ts +++ b/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.ts @@ -17,6 +17,8 @@ export class CustomAdaptersTableComponent { let adapter: CustomAdapter = { adapter_number: this.adapters.length, adapter_type: this.networkTypes[0], + mac_address:null, + port_name:null }; this.adapters = this.adapters.concat([adapter]); } diff --git a/src/app/components/preferences/common/custom-adapters/custom-adapters.component.ts b/src/app/components/preferences/common/custom-adapters/custom-adapters.component.ts index 34f2080e1..62c15cd83 100644 --- a/src/app/components/preferences/common/custom-adapters/custom-adapters.component.ts +++ b/src/app/components/preferences/common/custom-adapters/custom-adapters.component.ts @@ -30,6 +30,8 @@ export class CustomAdaptersComponent { this.adapters.push({ adapter_number: n.adapter_number, adapter_type: n.adapter_type, + mac_address:n.mac_address, + port_name:n.port_name }); }); diff --git a/src/app/components/preferences/qemu/qemu-vm-template-details/qemu-vm-template-details.component.ts b/src/app/components/preferences/qemu/qemu-vm-template-details/qemu-vm-template-details.component.ts index 41fd5e31b..ca8c02165 100644 --- a/src/app/components/preferences/qemu/qemu-vm-template-details/qemu-vm-template-details.component.ts +++ b/src/app/components/preferences/qemu/qemu-vm-template-details/qemu-vm-template-details.component.ts @@ -107,6 +107,8 @@ export class QemuVmTemplateDetailsComponent implements OnInit { this.customAdaptersConfigurator.adapters.push({ adapter_number: adapter.adapter_number, adapter_type: adapter.adapter_type, + mac_address:adapter.mac_address, + port_name:adapter.port_name }); }); } @@ -128,6 +130,8 @@ export class QemuVmTemplateDetailsComponent implements OnInit { this.qemuTemplate.custom_adapters.push({ adapter_number: i, adapter_type: 'e1000', + mac_address:'', + port_name:'' }); } } diff --git a/src/app/components/preferences/virtual-box/virtual-box-template-details/virtual-box-template-details.component.ts b/src/app/components/preferences/virtual-box/virtual-box-template-details/virtual-box-template-details.component.ts index 2a7302018..588c47486 100644 --- a/src/app/components/preferences/virtual-box/virtual-box-template-details/virtual-box-template-details.component.ts +++ b/src/app/components/preferences/virtual-box/virtual-box-template-details/virtual-box-template-details.component.ts @@ -88,6 +88,9 @@ export class VirtualBoxTemplateDetailsComponent implements OnInit { this.customAdaptersConfigurator.adapters.push({ adapter_number: adapter.adapter_number, adapter_type: adapter.adapter_type, + mac_address:adapter.mac_address, + port_name:adapter.port_name + }); }); } @@ -109,6 +112,8 @@ export class VirtualBoxTemplateDetailsComponent implements OnInit { this.virtualBoxTemplate.custom_adapters.push({ adapter_number: i, adapter_type: 'e1000', + mac_address:'', + port_name:'' }); } } diff --git a/src/app/components/preferences/vmware/vmware-template-details/vmware-template-details.component.ts b/src/app/components/preferences/vmware/vmware-template-details/vmware-template-details.component.ts index 3e7d1e7b2..84ac63899 100644 --- a/src/app/components/preferences/vmware/vmware-template-details/vmware-template-details.component.ts +++ b/src/app/components/preferences/vmware/vmware-template-details/vmware-template-details.component.ts @@ -94,6 +94,8 @@ export class VmwareTemplateDetailsComponent implements OnInit { this.customAdaptersConfigurator.adapters.push({ adapter_number: adapter.adapter_number, adapter_type: adapter.adapter_type, + mac_address:adapter.mac_address, + port_name:adapter.port_name }); }); } @@ -115,6 +117,8 @@ export class VmwareTemplateDetailsComponent implements OnInit { this.vmwareTemplate.custom_adapters.push({ adapter_number: i, adapter_type: 'e1000', + mac_address:'', + port_name:'' }); } } diff --git a/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts b/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts index e610f3c58..2944b83fb 100644 --- a/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts +++ b/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts @@ -105,10 +105,12 @@ export class ConfiguratorDialogQemuComponent implements OnInit { onSaveClick() { if (this.generalSettingsForm.valid) { this.node.custom_adapters = []; - this.customAdapters.adapters.forEach((n) => { + this.customAdapters.adapters.forEach((n,i) => { this.node.custom_adapters.push({ adapter_number: n.adapter_number, adapter_type: n.adapter_type, + mac_address: n.mac_address ?? n.mac_address, + port_name: n.port_name ?? this.node.port_name_format.replace('{0}',`${i}`) }); }); diff --git a/src/app/models/qemu/qemu-custom-adapter.ts b/src/app/models/qemu/qemu-custom-adapter.ts index aae4d7354..c7f14ee4b 100644 --- a/src/app/models/qemu/qemu-custom-adapter.ts +++ b/src/app/models/qemu/qemu-custom-adapter.ts @@ -1,4 +1,7 @@ export class CustomAdapter { adapter_number: number; adapter_type: string; + mac_address:string; + port_name: string; } + From e2d8904eee6a36c899af2e389bf22e8a29b32dff Mon Sep 17 00:00:00 2001 From: Rajnikant Lodhi Date: Mon, 17 Oct 2022 15:39:02 +0530 Subject: [PATCH 2/6] . --- .../custom-adapters-table/custom-adapters-table.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.html b/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.html index d1d000a61..4fbba209b 100644 --- a/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.html +++ b/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.html @@ -24,7 +24,7 @@ Actions From 0dc916b3e806f276c63a33c5db9d97270af7db4f Mon Sep 17 00:00:00 2001 From: Rajnikant Lodhi Date: Wed, 19 Oct 2022 17:01:49 +0530 Subject: [PATCH 3/6] Resolve instance editing a Qemu template JSON error --- .../add-qemu-vm-template.component.ts | 12 +++++++++++- .../qemu-vm-template-details.component.ts | 14 +++++++------- .../qemu/configurator-qemu.component.ts | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.ts b/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.ts index 2c561c9da..9069efa0c 100644 --- a/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.ts +++ b/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.ts @@ -17,6 +17,7 @@ import { QemuService } from '../../../../services/qemu.service'; import { ControllerService } from '../../../../services/controller.service'; import { TemplateMocksService } from '../../../../services/template-mocks.service'; import { ToasterService } from '../../../../services/toaster.service'; +import { CustomAdapter } from '@models/qemu/qemu-custom-adapter'; @Component({ selector: 'app-add-qemu-virtual-machine-template', @@ -103,6 +104,7 @@ export class AddQemuVmTemplateComponent implements OnInit { this.controller = controller; this.templateMocksService.getQemuTemplate().subscribe((qemuTemplate: QemuTemplate) => { + debugger this.qemuTemplate = qemuTemplate; }); @@ -164,6 +166,7 @@ export class AddQemuVmTemplateComponent implements OnInit { } addTemplate() { + debugger if (!this.nameForm.invalid && !this.memoryForm.invalid && (this.selectedImage || this.chosenImage)) { this.qemuTemplate.ram = +this.memoryForm.get('ramMemory').value; this.qemuTemplate.platform = this.selectedPlatform; @@ -175,7 +178,14 @@ export class AddQemuVmTemplateComponent implements OnInit { this.qemuTemplate.template_id = uuid(); this.qemuTemplate.name = this.nameForm.get('templateName').value; this.qemuTemplate.compute_id = 'local'; - + // let adapter: CustomAdapter = { + // adapter_number: this.qemuTemplate.adapters, + // adapter_type:this.qemuTemplate.adapter_type , + // mac_address:null, + // port_name:this.qemuTemplate.port_name_format + // }; + // this.qemuTemplate.custom_adapters = this.qemuTemplate.custom_adapters.concat([adapter]); +debugger this.qemuService.addTemplate(this.controller, this.qemuTemplate).subscribe((template: QemuTemplate) => { this.goBack(); }); diff --git a/src/app/components/preferences/qemu/qemu-vm-template-details/qemu-vm-template-details.component.ts b/src/app/components/preferences/qemu/qemu-vm-template-details/qemu-vm-template-details.component.ts index ca8c02165..718c858e9 100644 --- a/src/app/components/preferences/qemu/qemu-vm-template-details/qemu-vm-template-details.component.ts +++ b/src/app/components/preferences/qemu/qemu-vm-template-details/qemu-vm-template-details.component.ts @@ -103,12 +103,12 @@ export class QemuVmTemplateDetailsComponent implements OnInit { this.fillCustomAdapters(); this.customAdaptersConfigurator.numberOfAdapters = this.qemuTemplate.adapters; this.customAdaptersConfigurator.adapters = []; - this.qemuTemplate.custom_adapters.forEach((adapter: CustomAdapter) => { + this.qemuTemplate.custom_adapters.forEach((adapter: CustomAdapter,i) => { this.customAdaptersConfigurator.adapters.push({ adapter_number: adapter.adapter_number, adapter_type: adapter.adapter_type, - mac_address:adapter.mac_address, - port_name:adapter.port_name + mac_address:null, + port_name:this.qemuTemplate.port_name_format.replace(/[0-9]/g,`${i}`) }); }); } @@ -120,18 +120,18 @@ export class QemuVmTemplateDetailsComponent implements OnInit { } fillCustomAdapters() { + let copyOfAdapters = this.qemuTemplate.custom_adapters ? this.qemuTemplate.custom_adapters : []; this.qemuTemplate.custom_adapters = []; - for (let i = 0; i < this.qemuTemplate.adapters; i++) { if (copyOfAdapters[i]) { this.qemuTemplate.custom_adapters.push(copyOfAdapters[i]); } else { this.qemuTemplate.custom_adapters.push({ adapter_number: i, - adapter_type: 'e1000', - mac_address:'', - port_name:'' + adapter_type: this.qemuTemplate.adapter_type, + mac_address:null, + port_name:this.qemuTemplate.port_name_format.replace(/[0-9]/g,`${i}`) }); } } diff --git a/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts b/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts index 2944b83fb..203989c43 100644 --- a/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts +++ b/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts @@ -110,7 +110,7 @@ export class ConfiguratorDialogQemuComponent implements OnInit { adapter_number: n.adapter_number, adapter_type: n.adapter_type, mac_address: n.mac_address ?? n.mac_address, - port_name: n.port_name ?? this.node.port_name_format.replace('{0}',`${i}`) + port_name: n.port_name ?? this.node.port_name_format.replace(/[0-9]/g,`${i}`) }); }); From db975aadcd1c11688a13b0c9f5c20ec7c9d42f3e Mon Sep 17 00:00:00 2001 From: Rajnikant Lodhi Date: Thu, 3 Nov 2022 14:47:19 +0530 Subject: [PATCH 4/6] Resolve custom adapters issue --- .../custom-adapters-table.component.html | 13 +++++++++---- .../add-qemu-vm-template.component.ts | 3 --- .../qemu-vm-template-details.component.ts | 2 +- .../qemu/configurator-qemu.component.ts | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.html b/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.html index 4fbba209b..0adb03f5d 100644 --- a/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.html +++ b/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.html @@ -1,4 +1,5 @@ - +{{adapters | json}} +
@@ -6,19 +7,23 @@ - + - + + + + diff --git a/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.ts b/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.ts index 9069efa0c..36685b498 100644 --- a/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.ts +++ b/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.ts @@ -104,7 +104,6 @@ export class AddQemuVmTemplateComponent implements OnInit { this.controller = controller; this.templateMocksService.getQemuTemplate().subscribe((qemuTemplate: QemuTemplate) => { - debugger this.qemuTemplate = qemuTemplate; }); @@ -166,7 +165,6 @@ export class AddQemuVmTemplateComponent implements OnInit { } addTemplate() { - debugger if (!this.nameForm.invalid && !this.memoryForm.invalid && (this.selectedImage || this.chosenImage)) { this.qemuTemplate.ram = +this.memoryForm.get('ramMemory').value; this.qemuTemplate.platform = this.selectedPlatform; @@ -185,7 +183,6 @@ export class AddQemuVmTemplateComponent implements OnInit { // port_name:this.qemuTemplate.port_name_format // }; // this.qemuTemplate.custom_adapters = this.qemuTemplate.custom_adapters.concat([adapter]); -debugger this.qemuService.addTemplate(this.controller, this.qemuTemplate).subscribe((template: QemuTemplate) => { this.goBack(); }); diff --git a/src/app/components/preferences/qemu/qemu-vm-template-details/qemu-vm-template-details.component.ts b/src/app/components/preferences/qemu/qemu-vm-template-details/qemu-vm-template-details.component.ts index 718c858e9..3e2c1cd24 100644 --- a/src/app/components/preferences/qemu/qemu-vm-template-details/qemu-vm-template-details.component.ts +++ b/src/app/components/preferences/qemu/qemu-vm-template-details/qemu-vm-template-details.component.ts @@ -108,7 +108,7 @@ export class QemuVmTemplateDetailsComponent implements OnInit { adapter_number: adapter.adapter_number, adapter_type: adapter.adapter_type, mac_address:null, - port_name:this.qemuTemplate.port_name_format.replace(/[0-9]/g,`${i}`) + port_name:this.qemuTemplate.port_name_format +'/'+ `${i}` }); }); } diff --git a/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts b/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts index 203989c43..87a648c50 100644 --- a/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts +++ b/src/app/components/project-map/node-editors/configurator/qemu/configurator-qemu.component.ts @@ -27,7 +27,7 @@ export class ConfiguratorDialogQemuComponent implements OnInit { bootPriorities = []; diskInterfaces: string[] = []; - displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type', 'actions']; + displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type','mac_address','actions']; networkTypes = []; qemuImages: QemuImage[] = []; selectPlatform: string[] = []; From 9ac4b7642c732cb53899422ce0a7495e8b945ae6 Mon Sep 17 00:00:00 2001 From: Rajnikant Lodhi Date: Thu, 3 Nov 2022 14:55:52 +0530 Subject: [PATCH 5/6] Remove debugging code --- .../custom-adapters-table/custom-adapters-table.component.html | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.html b/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.html index 0adb03f5d..322350d00 100644 --- a/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.html +++ b/src/app/components/preferences/common/custom-adapters-table/custom-adapters-table.component.html @@ -1,4 +1,3 @@ -{{adapters | json}}
Adapter number Adapter {{ element.adapter_number }}Port nameEthernet {{ element.adapter_number }}{{ element.short_name || element.port_name }} Adapter type + - {{ type.name }} + {{type.name}} ({{type.value}}) MAC address{{ element.mac_address }} Actions
From 81fc9e25403d8b660a50c3d66bd65cbd03b288e6 Mon Sep 17 00:00:00 2001 From: Rajnikant Lodhi Date: Mon, 7 Nov 2022 09:23:42 +0530 Subject: [PATCH 6/6] Resolve docker template custom adapters bug --- .../configure-custom-adapters.component.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/components/project-map/node-editors/configurator/docker/configure-custom-adapters/configure-custom-adapters.component.html b/src/app/components/project-map/node-editors/configurator/docker/configure-custom-adapters/configure-custom-adapters.component.html index e7f879ed6..9650f1b01 100644 --- a/src/app/components/project-map/node-editors/configurator/docker/configure-custom-adapters/configure-custom-adapters.component.html +++ b/src/app/components/project-map/node-editors/configurator/docker/configure-custom-adapters/configure-custom-adapters.component.html @@ -1,3 +1,4 @@ +

Configure custom adapters for node {{ node.name }}

Adapter number