Bug 156: Option to create partition and mount from REST API

Review Request #296 — Created June 21, 2024 and submitted

apoorva.sn
AMP
amp_3_6_0
156
pmurugaiyan, prajesh, shuinvy

Problem

Need option to find the free space available and provide the secondary storage information to the users. This is one time option provided to users.

The user can choose ‘primary’ or ‘secondary’ storage locations for storing logs

Solution

Implemented 3 API's

  1. GET /log/location: which will provide details of the current log location
    Response:
    {
    "location": "primary"
    }

  2. POST/PUT /log/location: which will set the log location to 'primary' or 'secondary'
    Request:
    {
    "location": "secondary"
    }
    Response:
    {
    "status": "success"
    }

  3. GET /log/storage?type=secondary
    Response:
    {
    "used": 38797312,
    "free": 9878424780,
    "is_mounted": true,
    "is_disk_available": true,
    "total": 10522669875,
    "disk_name": "/dev/sdb"
    }

Tested the above API's through postman and verified the reponse. Also peri also tested from the UI side and it is working fine

Description From Last Updated

Can it be /storage?type=secondary?

pmurugaiyanpmurugaiyan

Can we remove the _view suffix from function names (maybe create a folder at the parent level called 'view' similar …

pmurugaiyanpmurugaiyan

Global variable

pmurugaiyanpmurugaiyan

This also can be a global variable as its a constant.

pmurugaiyanpmurugaiyan

these is exposing internal details of service layer.. can be wrapped in a service level exception.. Any thoughts?

prajeshprajesh

memory => additional disk space. Memory implies RAM.

prajeshprajesh
shuinvy
  1. Ship It!
  2. 
      
pmurugaiyan
  1. 
      
  2. Can it be /storage?type=secondary?

  3. Can we remove the _view suffix from function names (maybe create a folder at the parent level called 'view' similar to services, and we can simply call the function with actual names, and so does the file names.

  4. This also can be a global variable as its a constant.

  5. 
      
apoorva.sn
pmurugaiyan
  1. Ship It!
  2. 
      
prajesh
  1. 
      
  2. these is exposing internal details of service layer.. can be wrapped in a service level exception.. Any thoughts?

    1. excuse typo. this is exposing internal details..

    2. Introduced custom error class

  3. 
      
prajesh
  1. 
      
  2. memory => additional disk space. Memory implies RAM.

  3. 
      
apoorva.sn
prajesh
  1. Ship It!
  2. 
      
apoorva.sn
pmurugaiyan
  1. Ship It!
  2. 
      
apoorva.sn
Review request changed

Status: Closed (submitted)

Loading...