Repository: ceph/go-ceph
Pull request #612 (2021-11-18 10:21:29)

rbd/admin: promote ImageSpec & tasks api to stable
Promoting ImageSpec & task apis to stable so
they can be release in v0.13.0.

Signed-off-by: Rakshith R <rar@redhat.com>


<!--
Thank you for opening a pull request. Please provide:

- A clear summary of your changes

- Descriptive and succinct commit messages with the format:
  """
  [topic]: [short description]

  [Longer description]

  Signed-off-by: [Your Name] <[your email]>
  """

  Topic will generally be the go ceph package dir you are working in.

- Ensure checklist items listed below are accounted for
-->

## Checklist
- [ ] Added tests for features and functional changes
- [ ] Public functions and types are documented
- [ ] Standard formatting is applied to Go code
- [ ] Is this a new API? Is this new API marked PREVIEW?


ansiwen: Thanks, I'll habe a look soon.

Patch:
diff --git a/docs/api-status.json b/docs/api-status.json
index a6128cd..fca3255 100644
--- a/docs/api-status.json
+++ b/docs/api-status.json
@@ -1590,62 +1590,42 @@
       {
         "name": "MirrorSnashotScheduleAdmin.Status",
         "comment": "Status returns the status of the snapshot (eg. when it will next take place)\nmatching the supplied level spec.\n\nSimilar To:\n rbd mirror snapshot schedule status <level_spec>\n"
-      }
-    ],
-    "preview_api": [
+      },
       {
         "name": "NewImageSpec",
-        "comment": "NewImageSpec is used to construct an ImageSpec given an image name/id\nand optional namespace and pool names.\nNewImageSpec constructs an ImageSpec to identify an RBD image and thus\nrequires image name/id, whereas NewLevelSpec constructs LevelSpec to\nidentify entire pool, pool namespace or single RBD image, all of which\nrequires pool name.\nPREVIEW\n",
-        "added_in_version": "v0.12.0",
-        "expected_stable_version": "v0.13.0"
+        "comment": "NewImageSpec is used to construct an ImageSpec given an image name/id\nand optional namespace and pool names.\nNewImageSpec constructs an ImageSpec to identify an RBD image and thus\nrequires image name/id, whereas NewLevelSpec constructs LevelSpec to\nidentify entire pool, pool namespace or single RBD image, all of which\nrequires pool name.\n"
       },
       {
         "name": "NewRawImageSpec",
-        "comment": "NewRawImageSpec returns a ImageSpec directly based on the spec string\nargument without constructing it from component values. This should only be\nused if NewImageSpec can not create the imagespec value you want to pass to\nceph.\nPREVIEW\n",
-        "added_in_version": "v0.12.0",
-        "expected_stable_version": "v0.13.0"
+        "comment": "NewRawImageSpec returns a ImageSpec directly based on the spec string\nargument without constructing it from component values. This should only be\nused if NewImageSpec can not create the imagespec value you want to pass to\nceph.\n"
       },
       {
         "name": "RBDAdmin.Task",
-        "comment": "Task returns a TaskAdmin type for\nmanaging ceph rbd task operations.\nPREVIEW\n",
-        "added_in_version": "v0.12.0",
-        "expected_stable_version": "v0.13.0"
+        "comment": "Task returns a TaskAdmin type for\nmanaging ceph rbd task operations.\n"
       },
       {
         "name": "TaskAdmin.AddFlatten",
-        "comment": "AddFlatten adds a background task to flatten a cloned image based on the supplied image spec.\n\nSimilar To:\n rbd task add flatten <image_spec>\nPREVIEW\n",
-        "added_in_version": "v0.12.0",
-        "expected_stable_version": "v0.13.0"
+        "comment": "AddFlatten adds a background task to flatten a cloned image based on the supplied image spec.\n\nSimilar To:\n rbd task add flatten <image_spec>\n"
       },
       {
         "name": "TaskAdmin.AddRemove",
-        "comment": "AddRemove adds a background task to remove an image based on the supplied image spec.\n\nSimilar To:\n rbd task add remove <image_spec>\nPREVIEW\n",
-        "added_in_version": "v0.12.0",
-        "expected_stable_version": "v0.13.0"
+        "comment": "AddRemove adds a background task to remove an image based on the supplied image spec.\n\nSimilar To:\n rbd task add remove <image_spec>\n"
       },
       {
         "name": "TaskAdmin.AddTrashRemove",
-        "comment": "AddTrashRemove adds a background task to remove an image from the trash based on the\nsupplied image id spec.\n\nSimilar To:\n rbd task add trash remove <image_id_spec>\nPREVIEW\n",
-        "added_in_version": "v0.12.0",
-        "expected_stable_version": "v0.13.0"
+        "comment": "AddTrashRemove adds a background task to remove an image from the trash based on the\nsupplied image id spec.\n\nSimilar To:\n rbd task add trash remove <image_id_spec>\n"
       },
       {
         "name": "TaskAdmin.List",
-        "comment": "List pending or running asynchronous tasks.\n\nSimilar To:\n rbd task list\nPREVIEW\n",
-        "added_in_version": "v0.12.0",
-        "expected_stable_version": "v0.13.0"
+        "comment": "List pending or running asynchronous tasks.\n\nSimilar To:\n rbd task list\n"
       },
       {
         "name": "TaskAdmin.GetTaskByID",
-        "comment": "GetTaskByID returns pending or running asynchronous task using id.\n\nSimilar To:\n rbd task list <task_id>\nPREVIEW\n",
-        "added_in_version": "v0.12.0",
-        "expected_stable_version": "v0.13.0"
+        "comment": "GetTaskByID returns pending or running asynchronous task using id.\n\nSimilar To:\n rbd task list <task_id>\n"
       },
       {
         "name": "TaskAdmin.Cancel",
-        "comment": "Cancel a pending or running asynchronous task.\n\nSimilar To:\n rbd task cancel <task_id>\nPREVIEW\n",
-        "added_in_version": "v0.12.0",
-        "expected_stable_version": "v0.13.0"
+        "comment": "Cancel a pending or running asynchronous task.\n\nSimilar To:\n rbd task cancel <task_id>\n"
       }
     ]
   },
