Add new API call for creating a replication task in Life-Preserver

host = <Remote hostname/ip>
port = <SSH port>
password = <Your SSH password>
dataset = <Local Dataset to replicate>
remotedataset = <Target location for remote dataset>
frequency = <time> XX/sync/hour/30min/10min/manual
            XX= Time to perform replication (in 24 hour notation)
          sync= Do replication with snaps (Not recommended for frequent snaps)
          hour= Replicate hourly
         30min= Replicate every 30 minutes
         10min= Replicate every 10 minutes
        manual= Only replicate when requested by user

REST Request:
-------------------------------
PUT /sysadm/lifepreserver
{
   "action" : "addreplication",
   "password" : "mypass",
   "dataset" : "tank1",
   "remotedataset" : "tank/backups",
   "user" : "backupuser",
   "frequency" : "22",
   "port" : "22",
   "host" : "192.168.0.10"
}

REST Response:
-------------------------------
{
    "args": {
        "addreplication": {
            "frequency": "22",
            "host": "192.168.0.10",
            "ldataset": "tank1",
            "port": "22",
            "rdataset": "tank/backups",
            "user": "backupuser"
        }
    }
}

WebSocket Request:
-------------------------------
{
   "namespace" : "sysadm",
   "name" : "lifepreserver",
   "args" : {
      "action" : "addreplication",
      "user" : "backupuser",
      "dataset" : "tank1",
      "frequency" : "22",
      "port" : "22",
      "password" : "mypass",
      "host" : "192.168.0.10",
      "remotedataset" : "tank/backups"
   },
   "id" : "fooid"
}

WebSocket Response:
-------------------------------
{
  "args": {
    "addreplication": {
      "frequency": "22",
      "host": "192.168.0.10",
      "ldataset": "tank1",
      "port": "22",
      "rdataset": "tank/backups",
      "user": "backupuser"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
This commit is contained in:
Kris Moore
2016-01-12 16:53:46 -05:00
parent 5d834fabbd
commit 5bb6fb7d33
3 changed files with 74 additions and 1 deletions

View File

@@ -141,6 +141,10 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmLifePreserverRequest(const Q
bool ok = false;
if(keys.contains("action")){
QString act = JsonValueToString(in_args.toObject().value("action"));
if(act=="addreplication"){
ok = true;
out->insert("addreplication", sysadm::LifePreserver::addReplication(in_args.toObject()));
}
if(act=="cronscrub"){
ok = true;
out->insert("cronscrub", sysadm::LifePreserver::scheduleScrub(in_args.toObject()));