From 3dd7dab9119372bffc7b0a4dcdcd579bcab5b62c Mon Sep 17 00:00:00 2001 From: Ricardo Marques Date: Mon, 23 Apr 2018 10:45:23 +0100 Subject: [PATCH] mgr/dashboard: Add support for RBD snapshot copy (frontend) Signed-off-by: Ricardo Marques --- .../mgr/dashboard/frontend/src/app/app-routing.module.ts | 5 +++++ .../ceph/block/rbd-form/rbd-form-copy-request.model.ts | 1 + .../src/app/ceph/block/rbd-form/rbd-form.component.ts | 9 ++++++++- .../rbd-snapshot-list/rbd-snapshot-list.component.html | 6 ++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts index 6bb94b7425d04..77d5e5e68b5db 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts @@ -59,6 +59,11 @@ const routes: Routes = [ component: RbdFormComponent, canActivate: [AuthGuardService] }, + { + path: 'rbd/copy/:pool/:name/:snap', + component: RbdFormComponent, + canActivate: [AuthGuardService] + }, { path: 'perf_counters/:type/:id', component: PerformanceCounterComponent, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form-copy-request.model.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form-copy-request.model.ts index 9294583415b34..4553dc81c1fb6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form-copy-request.model.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form-copy-request.model.ts @@ -1,6 +1,7 @@ export class RbdFormCopyRequestModel { dest_pool_name: string; dest_image_name: string; + snapshot_name: string; obj_size: number; features: Array = []; stripe_unit: number; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts index 59aba9a8bc791..d8c0cba9023b1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts @@ -390,7 +390,11 @@ export class RbdFormComponent implements OnInit { if (this.mode === this.rbdFormMode.cloning) { this.rbdForm.get('parent').setValue(`${response.pool_name}/${response.name}@${snapName}`); } else if (this.mode === this.rbdFormMode.copying) { - this.rbdForm.get('parent').setValue(`${response.pool_name}/${response.name}`); + if (snapName) { + this.rbdForm.get('parent').setValue(`${response.pool_name}/${response.name}@${snapName}`); + } else { + this.rbdForm.get('parent').setValue(`${response.pool_name}/${response.name}`); + } } else if (response.parent) { const parent = response.parent; this.rbdForm.get('parent') @@ -568,6 +572,9 @@ export class RbdFormComponent implements OnInit { copyRequest(): RbdFormCopyRequestModel { const request = new RbdFormCopyRequestModel(); + if (this.snapName) { + request.snapshot_name = this.snapName; + } request.dest_pool_name = this.rbdForm.get('pool').value; request.dest_image_name = this.rbdForm.get('name').value; request.obj_size = this.formatter.toBytes(this.rbdForm.get('obj_size').value); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.html index 944f755eed9c0..603afdb0d32d7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.html @@ -39,6 +39,12 @@ Clone +
  • + + Copy + +
  • Rollback -- 2.39.5