Add new API call to create a new snapshot via Life-Preserver

REST Request:
-------------------------------
PUT /sysadm/lifepreserver
{
   "snap" : "mytestsnap",
   "dataset" : "tank",
   "comment" : "Testing",
   "action" : "createsnap"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "comment" : "Testing",
      "dataset" : "tank",
      "action" : "createsnap",
      "snap" : "mytestsnap"
   },
   "name" : "lifepreserver",
   "namespace" : "sysadm",
   "id" : "fooid"
}

Response:
-------------------------------
{
  "args": {
    "createsnap": {
      "comment": "Testing",
      "dataset": "tank",
      "snap": "mytestsnap"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
This commit is contained in:
Kris Moore
2016-04-21 10:36:44 -04:00
parent 5f53dd4a4e
commit 4f8b78c361
4 changed files with 56 additions and 2 deletions

View File

@@ -337,6 +337,10 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmLifePreserverRequest(const Q
ok = true;
out->insert("addreplication", sysadm::LifePreserver::addReplication(in_args.toObject()));
}
if(act=="createsnap"){
ok = true;
out->insert("createsnap", sysadm::LifePreserver::createSnapshot(in_args.toObject()));
}
if(act=="cronscrub"){
ok = true;
out->insert("cronscrub", sysadm::LifePreserver::scheduleScrub(in_args.toObject()));
@@ -787,4 +791,4 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmPkgRequest(const QJsonValue
}
return RestOutputStruct::OK;
}
}