Add new API call to add/create a disk for a VM

REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "name" : "bsdguest",
   "action" : "adddisk",
   "size" : "10G"
}

WebSocket Request:
-------------------------------
{
   "args" : {
      "size" : "10G",
      "name" : "bsdguest",
      "action" : "adddisk"
   },
   "id" : "fooid",
   "namespace" : "sysadm",
   "name" : "iohyve"
}

Response:
-------------------------------
{
  "args": {
    "adddisk": {
      "bsdguest": {
        "size": "10G"
      }
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
This commit is contained in:
Kris Moore
2016-03-03 13:24:02 -05:00
parent f5fbb30ebb
commit 04ee45494f
3 changed files with 39 additions and 0 deletions

View File

@@ -581,6 +581,10 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmIohyveRequest(const QJsonVal
if(keys.contains("action")){
QString act = JsonValueToString(in_args.toObject().value("action"));
//qDebug() << " - iohyve action:" << act;
if(act=="adddisk"){
ok = true;
out->insert("adddisk", sysadm::Iohyve::addDisk(in_args.toObject()));
}
if(act=="create"){
ok = true;
out->insert("create", sysadm::Iohyve::createGuest(in_args.toObject()));