Пример #1
0
function CLIENT_MOUNT_FOLDERS()
{
    $glfs = new gluster_client();
    $glfs->buildconf();
    foreach (glob("/etc/artica-cluster/glusterfs-client/*.vol") as $filename) {
        $path = $glfs->volToPath($filename);
        if ($path == null) {
            continue;
        }
        if (!$glfs->ismounted($path)) {
            if ($glfs->CheckPath($path)) {
                echo "Starting......: Gluster clients " . basename($filename) . " mount it\n";
                $glfs->mount($path, $filename);
                if ($glfs->ismounted($path)) {
                    NOTIFY_ALL_MASTERS("Success connect {$path}");
                } else {
                    NOTIFY_ALL_MASTERS("Unable to mount {$path}");
                }
            } else {
                NOTIFY_ALL_MASTERS("Unable to mount {$path}");
            }
        } else {
            echo "Starting......: Gluster clients " . basename($filename) . " already mounted\n";
        }
    }
}
Пример #2
0
function CLIENT_MOUNT_FOLDERS()
{
    $glfs = new gluster_client();
    $glfs->buildconf();
    foreach (glob("/etc/artica-cluster/glusterfs-client/*.vol") as $filename) {
        $path = $glfs->volToPath($filename);
        if ($path == null) {
            continue;
        }
        $basename = basename($filename);
        if (preg_match("#^([0-9]+)\\.#", $basename, $re)) {
            $volume = $re[1];
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "Found {$filename}: path={$path} ({$basename}), volume={$volume}\n";
        }
        unset($GLOBALS["GLUSTERS_EV"]);
        if (!$glfs->ismounted($path, $volume)) {
            if ($glfs->CheckPath($path)) {
                system_admin_events("mouting " . basename($filename), __FUNCTION__, __FILE__, __LINE__, "cluster");
                echo "Starting......: " . date("H:i:s") . " Gluster clients " . basename($filename) . " mount it\n";
                $glfs->mount($path, $filename);
                if ($glfs->ismounted($path)) {
                    NOTIFY_ALL_MASTERS("Success connect {$path}", __FUNCTION__, __FILE__, __LINE__);
                } else {
                    system_admin_events("Unable to mount {$path}", __FUNCTION__, __FILE__, __LINE__, "cluster");
                    NOTIFY_ALL_MASTERS("Unable to mount {$path}" . @implode("\n", $GLOBALS["GLUSTERS_EV"]), __FUNCTION__, __FILE__, __LINE__);
                }
            } else {
                system_admin_events("Unable to mount {$path}", __FUNCTION__, __FILE__, __LINE__, "cluster");
                NOTIFY_ALL_MASTERS("Unable to mount {$path}" . @implode("\n", $GLOBALS["GLUSTERS_EV"]), __FUNCTION__, __FILE__, __LINE__);
            }
        } else {
            echo "Starting......: " . date("H:i:s") . " Gluster clients " . basename($filename) . " already mounted\n";
        }
    }
}