From a4f4147b6fe5f2a003a61cf8a8f7508c94130b31 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 26 May 2014 22:49:54 +0200 Subject: WIP --- inc/trigger.inc.php | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'inc/trigger.inc.php') 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 +} -- cgit v1.2.3-55-g7522