function regenerate_all_configs() { global $db; while ($cfg = $db->find("config", NULL, "name")) { $params = array("name" => $cfg["name"], "config" => $cfg["config"]); add_transaction_clusterwide($_SESSION["member"]["m_id"], 0, T_CLUSTER_CONFIG_CREATE, $params, array('node')); } }
function update_custom_config($cfg, $dep = NULL) { global $db; $db->query("UPDATE vps SET vps_config = '" . $db->check($cfg) . "' WHERE vps_id = '" . $db->check($this->veid) . "'"); add_transaction_clusterwide($_SESSION["member"]["m_id"], $this->veid, T_CLUSTER_CONFIG_CREATE, array("name" => "vps-" . $this->veid, "config" => $cfg), array('node')); $this->applyconfigs($dep); }
/** * Install Cluster storage, assumes FUSE & GlusterFS v2 is already installed * If not in CRON_MODE, add transaction to do it * @return true if success, false on fail */ function install_cluster_storage_software() { global $db; if (CRON_MODE) { $this->execute("mkdir -p {$this->s["server_path_vz"]}/cluster_storage"); $this->execute("mkdir -p {$this->s["server_path_vz"]}/cluster_mount"); $this->execute("mkdir -p /etc/glusterfs/"); $server_config = ' volume posix type storage/posix option directory ' . $this->s["server_path_vz"] . '/cluster_storage end-volume volume locks type features/locks subvolumes posix end-volume volume brick type performance/io-threads option thread-count 8 subvolumes locks end-volume volume server type protocol/server option transport-type tcp option auth.addr.brick.allow * subvolumes brick end-volume '; $this->write_file('/etc/glusterfs/glusterfs-server.vol', $server_config); $sql = 'UPDATE servers SET server_cluster_storage_sw_installed=1 WHERE server_id=' . $db->check($this->s["server_id"]); $db->query($sql); $this->s["server_cluster_storage_sw_installed"] = 1; add_transaction_clusterwide(0, 0, T_CLUSTER_STORAGE_CFG_RELOAD); return true; } else { add_transaction($_SESSION["member"]["m_id"], $this->s["server_id"], 0, T_CLUSTER_STORAGE_SOFTWARE_INSTALL); return true; } }