diff --git a/src/server/WebBackend.cpp b/src/server/WebBackend.cpp index 60f0a39..348d494 100644 --- a/src/server/WebBackend.cpp +++ b/src/server/WebBackend.cpp @@ -584,42 +584,46 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmIohyveRequest(const QJsonVal ok = true; out->insert("create", sysadm::Iohyve::createGuest(in_args.toObject())); } - if(act=="listvms"){ + else if(act=="listvms"){ ok = true; out->insert("listvms", sysadm::Iohyve::listVMs()); } - if(act=="fetchiso"){ + else if(act=="listisos"){ + ok = true; + out->insert("listisos", sysadm::Iohyve::listISOs()); + } + else if(act=="fetchiso"){ ok = true; DProcess fetchproc; out->insert("fetchiso", sysadm::Iohyve::fetchISO(in_args.toObject(), &fetchproc)); connect(&fetchproc, SIGNAL(ProcessOutput(QString)), this, SLOT(slotIohyveFetchProcessOutput(QString)) ); connect(&fetchproc, SIGNAL(Finished(QString, int, QString)), this, SLOT(slotIohyveFetchDone(QString, int, QString)) ); } - if(act=="install"){ + else if(act=="install"){ ok = true; out->insert("install", sysadm::Iohyve::installGuest(in_args.toObject())); } - if(act=="issetup"){ + else if(act=="issetup"){ ok = true; out->insert("issetup", sysadm::Iohyve::isSetup()); } - if(act=="renameiso"){ + else if(act=="renameiso"){ ok = true; out->insert("renameiso", sysadm::Iohyve::renameISO(in_args.toObject())); } - if(act=="rmiso"){ + else if(act=="rmiso"){ ok = true; out->insert("rmiso", sysadm::Iohyve::rmISO(in_args.toObject())); } - if(act=="setup"){ + else if(act=="setup"){ ok = true; out->insert("setup", sysadm::Iohyve::setupIohyve(in_args.toObject())); } - if(act=="start"){ + else if(act=="start"){ ok = true; out->insert("start", sysadm::Iohyve::startGuest(in_args.toObject())); } - if(act=="stop"){ + else if(act=="stop"){ ok = true; out->insert("stop", sysadm::Iohyve::stopGuest(in_args.toObject())); } diff --git a/src/server/library/sysadm-iohyve.cpp b/src/server/library/sysadm-iohyve.cpp index 2e485cb..071b7d0 100644 --- a/src/server/library/sysadm-iohyve.cpp +++ b/src/server/library/sysadm-iohyve.cpp @@ -143,6 +143,18 @@ QJsonObject Iohyve::listVMs() { return retObject; } +// List the ISOs on the box +QJsonArray Iohyve::listISOs(){ + QJsonArray arr; + QStringList output = General::RunCommand("iohyve isolist").split("\n"); + for(int i=1; i