System update management

Overview

Allows you to manage system updates. Backup of the system at update is implemented, system rollback in automatic mode is not foreseen.

Requests

HTTP verb Endpoint Description

POST

/api/admin/v1/update/upload

Downloading the update

POST

/api/admin/v1/update/copyfrom

Copying an update file from disk

GET

/api/admin/v1/update/get_upstate

Obtaining the update status

POST

/api/admin/v1/update/prepare

Start preparing for the upgrade

POST

/api/admin/v1/update/apply

Application of the update

GET

/api/admin/v1/update/read

Getting the list of update files

POST

/api/admin/v1/update/delete

Deleting an update file

POST

/api/admin/v1/update/cancel

Canceling an update

Downloading the update

Request

Request example
POST /api/admin/v1/update/upload HTTP/1.1
Content-Type: multipart/form-data; boundary=-----------boundary_69df8120352a996e

-----------boundary_69df8120352a996e
Content-Type: application/octet-stream
Content-Disposition: form-data; name="filename"; filename="fw_update_incoplax_amd64.zip"
Content-Transfer-Encoding: binary

BINARY BODY OF 'fw_update_incoplax_amd64.zip'
-----------boundary_69df8120352a996e--

Response

Response example
HTTP/1.1 200 OK

{
    "resultcode": 0,
    "resultmsg": "OK",
    "data": {
            "mc": "mic@192.168.0.35",
            "filename": "fw_update_incoplax_amd64.zip",
            "uploaded": true
            }
}

Copying an update file from disk

The method allows you to copy the update file from the specified path to the updates folder on the active folder mc.

Request

Table 1. Request parameters
Name Type Description

filepath

str

The full path to the update file to copy (in the following format url-encoded).

Request example
POST /api/admin/v1/update/copyfrom HTTP/1.1
Content-Type: application/x-www-form-urlencoded

filepath=%2Fhome%2Fadmin%2Fera_update%fw_update_incoplax_amd64.zip

Response

Response example
HTTP/1.1 200 OK

{
  "resultcode": 0,
  "resultmsg": "OK",
  "data": {
    "mic": "mic@192.168.0.35",
    "src_path": "/home/admin/era_update/fw_update_ubuntu_1_2_283_amd64.zip",
    "dst_path": "/var/lib/era/workdir/mc@192.168.0.35/AutoUpdate/fw_updateincoplax_amd64.zip",
    "result": "ok"
  }
}

Obtaining the update status

The method returns the current state of update application by servers and sites.

Request

Request example
GET /api/admin/v1/update/get_upstate HTTP/1.1

Response

Response example
HTTP/1.1 200 OK

{
  "resultcode": 0,
  "resultmsg": "OK",
  "data": {
    "slave2": {
      "ic": {
        "node": "ic21@192.168.0.126",
        "state": "idle",
        "current_vsn": "1.4.0"
      },
      "servers": {
        "server3@192.168.0.126": {
          "state": "idle",
          "product": "incoplax",
          "product_vsn": "2018.4.29-nightly"
        },
        "server4@192.168.0.127": {
          "state": "idle",
          "product": "incoplax",
          "product_vsn": "2018.4.29-nightly"
        }
      }
    },
    "central": {
      "mic": {
        "node": "mic@192.168.0.123",
        "state": "idle",
        "upfilename": "undefined"
      },
      "ic": {
        "node": "ic1@192.168.0.123",
        "state": "idle",
        "current_vsn": "1.4.0"
      },
      "servers": {
        "server2@192.168.0.124": {
          "state": "idle",
          "product": "incoplax",
          "product_vsn": "2021.4.29-nightly"
        },
        "server1@192.168.0.123": {
          "state": "idle",
          "product": "incoplax",
          "product_vsn": "2021.4.29-nightly"
        }
      }
    }
  }
}
Table 2. Possible conditions
Name Description

States MC

init

the update service is initialized.

idle

idle state, the system does not apply an update.

download

update is downloaded via ws or by copying from disk.

prepare

preparations are made for the upgrade.

ready

preparation is successfully completed, the MC is ready to provide the update file to all SCs. The undo and apply update command is available.

apply

the command to apply the update is received and forwarded to all SC.

cancel