diff --git a/docs/api-status.md b/docs/api-status.md
index d203044..5f37686 100644
--- a/docs/api-status.md
+++ b/docs/api-status.md
@@ -22,18 +22,6 @@ Snapshot.Set | v0.10.0 |  |
 
 ### Preview APIs
 
-Name | Added in Version | Expected Stable Version | 
----- | ---------------- | ----------------------- | 
-NewImageSpec | v0.12.0 | v0.13.0 | 
-NewRawImageSpec | v0.12.0 | v0.13.0 | 
-RBDAdmin.Task | v0.12.0 | v0.13.0 | 
-TaskAdmin.AddFlatten | v0.12.0 | v0.13.0 | 
-TaskAdmin.AddRemove | v0.12.0 | v0.13.0 | 
-TaskAdmin.AddTrashRemove | v0.12.0 | v0.13.0 | 
-TaskAdmin.List | v0.12.0 | v0.13.0 | 
-TaskAdmin.GetTaskByID | v0.12.0 | v0.13.0 | 
-TaskAdmin.Cancel | v0.12.0 | v0.13.0 | 
-
 ## Package: rgw/admin
 
 ### Preview APIs
diff --git a/rbd/admin/imagespec.go b/rbd/admin/imagespec.go
index 857fc8b..f2994d9 100644
--- a/rbd/admin/imagespec.go
+++ b/rbd/admin/imagespec.go
@@ -1,5 +1,5 @@
-//go:build !nautilus && ceph_preview
-// +build !nautilus,ceph_preview
+//go:build !nautilus
+// +build !nautilus
 
 package admin
 
