mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 10:20:26 +00:00
Add a new API call to the iohyve subsystem: action="listisos"
This will list all the known ISO files which iohyve can use.
REST Request:
-------------------------------
PUT /sysadm/iohyve
{
"action" : "listisos"
}
WebSocket Request:
-------------------------------
{
"name" : "iohyve",
"namespace" : "sysadm",
"id" : "fooid",
"args" : {
"action" : "listisos"
}
}
Response:
-------------------------------
{
"args": {
"listisos": [
"TRUEOS10.2-RELEASE-08-19-2015-x64-netinstall.iso"
]
},
"id": "fooid",
"name": "response",
"namespace": "sysadm"
}
This commit is contained in:
@@ -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()));
|
||||
}
|
||||
|
||||
@@ -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<output.length(); i++){ //first line is headers
|
||||
if(output[i].isEmpty()){ continue; }
|
||||
arr.append(output[i]);
|
||||
}
|
||||
return arr;
|
||||
|
||||
}
|
||||
|
||||
// Rename an ISO file
|
||||
QJsonObject Iohyve::renameISO(QJsonObject jsin) {
|
||||
QJsonObject retObject;
|
||||
|
||||
@@ -20,6 +20,7 @@ public:
|
||||
static QJsonObject installGuest(QJsonObject);
|
||||
static QJsonObject isSetup();
|
||||
static QJsonObject listVMs();
|
||||
static QJsonArray listISOs();
|
||||
static QJsonObject renameISO(QJsonObject);
|
||||
static QJsonObject rmISO(QJsonObject);
|
||||
static QJsonObject setupIohyve(QJsonObject);
|
||||
|
||||
Reference in New Issue
Block a user