]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: osd form preselect db/wal device filters 48115/head
authorNizamudeen A <nia@redhat.com>
Fri, 12 Aug 2022 15:34:23 +0000 (21:04 +0530)
committerNizamudeen A <nia@redhat.com>
Thu, 15 Sep 2022 06:55:59 +0000 (12:25 +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>
(cherry picked from commit 5f8eff3beff7b8aa0066811dedf0024b76001a6e)

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 d4b6d9faea1099d2ce677d218a838d4d35035081..12279246a99eedecf2220bc2e08517f59cda80d9 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 = [];