Add new API call to iohyve, which returns true/false

if iohyve has been setup on the box

REST Request:
-------------------------------
PUT /sysadm/iohyve
{
   "action" : "issetup"
}

WebSocket Request:
-------------------------------
{
   "id" : "fooid",
   "namespace" : "sysadm",
   "args" : {
      "action" : "issetup"
   },
   "name" : "iohyve"
}

Response:
-------------------------------
{
  "args": {
    "issetup": {
      "setup": "true"
    }
  },
  "id": "fooid",
  "name": "response",
  "namespace": "sysadm"
}
This commit is contained in:
Kris Moore
2016-02-09 12:46:41 -05:00
parent 30ffeccfd4
commit a36081c77e
3 changed files with 19 additions and 0 deletions

View File

@@ -506,6 +506,10 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmIohyveRequest(const QJsonVal
ok = true;
out->insert("fetchiso", sysadm::Iohyve::fetchISO(in_args.toObject()));
}
if(act=="issetup"){
ok = true;
out->insert("issetup", sysadm::Iohyve::isSetup());
}
if(act=="renameiso"){
ok = true;
out->insert("renameiso", sysadm::Iohyve::renameISO(in_args.toObject()));

View File

@@ -39,6 +39,20 @@ QJsonObject Iohyve::fetchISO(QJsonObject jsin) {
return retObject;
}
// Return if iohyve is setup on the box
QJsonObject Iohyve::isSetup() {
QJsonObject retObject;
// Check if iohyve is setup on this box
// We check the flags variable, enabling / disabling is done via service mgmt
QString ioflags = General::getConfFileValue("/etc/rc.conf", "iohyve_flags=", 1);
if ( ioflags.isEmpty() )
retObject.insert("setup", "false");
else
retObject.insert("setup", "true");
return retObject;
}
// List the VMs on the box
QJsonObject Iohyve::listVMs() {

View File

@@ -15,6 +15,7 @@ namespace sysadm{
class Iohyve{
public:
static QJsonObject fetchISO(QJsonObject);
static QJsonObject isSetup();
static QJsonObject listVMs();
static QJsonObject renameISO(QJsonObject);
static QJsonObject rmISO(QJsonObject);