Esempio n. 1
0
function gmirror_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
            $retval |= rc_exec_service("geom load mirror");
            $retval |= disks_raid_gmirror_configure($data);
            break;
        case UPDATENOTIFY_MODE_MODIFIED:
            $retval |= rc_exec_service("geom start mirror");
            break;
        case UPDATENOTIFY_MODE_DIRTY:
            $retval |= disks_raid_gmirror_delete($data);
            if (is_array($config['gmirror']['vdisk'])) {
                $index = array_search_ex($data, $config['gmirror']['vdisk'], "uuid");
                if (false !== $index) {
                    unset($config['gmirror']['vdisk'][$index]);
                    write_config();
                }
            }
            break;
    }
    return $retval;
}
    if (is_array($error_bucket)) {
        foreach ($error_bucket as $elem) {
            $input_errors[] =& $elem["error"];
        }
    }
    /* if this is an AJAX caller then handle via JSON */
    if (isAjax() && is_array($error_bucket)) {
        input_errors2Ajax(NULL, $error_bucket);
        exit;
    }
    if ($_POST['apply']) {
        $retval = 0;
        if (!file_exists($d_sysrebootreqd_path)) {
            config_lock();
            /* reload all components that create raid device */
            disks_raid_gmirror_configure();
            config_unlock();
            write_config();
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            if (file_exists($d_raidconfdirty_path)) {
                unlink($d_raidconfdirty_path);
            }
        }
    }
}
if ($_GET['act'] == "del") {
    if ($a_raid[$_GET['id']]) {
        $raidname = $a_raid[$_GET['id']]['name'];
        disks_raid_gmirror_delete($raidname);