Пример #1
0
     }
     if ($retry <= 0) {
         write_log("error: still hasted primary exists!");
     }
     // up and set backup all carp
     if ($preempt == 0 || isset($a_carp[0]) && $a_carp[0]['advskew'] > 1) {
         foreach ($a_carp as $carp) {
             //system("/sbin/ifconfig {$carp['if']} up vhid {$carp['vhid']} state backup");
         }
     }
     header("Location: services_hast.php");
     exit;
 }
 if (isset($_POST['switch_master']) && $_POST['switch_master']) {
     // up and set master all carp
     $role = get_hast_role();
     foreach ($a_carp as $carp) {
         $state = @exec("/sbin/ifconfig {$carp['if']} | grep  'carp:' | awk '{ print tolower(\$2) }'");
         if ($carp['advskew'] <= 1) {
             system("/sbin/ifconfig {$carp['if']} up vhid {$carp['vhid']} state master advskew {$carp['advskew']}");
         } else {
             system("/sbin/ifconfig {$carp['if']} up vhid {$carp['vhid']} state master");
         }
         // if already master, use linkup action
         if ($state == "master" && $role != "primary") {
             $action = $carp['linkup'];
             $result = mwexec($action);
         }
     }
     // waits for the secondary disk to disappear
     $retry = 60;
Пример #2
0
require "guiconfig.inc";
$pgtitle = array(gettext("Services"), gettext("iSCSI Target"), gettext("Initiator Group"));
if ($_POST) {
    $pconfig = $_POST;
    if (isset($_POST['apply']) && $_POST['apply']) {
        write_config();
        $retval = 0;
        if (!file_exists($d_sysrebootreqd_path)) {
            $retval |= updatenotify_process("iscsitarget_ig", "iscsitargetig_process_updatenotification");
            config_lock();
            $retval |= rc_update_reload_service("iscsi_target");
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            if (get_hast_role() != 'secondary') {
                $savemsg .= "<br>";
                $savemsg .= sprintf(gettext("The reloading request has been sent to the daemon. You can see the result by <a href=\"%s\">Log</a>."), "diag_log.php?log=2");
            }
            updatenotify_delete("iscsitarget_ig");
        }
    }
}
if (!isset($config['iscsitarget']['initiatorgroup']) || !is_array($config['iscsitarget']['initiatorgroup'])) {
    $config['iscsitarget']['initiatorgroup'] = array();
}
array_sort_key($config['iscsitarget']['initiatorgroup'], "tag");
$a_iscsitarget_ig =& $config['iscsitarget']['initiatorgroup'];
if (!isset($config['iscsitarget']['target']) || !is_array($config['iscsitarget']['target'])) {
    $config['iscsitarget']['target'] = array();
}
Пример #3
0
function sendSuccessReport()
{
    $xml = simplexml_load_file('/conf/config.xml');
    $name = $xml->xpath('/opennas/system/hostname');
    email_send(getMailTo(), "Plus d'erreur détectées sur OpenNAS", "Aucune erreur n'a été détectée sur l'OpenNAS \"" . $name['0'] . "\" ( " . get_hast_role() . " ).", $outError);
    return !$outError;
}