]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: osd form preselect db/wal device filters 47574/head
authorNizamudeen A <nia@redhat.com>
Fri, 12 Aug 2022 15:34:23 +0000 (21:04 +0530)
committerNizamudeen A <nia@redhat.com>
Fri, 9 Sep 2022 05:18:28 +0000 (10:48 +0530)
If the hostname is selected for the primary devices, then we can
preselect the hostname filter for the db/wal devices because osds will
be deployed only on the hostname of the primary device. If preselected
it'll be clear that only this devices will be used to deploy.

Addition to this, usually ssd devices are used for db/wal devices. So I
am preselecting these too in the filters.

Fixes: https://tracker.ceph.com/issues/57118
Signed-off-by: Nizamudeen A <nia@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-modal/osd-devices-selection-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts

index e0d82cb1975db7e749cdb6c9bfe7bfe020b3fcc5..0ef0449c48126dfd762e57b02b3b3ca5970ef278 100644 (file)
@@ -47,6 +47,10 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy {
   // Do not display these columns
   @Input() hiddenColumns: string[] = [];
 
+  @Input() hostname = '';
+
+  @Input() diskType = '';
+
   // Show filters for these columns, specify empty array to disable
   @Input() filterColumns = [
     'hostname',
@@ -167,6 +171,14 @@ export class InventoryDevicesComponent implements OnInit, OnDestroy {
       if (col) {
         col.filterable = true;
       }
+
+      if (col?.prop === 'human_readable_type' && this.diskType === 'ssd') {
+        col.filterInitValue = this.diskType;
+      }
+
+      if (col?.prop === 'hostname' && this.hostname) {
+        col.filterInitValue = this.hostname;
+      }
     });
 
     if (this.fetchInventory.observers.length > 0) {
index cff0cbc0563fc8a39f146933a256042bd47fb204..6c5cf52f6f53dc282db7f364a4033432f3b62372 100644 (file)
@@ -76,13 +76,18 @@ export class OsdDevicesSelectionGroupsComponent implements OnInit, OnChanges {
   }
 
   showSelectionModal() {
-    let filterColumns = ['human_readable_type', 'sys_api.vendor', 'sys_api.model', 'sys_api.size'];
-    if (this.type === 'data') {
-      filterColumns = ['hostname', ...filterColumns];
-    }
+    const filterColumns = [
+      'hostname',
+      'human_readable_type',
+      'sys_api.vendor',
+      'sys_api.model',
+      'sys_api.size'
+    ];
+    const diskType = this.name === 'Primary' ? 'hdd' : 'ssd';
     const initialState = {
       hostname: this.hostname,
       deviceType: this.name,
+      diskType: diskType,
       devices: this.availDevices,
       filterColumns: filterColumns
     };
index 3e53d5c410cd2ceef6a12e5130883f1ea12804bf..2a4344944c46c7983a4efcfe0c3d6bd00858f6f8 100644 (file)
@@ -20,7 +20,8 @@
         <cd-inventory-devices #inventoryDevices
                               [devices]="devices"
                               [filterColumns]="filterColumns"
-                              [showAvailDeviceOnly]="true"
+                              [hostname]="hostname"
+                              [diskType]="diskType"
                               [hiddenColumns]="['available', 'osd_ids']"
                               (filterChange)="onFilterChange($event)">
         </cd-inventory-devices>
index edfe9d6a7c3e208243e3a1dc63ca764da9da3bdd..f3ed46227bc226e0c90251958bb826764c1332fa 100644 (file)
@@ -1,4 +1,11 @@
-import { AfterViewInit, Component, EventEmitter, Output, ViewChild } from '@angular/core';
+import {
+  AfterViewInit,
+  ChangeDetectorRef,
+  Component,
+  EventEmitter,
+  Output,
+  ViewChild
+} from '@angular/core';
 
 import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 import { TableColumnProp } from '@swimlane/ngx-datatable';
@@ -30,6 +37,7 @@ export class OsdDevicesSelectionModalComponent implements AfterViewInit {
 
   hostname: string;
   deviceType: string;
+  diskType: string;
   formGroup: CdFormGroup;
   action: string;
 
@@ -42,6 +50,7 @@ export class OsdDevicesSelectionModalComponent implements AfterViewInit {
 
   constructor(
     private formBuilder: CdFormBuilder,
+    private cdRef: ChangeDetectorRef,
     public activeModal: NgbActiveModal,
     public actionLabels: ActionLabelsI18n,
     public wizardStepService: WizardStepsService
@@ -83,6 +92,7 @@ export class OsdDevicesSelectionModalComponent implements AfterViewInit {
       this.capacity = _.sumBy(this.filteredDevices, 'sys_api.size');
       this.event = event;
     }
+    this.cdRef.detectChanges();
   }
 
   onSubmit() {
index 531bae2573941d9388f56206b2f3f2eae2111367..9711fe1a80d14ece9326573ecd84b161d9de9c85 100644 (file)
                                                  [availDevices]="availDevices"
                                                  [canSelect]="dataDeviceSelectionGroups.devices.length !== 0"
                                                  (selected)="onDevicesSelected($event)"
-                                                 (cleared)="onDevicesCleared($event)">
+                                                 (cleared)="onDevicesCleared($event)"
+                                                 [hostname]="hostname">
                 </cd-osd-devices-selection-groups>
 
                 <!-- WAL slots -->
                                                  [availDevices]="availDevices"
                                                  [canSelect]="dataDeviceSelectionGroups.devices.length !== 0"
                                                  (selected)="onDevicesSelected($event)"
-                                                 (cleared)="onDevicesCleared($event)">
+                                                 (cleared)="onDevicesCleared($event)"
+                                                 [hostname]="hostname">
                 </cd-osd-devices-selection-groups>
 
                 <!-- DB slots -->
index c2384425e7019127d087b54ba8813dfdc50513db..e2085548f0f51e8afe844a3c0b610c0345e0c827 100644 (file)
@@ -219,6 +219,7 @@ export class OsdFormComponent extends CdForm implements OnInit {
 
   onDevicesCleared(event: DevicesSelectionClearEvent) {
     if (event.type === 'data') {
+      this.hostname = '';
       this.availDevices = [...this.allDevices];
       this.walDeviceSelectionGroups.devices = [];
       this.dbDeviceSelectionGroups.devices = [];