summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard
diff options
context:
space:
mode:
authorafreen23 <afreen23.git@gmail.com>2024-10-16 17:23:05 +0200
committerGitHub <noreply@github.com>2024-10-16 17:23:05 +0200
commit3a75014bf6e8fd781fe391c711a088770979e66c (patch)
tree314c19ec67cfd876d763db92109db980bef90455 /src/pybind/mgr/dashboard
parentMerge pull request #60306 from cbodley/wip-osdc-rm-completion (diff)
parentmgr/dashboard: Adapt gateway group changes in nvmeof UI (diff)
downloadceph-3a75014bf6e8fd781fe391c711a088770979e66c.tar.xz
ceph-3a75014bf6e8fd781fe391c711a088770979e66c.zip
Merge pull request #60263 from afreen23/wip-api-update
mgr/dashboard: Adapt gateway group changes in nvmeof UI Reviewed-by: Afreen Misbah <afreen@ibm.com>
Diffstat (limited to 'src/pybind/mgr/dashboard')
-rw-r--r--src/pybind/mgr/dashboard/controllers/nvmeof.py10
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-form/nvmeof-initiators-form.component.ts11
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-list/nvmeof-initiators-list.component.ts25
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-listeners-form/nvmeof-listeners-form.component.ts7
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-listeners-list/nvmeof-listeners-list.component.ts10
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-form/nvmeof-namespaces-form.component.ts7
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-list/nvmeof-namespaces-list.component.ts48
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-details/nvmeof-subsystems-details.component.html8
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.ts4
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts9
-rw-r--r--src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts42
11 files changed, 107 insertions, 74 deletions
diff --git a/src/pybind/mgr/dashboard/controllers/nvmeof.py b/src/pybind/mgr/dashboard/controllers/nvmeof.py
index f199867943d..519c310a98b 100644
--- a/src/pybind/mgr/dashboard/controllers/nvmeof.py
+++ b/src/pybind/mgr/dashboard/controllers/nvmeof.py
@@ -463,16 +463,17 @@ else:
parameters={
'subsystem_nqn': (str, 'Subsystem NQN'),
"host_nqn": Param(str, 'Comma separated list of NVMeoF host NQNs'),
+ "gw_group": Param(str, "NVMeoF gateway group")
})
@empty_response
@handle_nvmeof_error
@CreatePermission
- def add(self, subsystem_nqn: str, host_nqn: str = ""):
+ def add(self, subsystem_nqn: str, gw_group: str, host_nqn: str = ""):
response = None
all_host_nqns = host_nqn.split(',')
for nqn in all_host_nqns:
- response = NVMeoFClient().stub.add_host(
+ response = NVMeoFClient(gw_group=gw_group).stub.add_host(
NVMeoFClient.pb2.add_host_req(subsystem_nqn=subsystem_nqn, host_nqn=nqn)
)
if response.status != 0:
@@ -484,16 +485,17 @@ else:
parameters={
"subsystem_nqn": Param(str, "NVMeoF subsystem NQN"),
"host_nqn": Param(str, 'Comma separated list of NVMeoF host NQN.'),
+ "gw_group": Param(str, "NVMeoF gateway group")
})
@empty_response
@handle_nvmeof_error
@DeletePermission
- def remove(self, subsystem_nqn: str, host_nqn: str):
+ def remove(self, subsystem_nqn: str, host_nqn: str, gw_group: str):
response = None
to_delete_nqns = host_nqn.split(',')
for del_nqn in to_delete_nqns:
- response = NVMeoFClient().stub.remove_host(
+ response = NVMeoFClient(gw_group=gw_group).stub.remove_host(
NVMeoFClient.pb2.remove_host_req(subsystem_nqn=subsystem_nqn, host_nqn=del_nqn)
)
if response.status != 0:
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-form/nvmeof-initiators-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-form/nvmeof-initiators-form.component.ts
index 3a143a1a8df..32f7c76a362 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-form/nvmeof-initiators-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-form/nvmeof-initiators-form.component.ts
@@ -10,7 +10,7 @@ import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
import { FinishedTask } from '~/app/shared/models/finished-task';
import { ActivatedRoute, Router } from '@angular/router';
-import { NvmeofService } from '~/app/shared/api/nvmeof.service';
+import { InitiatorRequest, NvmeofService } from '~/app/shared/api/nvmeof.service';
@Component({
selector: 'cd-nvmeof-initiators-form',
@@ -26,6 +26,7 @@ export class NvmeofInitiatorsFormComponent implements OnInit {
remove: boolean = false;
subsystemNQN: string;
removeHosts: { name: string; value: boolean; id: number }[] = [];
+ group: string;
constructor(
private authStorageService: AuthStorageService,
@@ -52,6 +53,9 @@ export class NvmeofInitiatorsFormComponent implements OnInit {
);
ngOnInit() {
+ this.route.queryParams.subscribe((params) => {
+ this.group = params?.['group'];
+ });
this.createForm();
this.action = this.actionLabels.ADD;
this.route.params.subscribe((params: { subsystem_nqn: string }) => {
@@ -108,8 +112,9 @@ export class NvmeofInitiatorsFormComponent implements OnInit {
const hosts: string[] = this.addedHosts.value;
let taskUrl = `nvmeof/initiator/${URLVerbs.ADD}`;
- const request = {
- host_nqn: hosts.join(',')
+ const request: InitiatorRequest = {
+ host_nqn: hosts.join(','),
+ gw_group: this.group
};
if (allowAnyHost) {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-list/nvmeof-initiators-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-list/nvmeof-initiators-list.component.ts
index fff38e6985a..a5575a9c926 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-list/nvmeof-initiators-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-list/nvmeof-initiators-list.component.ts
@@ -1,4 +1,4 @@
-import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
+import { Component, Input, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { NvmeofService } from '~/app/shared/api/nvmeof.service';
import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
@@ -20,9 +20,11 @@ const BASE_URL = 'block/nvmeof/subsystems';
templateUrl: './nvmeof-initiators-list.component.html',
styleUrls: ['./nvmeof-initiators-list.component.scss']
})
-export class NvmeofInitiatorsListComponent implements OnInit, OnChanges {
+export class NvmeofInitiatorsListComponent implements OnInit {
@Input()
subsystemNQN: string;
+ @Input()
+ group: string;
@ViewChild('hostTpl', { static: true })
hostTpl: TemplateRef<any>;
@@ -58,10 +60,10 @@ export class NvmeofInitiatorsListComponent implements OnInit, OnChanges {
permission: 'create',
icon: Icons.add,
click: () =>
- this.router.navigate([
- BASE_URL,
- { outlets: { modal: [URLVerbs.ADD, this.subsystemNQN, 'initiator'] } }
- ]),
+ this.router.navigate(
+ [BASE_URL, { outlets: { modal: [URLVerbs.ADD, this.subsystemNQN, 'initiator'] } }],
+ { queryParams: { group: this.group } }
+ ),
canBePrimary: (selection: CdTableSelection) => !selection.hasSelection
},
{
@@ -79,17 +81,13 @@ export class NvmeofInitiatorsListComponent implements OnInit, OnChanges {
return this.selection.selected.findIndex((selected) => selected.nqn === '*');
}
- ngOnChanges() {
- this.listInitiators();
- }
-
updateSelection(selection: CdTableSelection) {
this.selection = selection;
}
listInitiators() {
this.nvmeofService
- .getInitiators(this.subsystemNQN)
+ .getInitiators(this.subsystemNQN, this.group)
.subscribe((initiators: NvmeofSubsystemInitiator[]) => {
this.initiators = initiators;
});
@@ -118,7 +116,10 @@ export class NvmeofInitiatorsListComponent implements OnInit, OnChanges {
nqn: this.subsystemNQN,
plural: itemNames.length > 1
}),
- call: this.nvmeofService.removeInitiators(this.subsystemNQN, { host_nqn })
+ call: this.nvmeofService.removeInitiators(this.subsystemNQN, {
+ host_nqn,
+ gw_group: this.group
+ })
})
});
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-listeners-form/nvmeof-listeners-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-listeners-form/nvmeof-listeners-form.component.ts
index cd362bf8abe..8310e65d203 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-listeners-form/nvmeof-listeners-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-listeners-form/nvmeof-listeners-form.component.ts
@@ -103,7 +103,8 @@ export class NvmeofListenersFormComponent implements OnInit {
const host = this.listenerForm.getValue('host');
let trsvcid = Number(this.listenerForm.getValue('trsvcid'));
if (!trsvcid) trsvcid = 4420;
- const request = {
+ const request: ListenerRequest = {
+ gw_group: this.group,
host_name: host.hostname,
traddr: host.addr,
trsvcid
@@ -128,9 +129,7 @@ export class NvmeofListenersFormComponent implements OnInit {
component.listenerForm.setErrors({ cdSubmitButton: true });
},
complete: () => {
- this.router.navigate([this.pageURL, { outlets: { modal: null } }], {
- queryParams: { group: this.group }
- });
+ this.router.navigate([this.pageURL, { outlets: { modal: null } }]);
}
});
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-listeners-list/nvmeof-listeners-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-listeners-list/nvmeof-listeners-list.component.ts
index 974727ad062..b49adda7c1b 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-listeners-list/nvmeof-listeners-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-listeners-list/nvmeof-listeners-list.component.ts
@@ -1,4 +1,4 @@
-import { Component, Input, OnChanges, OnInit } from '@angular/core';
+import { Component, Input, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { NvmeofService } from '~/app/shared/api/nvmeof.service';
import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
@@ -21,7 +21,7 @@ const BASE_URL = 'block/nvmeof/subsystems';
templateUrl: './nvmeof-listeners-list.component.html',
styleUrls: ['./nvmeof-listeners-list.component.scss']
})
-export class NvmeofListenersListComponent implements OnInit, OnChanges {
+export class NvmeofListenersListComponent implements OnInit {
@Input()
subsystemNQN: string;
@Input()
@@ -81,17 +81,13 @@ export class NvmeofListenersListComponent implements OnInit, OnChanges {
];
}
- ngOnChanges() {
- this.listListeners();
- }
-
updateSelection(selection: CdTableSelection) {
this.selection = selection;
}
listListeners() {
this.nvmeofService
- .listListeners(this.subsystemNQN)
+ .listListeners(this.subsystemNQN, this.group)
.subscribe((listResponse: NvmeofListener[]) => {
this.listeners = listResponse.map((listener, index) => {
listener['id'] = index;
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-form/nvmeof-namespaces-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-form/nvmeof-namespaces-form.component.ts
index f5721e11ab6..b65ad62bdb4 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-form/nvmeof-namespaces-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-form/nvmeof-namespaces-form.component.ts
@@ -41,6 +41,7 @@ export class NvmeofNamespacesFormComponent implements OnInit {
nsid: string;
currentBytes: number;
invalidSizeError: boolean;
+ group: string;
constructor(
public actionLabels: ActionLabelsI18n,
@@ -62,6 +63,9 @@ export class NvmeofNamespacesFormComponent implements OnInit {
}
init() {
+ this.route.queryParams.subscribe((params) => {
+ this.group = params?.['group'];
+ });
this.createForm();
this.action = this.actionLabels.CREATE;
this.route.params.subscribe((params: { subsystem_nqn: string; nsid: string }) => {
@@ -74,7 +78,7 @@ export class NvmeofNamespacesFormComponent implements OnInit {
this.edit = true;
this.action = this.actionLabels.EDIT;
this.nvmeofService
- .getNamespace(this.subsystemNQN, this.nsid)
+ .getNamespace(this.subsystemNQN, this.nsid, this.group)
.subscribe((res: NvmeofSubsystemNamespace) => {
const convertedSize = this.dimlessBinaryPipe.transform(res.rbd_image_size).split(' ');
this.currentBytes = res.rbd_image_size;
@@ -120,6 +124,7 @@ export class NvmeofNamespacesFormComponent implements OnInit {
const image_size = this.nsForm.getValue('image_size');
const image_size_unit = this.nsForm.getValue('unit');
const request = {} as NamespaceCreateRequest | NamespaceEditRequest;
+ request['gw_group'] = this.group;
if (image_size) {
const key: string = this.edit ? 'rbd_image_size' : 'size';
const value: number = this.formatterService.toBytes(image_size + image_size_unit);
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-list/nvmeof-namespaces-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-list/nvmeof-namespaces-list.component.ts
index c40b538c820..8f8f6eb8d05 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-list/nvmeof-namespaces-list.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-list/nvmeof-namespaces-list.component.ts
@@ -1,4 +1,4 @@
-import { Component, Input, OnChanges, OnInit } from '@angular/core';
+import { Component, Input, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { NvmeofService } from '~/app/shared/api/nvmeof.service';
import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
@@ -23,9 +23,11 @@ const BASE_URL = 'block/nvmeof/subsystems';
templateUrl: './nvmeof-namespaces-list.component.html',
styleUrls: ['./nvmeof-namespaces-list.component.scss']
})
-export class NvmeofNamespacesListComponent implements OnInit, OnChanges {
+export class NvmeofNamespacesListComponent implements OnInit {
@Input()
subsystemNQN: string;
+ @Input()
+ group: string;
namespacesColumns: any;
tableActions: CdTableAction[];
@@ -117,10 +119,10 @@ export class NvmeofNamespacesListComponent implements OnInit, OnChanges {
permission: 'create',
icon: Icons.add,
click: () =>
- this.router.navigate([
- BASE_URL,
- { outlets: { modal: [URLVerbs.CREATE, this.subsystemNQN, 'namespace'] } }
- ]),
+ this.router.navigate(
+ [BASE_URL, { outlets: { modal: [URLVerbs.CREATE, this.subsystemNQN, 'namespace'] } }],
+ { queryParams: { group: this.group } }
+ ),
canBePrimary: (selection: CdTableSelection) => !selection.hasSelection
},
{
@@ -128,41 +130,45 @@ export class NvmeofNamespacesListComponent implements OnInit, OnChanges {
permission: 'update',
icon: Icons.edit,
click: () =>
- this.router.navigate([
- BASE_URL,
- {
- outlets: {
- modal: [URLVerbs.EDIT, this.subsystemNQN, 'namespace', this.selection.first().nsid]
+ this.router.navigate(
+ [
+ BASE_URL,
+ {
+ outlets: {
+ modal: [
+ URLVerbs.EDIT,
+ this.subsystemNQN,
+ 'namespace',
+ this.selection.first().nsid
+ ]
+ }
}
- }
- ])
+ ],
+ { queryParams: { group: this.group } }
+ )
},
{
name: this.actionLabels.DELETE,
permission: 'delete',
icon: Icons.destroy,
- click: () => this.deleteSubsystemModal()
+ click: () => this.deleteNamespaceModal()
}
];
}
- ngOnChanges() {
- this.listNamespaces();
- }
-
updateSelection(selection: CdTableSelection) {
this.selection = selection;
}
listNamespaces() {
this.nvmeofService
- .listNamespaces(this.subsystemNQN)
+ .listNamespaces(this.subsystemNQN, this.group)
.subscribe((res: NvmeofSubsystemNamespace[]) => {
this.namespaces = res;
});
}
- deleteSubsystemModal() {
+ deleteNamespaceModal() {
const namespace = this.selection.first();
this.modalService.show(CriticalConfirmationModalComponent, {
itemDescription: 'Namespace',
@@ -174,7 +180,7 @@ export class NvmeofNamespacesListComponent implements OnInit, OnChanges {
nqn: this.subsystemNQN,
nsid: namespace.nsid
}),
- call: this.nvmeofService.deleteNamespace(this.subsystemNQN, namespace.nsid)
+ call: this.nvmeofService.deleteNamespace(this.subsystemNQN, namespace.nsid, this.group)
})
});
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-details/nvmeof-subsystems-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-details/nvmeof-subsystems-details.component.html
index 7f15a1360ad..58a1e01a525 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-details/nvmeof-subsystems-details.component.html
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-details/nvmeof-subsystems-details.component.html
@@ -24,14 +24,18 @@
<a ngbNavLink
i18n>Namespaces</a>
<ng-template ngbNavContent>
- <cd-nvmeof-namespaces-list [subsystemNQN]="subsystemNQN"></cd-nvmeof-namespaces-list>
+ <cd-nvmeof-namespaces-list [subsystemNQN]="subsystemNQN"
+ [group]="group">
+ </cd-nvmeof-namespaces-list>
</ng-template>
</ng-container>
<ng-container ngbNavItem="initiators">
<a ngbNavLink
i18n>Initiators</a>
<ng-template ngbNavContent>
- <cd-nvmeof-initiators-list [subsystemNQN]="subsystemNQN"></cd-nvmeof-initiators-list>
+ <cd-nvmeof-initiators-list [subsystemNQN]="subsystemNQN"
+ [group]="group">
+ </cd-nvmeof-initiators-list>
</ng-template>
</ng-container>
</nav>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.ts
index f7b35a2d645..7e5b064f379 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems-form/nvmeof-subsystems-form.component.ts
@@ -118,9 +118,7 @@ export class NvmeofSubsystemsFormComponent implements OnInit {
component.subsystemForm.setErrors({ cdSubmitButton: true });
},
complete: () => {
- this.router.navigate([this.pageURL, { outlets: { modal: null } }], {
- queryParams: { group: this.group }
- });
+ this.router.navigate([this.pageURL, { outlets: { modal: null } }]);
}
});
}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts
index 313db3445f2..a5c84e60b6f 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.spec.ts
@@ -27,6 +27,7 @@ describe('NvmeofService', () => {
expect(service).toBeTruthy();
});
+ // gateways
it('should call listGatewayGroups', () => {
service.listGatewayGroups().subscribe();
const req = httpTesting.expectOne('api/nvmeof/gateway/group');
@@ -39,6 +40,7 @@ describe('NvmeofService', () => {
expect(req.request.method).toBe('GET');
});
+ // subsystems
it('should call listSubsystems', () => {
service.listSubsystems(mockGroupName).subscribe();
const req = httpTesting.expectOne(`api/nvmeof/subsystem?gw_group=${mockGroupName}`);
@@ -69,9 +71,12 @@ describe('NvmeofService', () => {
expect(req.request.method).toBe('DELETE');
});
+ // initiators
it('should call getInitiators', () => {
- service.getInitiators(mockNQN).subscribe();
- const req = httpTesting.expectOne(`api/nvmeof/subsystem/${mockNQN}/host`);
+ service.getInitiators(mockNQN, mockGroupName).subscribe();
+ const req = httpTesting.expectOne(
+ `api/nvmeof/subsystem/${mockNQN}/host?gw_group=${mockGroupName}`
+ );
expect(req.request.method).toBe('GET');
});
});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts
index 40202d0d672..a2bbf507bc3 100644
--- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts
+++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nvmeof.service.ts
@@ -8,6 +8,7 @@ import { catchError, mapTo } from 'rxjs/operators';
export const MAX_NAMESPACE = 1024;
export interface ListenerRequest {
+ gw_group: string;
host_name: string;
traddr: string;
trsvcid: number;
@@ -17,14 +18,17 @@ export interface NamespaceCreateRequest {
rbd_image_name: string;
rbd_pool: string;
size: number;
+ gw_group: string;
}
export interface NamespaceEditRequest {
rbd_image_size: number;
+ gw_group: string;
}
export interface InitiatorRequest {
host_nqn: string;
+ gw_group: string;
}
const API_PATH = 'api/nvmeof';
@@ -81,8 +85,8 @@ export class NvmeofService {
}
// Initiators
- getInitiators(subsystemNQN: string) {
- return this.http.get(`${API_PATH}/subsystem/${subsystemNQN}/host`);
+ getInitiators(subsystemNQN: string, group: string) {
+ return this.http.get(`${API_PATH}/subsystem/${subsystemNQN}/host?gw_group=${group}`);
}
addInitiators(subsystemNQN: string, request: InitiatorRequest) {
@@ -92,14 +96,17 @@ export class NvmeofService {
}
removeInitiators(subsystemNQN: string, request: InitiatorRequest) {
- return this.http.delete(`${UI_API_PATH}/subsystem/${subsystemNQN}/host/${request.host_nqn}`, {
- observe: 'response'
- });
+ return this.http.delete(
+ `${UI_API_PATH}/subsystem/${subsystemNQN}/host/${request.host_nqn}/${request.gw_group}`,
+ {
+ observe: 'response'
+ }
+ );
}
// Listeners
- listListeners(subsystemNQN: string) {
- return this.http.get(`${API_PATH}/subsystem/${subsystemNQN}/listener`);
+ listListeners(subsystemNQN: string, group: string) {
+ return this.http.get(`${API_PATH}/subsystem/${subsystemNQN}/listener?gw_group=${group}`);
}
createListener(subsystemNQN: string, request: ListenerRequest) {
@@ -121,12 +128,14 @@ export class NvmeofService {
}
// Namespaces
- listNamespaces(subsystemNQN: string) {
- return this.http.get(`${API_PATH}/subsystem/${subsystemNQN}/namespace`);
+ listNamespaces(subsystemNQN: string, group: string) {
+ return this.http.get(`${API_PATH}/subsystem/${subsystemNQN}/namespace?gw_group=${group}`);
}
- getNamespace(subsystemNQN: string, nsid: string) {
- return this.http.get(`${API_PATH}/subsystem/${subsystemNQN}/namespace/${nsid}`);
+ getNamespace(subsystemNQN: string, nsid: string, group: string) {
+ return this.http.get(
+ `${API_PATH}/subsystem/${subsystemNQN}/namespace/${nsid}?gw_group=${group}`
+ );
}
createNamespace(subsystemNQN: string, request: NamespaceCreateRequest) {
@@ -141,9 +150,12 @@ export class NvmeofService {
});
}
- deleteNamespace(subsystemNQN: string, nsid: string) {
- return this.http.delete(`${API_PATH}/subsystem/${subsystemNQN}/namespace/${nsid}`, {
- observe: 'response'
- });
+ deleteNamespace(subsystemNQN: string, nsid: string, group: string) {
+ return this.http.delete(
+ `${API_PATH}/subsystem/${subsystemNQN}/namespace/${nsid}?gw_group=${group}`,
+ {
+ observe: 'response'
+ }
+ );
}
}