summaryrefslogtreecommitdiffstats
path: root/inc/trigger.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2014-05-26 22:49:54 +0200
committerSimon Rettberg2014-05-26 22:49:54 +0200
commita4f4147b6fe5f2a003a61cf8a8f7508c94130b31 (patch)
treede34472a2b9bd83909469affb884619b4858efc1 /inc/trigger.inc.php
parentWIP (diff)
downloadslx-admin-a4f4147b6fe5f2a003a61cf8a8f7508c94130b31.tar.gz
slx-admin-a4f4147b6fe5f2a003a61cf8a8f7508c94130b31.tar.xz
slx-admin-a4f4147b6fe5f2a003a61cf8a8f7508c94130b31.zip
WIP
Diffstat (limited to 'inc/trigger.inc.php')
-rw-r--r--inc/trigger.inc.php40
1 files changed, 39 insertions, 1 deletions
diff --git a/inc/trigger.inc.php b/inc/trigger.inc.php
index af12955f..102f7987 100644
--- a/inc/trigger.inc.php
+++ b/inc/trigger.inc.php
@@ -36,5 +36,43 @@ class Trigger
Property::setIPxeTaskId($task['id']);
return $task['id'];
}
+
+ public static function ldadp()
+ {
+ $res = Database::simpleQuery("SELECT moduleid, filepath FROM configtgz_module"
+ . " INNER JOIN configtgz_x_module USING (moduleid)"
+ . " INNER JOIN configtgz USING (configid)"
+ . " WHERE moduletype = 'AD_AUTH'");
+ // TODO: Multiconfig support
+ $id = array();
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ if (readlink('/srv/openslx/www/boot/default/config.tgz') === $row['filepath']) {
+ $id[] = (int)$row['moduleid'];
+ break;
+ }
+ }
+ $task = Taskmanager::submit('LdadpLauncher', array(
+ 'ids' => $id
+ ));
+ if (!isset($task['id']))
+ return false;
+ return $task['id'];
+ }
+
+ public static function mount()
+ {
+ $vmstore = Property::getVmStoreConfig();
+ if (!is_array($vmstore)) return;
+ $storetype = $vmstore['storetype'];
+ if ($storetype === 'nfs') $addr = $vmstore['nfsaddr'];
+ if ($storetype === 'cifs') $addr = $vmstore['nfsaddr'];
+ if ($storetype === 'internal') $addr = 'none';
+ $this->mountTask = Taskmanager::submit('MountVmStore', array(
+ 'address' => $addr,
+ 'type' => 'images',
+ 'username' => $vmstore['cifsuser'],
+ 'password' => $vmstore['cifspasswd']
+ ));
+ }
-} \ No newline at end of file
+}