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, 'parentTask' => $parent, 'failOnParentFail' => false )); if (!isset($task['id'])) return false; return $task['id']; } /** * To be called if the server ip changes, as it's embedded in the AD module configs. * This will then recreate all AD tgz modules. */ public static function rebuildAdModules() { $res = Database::simpleQuery("SELECT moduleid, filepath, content FROM configtgz_module" . " WHERE moduletype = 'AD_AUTH'"); if ($res->rowCount() === 0) return; $task = Taskmanager::submit('LdadpLauncher', array('ids' => array())); // Stop all running instances $parent = isset($task['id']) ? $task['id'] : NULL; while ($row = $res->fetch(PDO::FETCH_ASSOC)) { $config = json_decode($row['contents']); $config['proxyip'] = Property::getServerIp(); $config['moduleid'] = $row['moduleid']; $config['filename'] = $row['filepath']; $config['parentTask'] = $parent; $config['failOnParentFail'] = false; $task = Taskmanager::submit('CreateAdConfig', $config); $parent = isset($task['id']) ? $task['id'] : NULL; } } /** * Mount the VM store into the server. * * @return array task status of mount procedure, or false on error */ public static function mount() { $vmstore = Property::getVmStoreConfig(); if (!is_array($vmstore)) return false; $storetype = $vmstore['storetype']; if ($storetype === 'nfs') $addr = $vmstore['nfsaddr']; if ($storetype === 'cifs') $addr = $vmstore['cifsaddr']; if ($storetype === 'internal') $addr = 'null'; return Taskmanager::submit('MountVmStore', array( 'address' => $addr, 'type' => 'images', 'username' => $vmstore['cifsuser'], 'password' => $vmstore['cifspasswd'] )); } }