openstorage
openstorage copied to clipboard
Feature: Service API (Part 1) [WIP]
Is this a BUG REPORT or FEATURE REQUEST?: FEATURE
Reason Needed: To create OSD-SDK Move internal PX API to OSD to create external API SDK.
Service API (Part 1)
Service level commands allows maintenance related operation of drives and drive pools. The most common cases would be for Disk addition/replacement. Here are all suppported API's -
a. Enter Maintenance mode
Enter Maintenance mode take node out of cluster and allows user to perform physical maintenance of node.
- Method : PUT
- Endpoint : /entermaintenance
- Content-type : application/json
- Response status : 200
Example Request :
PUT /v1/service/entermaintenance
Example Response:
200
b. Exit Maintenance mode
Exit maintenance mode will put node back into cluster
- Method : PUT
- Endpoint : /exitmaintenance
- Content-type : application/json
- Response status : 200
Example Request :
PUT /v1/service/exitmaintenance
Example Response :
200
c. Add Drive
Add drive to cluster storage pool
- Method : POST
- Endpoint : /drive
- Content-type : application/json
- Response status : 200
- Params : operation (string) : start/status of drive add operation (default start) drive (string) : drive to add e.g /dev/sda, /dev/sdb journal(bool) : Use this drive as a journal device
Example Request
POST /v1/service/drive
Content-type : application/json
{
drive : "/dev/sda",
journal : true
}
Example Response : 200
d. Replace Drive
Let you replace old drive with new drive.
- Method : PUT
- Endpoint : /drive
- Content-type : application/json
- Response status : 200
- Params : operation(string): start/status of replace operation source (string) : source drive to replace target(string) : target drive to replace source drive with
Example Request :
PUT /v1/service/drive
Content-type : application/json
{
source : "/dev/sda",
target : "/dev/sdb"
}
Example Response : 200
e. Rebalance the storage pool
Pool rebalance does spread data across all available drives in the pool.
- Method : PUT
- Endpoint : /rebalancepool
- Content-type : application/json
- Response status : status(string)
- Params : operation(string): start/status of operation poolID (string): poolID to rebalance
Example Request :
PUT /v1/service/rebalancepool
Content-type : application/json
{
operation : "start",
poolID : "0"
}
Example Response : 200
{
status : "Running"
}
Interface :
type service interface {
// ServiceAddDrive adds the specified drive
ServiceAddDrive(op, drive string, journal bool) (string, error)
// ReplaceDrive source with target.
ServiceReplaceDrive(op, source, target string) (string, error)
// Rebalance the storage pool
ServiceRebalancePool(op string, poolID int) (string, error)
// ExitMaintenanceMode exits maintenance mode
ServiceExitMaintenanceMode() error
// EnterMaintenanceMode enters maintenance mode and exits the proces
ServiceEnterMaintenanceMode(exitOut bool) error
}
@prabirpaul and I discussed about Service API's needs to be moved into OSD. Basically command which is used for internal diagnosis such as CheckDrive need not to be added on OSD-SDK.
I have updated above doc. accordingly. @prabirpaul please let me know if I missed anything.
We can follow similar implementation approach like we did for secrets and schedule policy api for this. @prabirpaul here is link for same