@@ -10,14 +10,12 @@ import (
 // ImageSpec values are used to identify an RBD image wherever Ceph APIs
 // require an image_spec/image_id_spec using image name/id and optional
 // pool and namespace.
-//  PREVIEW
 type ImageSpec struct {
 	spec string
 }
 
 // NewImageSpec is used to construct an ImageSpec given an image name/id
 // and optional namespace and pool names.
-//  PREVIEW
 //
 // NewImageSpec constructs an ImageSpec to identify an RBD image and thus
 // requires image name/id, whereas NewLevelSpec constructs LevelSpec to
@@ -37,7 +35,6 @@ func NewImageSpec(pool, namespace, image string) ImageSpec {
 
 // NewRawImageSpec returns a ImageSpec directly based on the spec string
 // argument without constructing it from component values.
-//  PREVIEW
 //
 // This should only be used if NewImageSpec can not create the imagespec value
 // you want to pass to ceph.
diff --git a/rbd/admin/task.go b/rbd/admin/task.go
index d2f445b..750668e 100644
--- a/rbd/admin/task.go
+++ b/rbd/admin/task.go
@@ -1,5 +1,5 @@
-//go:build !nautilus && ceph_preview
-// +build !nautilus,ceph_preview
+//go:build !nautilus
+// +build !nautilus
 
 package admin
 
@@ -9,19 +9,16 @@ import (
 )
 
 // TaskAdmin encapsulates management functions for ceph rbd task operations.
-//  PREVIEW
 type TaskAdmin struct {
 	conn ccom.MgrCommander
 }
 
 // Task returns a TaskAdmin type for managing ceph rbd task operations.
-//  PREVIEW
 func (ra *RBDAdmin) Task() *TaskAdmin {
 	return &TaskAdmin{conn: ra.conn}
 }
 
 // TaskRefs contains the action name and information about the image.
-//  PREVIEW
 type TaskRefs struct {
 	Action        string `json:"action"`
 	PoolName      string `json:"pool_name"`
@@ -31,7 +28,6 @@ type TaskRefs struct {
 }
 
 // TaskResponse contains the information about the task added on an image.
-//  PREVIEW
 type TaskResponse struct {
 	Sequence      int      `json:"sequence"`
 	ID            string   `json:"id"`
@@ -58,7 +54,6 @@ func parseTaskResponseList(res commands.Response) ([]TaskResponse, error) {
 
 // AddFlatten adds a background task to flatten a cloned image based on the
 // supplied image spec.
-//  PREVIEW
 //
 // Similar To:
 //  rbd task add flatten <image_spec>
@@ -73,7 +68,6 @@ func (ta *TaskAdmin) AddFlatten(img ImageSpec) (TaskResponse, error) {
 
 // AddRemove adds a background task to remove an image based on the supplied
 // image spec.
-//  PREVIEW
 //
 // Similar To:
 //  rbd task add remove <image_spec>
@@ -88,7 +82,6 @@ func (ta *TaskAdmin) AddRemove(img ImageSpec) (TaskResponse, error) {
 
 // AddTrashRemove adds a background task to remove an image from the trash based
 // on the supplied image id spec.
-//  PREVIEW
 //
 // Similar To:
 //  rbd task add trash remove <image_id_spec>
@@ -102,7 +95,6 @@ func (ta *TaskAdmin) AddTrashRemove(img ImageSpec) (TaskResponse, error) {
 }
 
 // List pending or running asynchronous tasks.
-//  PREVIEW
 //
 // Similar To:
 //  rbd task list
@@ -115,7 +107,6 @@ func (ta *TaskAdmin) List() ([]TaskResponse, error) {
 }
 
 // GetTaskByID returns pending or running asynchronous task using id.
-//  PREVIEW
 //
 // Similar To:
 //  rbd task list <task_id>
@@ -129,7 +120,6 @@ func (ta *TaskAdmin) GetTaskByID(taskID string) (TaskResponse, error) {
 }
 
 // Cancel a pending or running asynchronous task.
-//  PREVIEW
 //
 // Similar To:
 //  rbd task cancel <task_id>


Test patch:
diff --git a/rbd/admin/task_test.go b/rbd/admin/task_test.go
index 6ca9137..00c61a6 100644
--- a/rbd/admin/task_test.go
+++ b/rbd/admin/task_test.go
@@ -1,5 +1,5 @@
-//go:build !nautilus && ceph_preview
-// +build !nautilus,ceph_preview
+//go:build !nautilus
+// +build !nautilus
 
 package admin