the command to cancel the update has been received, the transition to the idle.

locked

server is blocked, because MC of newer version was found.

By site (role states SC)

init

the update service is initialized.

idle

idle state, the system does not apply an update.

prepare

update preparations are underway.

download

preparation was unsuccessful, the download of the update file from the MC.

ready

preparation was successful, the SC is ready to provide the update file to all SrvCs. The undo and apply update command is available.

apply

the command to apply the update is received and forwarded to all SrvC.

By servers (status SrvC)

init

the update service is initialized.

idle

idle state, the system does not apply an update.

prepare

update preparations are underway.

download

preparation was unsuccessful, the download of the update file from the SC.

ready

preparation was successful. The undo and apply update command is available.

apply

update application command received, update process started.

Start preparing for the upgrade

Starts update preparation with the specified update file. Runs asynchronously. The current state of preparation is displayed in get_upstate.

Request

Table 3. Request parameters
Name Type Description

filename

str

name of the update file (*.zip) that will be used for the update.

Request example
POST /api/admin/v1/update/prepare HTTP/1.1
Content-Type: application/x-www-form-urlencoded

filename=fw_update_incoplax_amd64.zip

Response

Response example
HTTP/1.1 200 OK

{
  "resultcode": 0,
  "resultmsg": "OK",
  "data": {
    "mc": "mic@192.168.0.35",
    "result": "preparation_is_started"
  }
}

Application of the update

Applies a distributed update to the system servers. Copying with possible replacement or deletion of the new distribution files, followed by a reboot of each server.

Request

Request example
POST /api/admin/v1/update/apply HTTP/1.1

Response

Response example
HTTP/1.1 200 OK

{
  "resultcode": 0,
  "resultmsg": "OK",
  "data": {
    "mc": "mic@192.168.0.35",
    "result": "upgrade_started"
  }
}

Getting the list of update files

Displays update files (and unpacked directories) by site and server.

Request

Request example
GET /api/admin/v1/update/read HTTP/1.1

Response

Response example
HTTP/1.1 200 OK

{
  "resultcode": 0,
  "resultmsg": "OK",
  "data": {
    "central": [
      {
        "dirs": ["fw_update_incoplax_amd64"],
        "files": ["fw_update_incoplax_amd64.zip"],
        "node": "mic@192.168.0.127",
        "result": "ok"
      },
      {
        "dirs": ["fw_update_incoplax_amd64"],
        "files": ["fw_update_incoplax_amd64.zip"],
        "node": "ic1@192.168.0.127",
        "result": "ok"
      },
      {
        "dirs": ["fw_update_incoplax_amd64"],
        "files": ["fw_update_incoplax_amd64.zip"],
        "node": "server1@192.168.0.127",
        "result": "ok"
      }
    ],
    "slave2": [
      {
        "dirs": ["fw_update_incoplax_amd64"],
        "files": ["fw_update_incoplax_amd64.zip"],
        "node": "ic21@192.168.0.124",
        "result": "ok"
      },
      {
        "dirs": ["fw_update_incoplax_amd64"],
        "files": ["fw_update_incoplax_amd64.zip"],
        "node": "server3@192.168.0.124",
        "result": "ok"
      }
    ]
  }
}

Deleting an update file

Allows you to remove the update file (and unpacked directories) from all servers on the system

Request

Table 4. Request parameters
Name Type Description

filename

str

name of the update file to be deleted (without extension).

Request example
POST /api/admin/v1/update/delete HTTP/1.1
Content-Type: application/x-www-form-urlencoded

filename=fw_update_1.2.244

Response

Response example
HTTP/1.1 200 OK

{
    "resultcode": 0,
    "resultmsg": "OK",
    "data": {
            "description": "delete_files_started",
            "node": "mic@192.168.0.127",
            "result": "ok"
            }
}

Canceling an update

Allows you to cancel the update. Execution is only possible after the prepare command. After applying the apply command, execution is not possible.

Request

Request example
POST /api/admin/v1/update/cancel HTTP/1.1

Response

Response example
HTTP/1.1 200 OK

{
  "resultcode": 0,
  "resultmsg": "OK",
  "data": {
    "mc": "mic@192.168.0.127",
    "result": "cancel_started"
  }
}