]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Add support for RBD snapshot copy (frontend)
authorRicardo Marques <rimarques@suse.com>
Mon, 23 Apr 2018 09:45:23 +0000 (10:45 +0100)
committerRicardo Marques <rimarques@suse.com>
Tue, 24 Apr 2018 15:50:37 +0000 (16:50 +0100)
Signed-off-by: Ricardo Marques <rimarques@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form-copy-request.model.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.html

index 6bb94b7425d047ec6e88ee11483b933f14f6eaa0..77d5e5e68b5db69fd2f78aee53152f543b6bd739 100644 (file)
@@ -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,
index 9294583415b34637fae641997855e7c7d379004e..4553dc81c1fb6002bf1df7e051a76fb8bb6cccad 100644 (file)
@@ -1,6 +1,7 @@
 export class RbdFormCopyRequestModel {
   dest_pool_name: string;
   dest_image_name: string;
+  snapshot_name: string;
   obj_size: number;
   features: Array<string> = [];
   stripe_unit: number;
index 59aba9a8bc79158968426ac00ec63713eda97306..d8c0cba9023b1300d02a627fe57a0081a16cc70b 100644 (file)
@@ -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);
index 944f755eed9c0890f330a2fb9e0efb398c86d31a..603afdb0d32d72326c6005f7cc0c5280483da1a9 100644 (file)
             <i class="fa fa-fw fa-clone"></i><span i18n>Clone</span>
           </a>
         </li>
+        <li role="menuitem"
+            [ngClass]="{'disabled': !selection.hasSingleSelection || selection.first().executing}">
+          <a class="dropdown-item" routerLink="/rbd/copy/{{ poolName }}/{{ rbdName }}/{{ selection.first()?.name }}">
+            <i class="fa fa-fw fa-copy"></i><span i18n>Copy</span>
+          </a>
+        </li>
         <li role="menuitem"
             [ngClass]="{'disabled': !selection.hasSingleSelection || selection.first().executing}">
           <a class="dropdown-item" (click)="rollbackModal()"><i class="fa fa-fw fa-undo"></i><span i18n>Rollback</span></a>