Пример #1
0
function lvm_lvcreate_save()
{
    $sock = new sockets();
    $tpl = new templates();
    $_GET["LVMS_NAME"] = trim(strtolower($_GET["LVMS_NAME"]));
    $_GET["LVMS_NAME"] = str_replace(" ", "-", $_GET["LVMS_NAME"]);
    $_GET["LVMS_NAME"] = str_replace("-", "_", $_GET["LVMS_NAME"]);
    $data = $sock->getfile("lvcreate:{$_GET["LV_GROUP"]};{$_GET["LVMS_NAME"]};{$_GET["LVMS_SIZE"]}");
    $datas = explode("\n", $data);
    $ou = $_GET["affectToThisOu"];
    if ($ou != null) {
        $dev = "/dev/{$_GET["LV_GROUP"]}/{$_GET["LVMS_NAME"]}";
        writelogs("Create dev: {$dev}", __FUNCTION__, __FILE__, __LINE__);
        $lvm = new lvm_org($ou);
        writelogs("affect dev: {$dev} -> {$ou}", __FUNCTION__, __FILE__, __LINE__);
        $lvm->AffectDev($dev);
        $mount_point = "/media/{$ou}/{$_GET["LVMS_NAME"]}";
        writelogs("mount point {$mount_point}", __FUNCTION__, __FILE__, __LINE__);
        $datas[] = "{$dev} will be formated";
        writelogs("format", __FUNCTION__, __FILE__, __LINE__);
        $sock->getFrameWork("cmd.php?format-disk-unix={$dev}");
        $datas[] = "{$dev} will be mounted to {$mount_point}";
        writelogs("-> fstab", __FUNCTION__, __FILE__, __LINE__);
        $dev_encode = urlencode($dev);
        $mount_point_encode = urlencode($mount_point);
        $sock->getFrameWork("hd.php?fstab-add=yes&dev={$dev_encode}&mount={$mount_point_encode}");
    }
    if (!is_array($datas)) {
        return null;
    }
    while (list($num, $val) = each($datas)) {
        if ($val == null) {
            continue;
        }
        echo html_entity_decode(trim($tpl->_ENGINE_parse_body($val))) . "\n";
    }
    $sock->getFrameWork("cmd.php?usb-scan-write=yes");
}
Пример #2
0
function SaveDevHD()
{
    $lvm = new lvm_org($_GET["ou"]);
    $lvm->SaveEnabledStorage($_GET["devHD"]);
}
Пример #3
0
function dev_del()
{
    $dev = $_GET["dev-del"];
    $lvm = new lvm_org($_GET["ou"]);
    $lvm->DeAffectDev($dev);
}
Пример #4
0
function affectvg_save()
{
    $dev = $_GET["affectVGdev"];
    $ou = $_GET["ou"];
    $lvm = new lvm_org($ou);
    $lvm->AffectDev($dev);
}