_("Your account"))); dual_begin(array()); print("

" . _("Home") . " / " . _("Your account") . "

\n"); print("

" . _("You have not authenticated yourself to the system yet with your") . " " . _("username") . " " . _("and") . " " . _("password") . ". " . _("You will not be able to use this section of the website without authenticating yourself first. So, please continue and login using the form on the right hand side.") . "

\n"); dual_middle(array()); show_account_details(array()); dual_end(array()); generic_footer(array()); exit; } $volumes_id = array(); $volumes_name = array(); $volumes_mountpoint = array(); $volumes_vg = array(); $volumes_fstype = array(); function volumes_startelement($parser, $name, $attrs) { global $volumes_id, $volumes_name, $volumes_mountpoint, $volumes_vg, $volumes_fstype; if ($name == "VOLUME") { array_push($volumes_id, $attrs["ID"]); array_push($volumes_name, $attrs["NAME"]); array_push($volumes_mountpoint, $attrs["MOUNTPOINT"]); array_push($volumes_vg, $attrs["VG"]); array_push($volumes_fstype, $attrs["FSTYPE"]); } } function volumes_endelement($parser, $name) { } $volumes_parser = xml_parser_create(); xml_set_element_handler($volumes_parser, "volumes_startelement", "volumes_endelement"); $volumes_fp = fopen("/opt/openfiler/etc/volumes.xml", "r"); while ($volumes_data = fread($volumes_fp, 4096)) xml_parse($volumes_parser, $volumes_data, feof($volumes_fp)); fclose($volumes_fp); xml_parser_free($volumes_parser); $snapshots_id = array(); $snapshots_lvname = array(); $snapshots_vgname = array(); $snapshots_shared = array(); $snapshots_rotateid = array(); $schedule_size = array(); $schedule_share = array(); $schedule_timecounter = array(); $schedule_timemax = array(); $schedule_rotatecounter = array(); $schedule_rotatemax = array(); $schedule_lvname = array(); $schedule_vgname = array(); function snapshots_startelement($parser, $name, $attrs) { global $snapshots_id, $snapshots_lvname, $snapshots_vgname, $snapshots_shared, $snapshots_rotateid; global $schedule_size, $schedule_share; global $schedule_timecounter, $schedule_timemax; global $schedule_rotatecounter, $schedule_rotatemax; global $schedule_lvname, $schedule_vgname; if ($name == "SNAPSHOT") { array_push($snapshots_id, $attrs["ID"]); array_push($snapshots_lvname, $attrs["LVNAME"]); array_push($snapshots_vgname, $attrs["VGNAME"]); array_push($snapshots_shared, $attrs["SHARED"]); array_push($snapshots_rotateid, $attrs["ROTATEID"]); } else if ($name == "SCHEDULE") { array_push($schedule_size, $attrs["SIZE"]); array_push($schedule_share, $attrs["SHARE"]); array_push($schedule_timecounter, $attrs["TIMECOUNTER"]); array_push($schedule_timemax, $attrs["TIMEMAX"]); array_push($schedule_rotatecounter, $attrs["ROTATECOUNTER"]); array_push($schedule_rotatemax, $attrs["ROTATEMAX"]); array_push($schedule_lvname, $attrs["LVNAME"]); array_push($schedule_vgname, $attrs["VGNAME"]); } } function snapshots_endelement($parser, $name) { } $snapshots_parser = xml_parser_create(); xml_set_element_handler($snapshots_parser, "snapshots_startelement", "snapshots_endelement"); $snapshots_fp = fopen("/opt/openfiler/etc/snapshots.xml", "r"); while ($snapshots_data = fread($snapshots_fp, 4096)) xml_parse($snapshots_parser, $snapshots_data, feof($snapshots_fp)); fclose($snapshots_fp); xml_parser_free($snapshots_parser); global $cluster_enabled, $cluster_nodename, $cluster_resource; $cluster_enabled = false; $cluster_nodename = ""; $cluster_resource = array(); function cluster_startelement($parser, $name, $attrs) { global $cluster_enabled, $cluster_nodename, $cluster_resource; if ($name == "CLUSTERING") { if ($attrs["STATE"] == "on") $cluster_enabled = true; else $cluster_enabled = false; } else if ($name == "NODENAME") $cluster_nodename = $attrs["VALUE"]; else if ($name == "RESOURCE") array_push($cluster_resource, $attrs["VALUE"]); } function cluster_endelement($parser, $name) { } $cluster_parser = xml_parser_create(); xml_set_element_handler($cluster_parser, "cluster_startelement", "cluster_endelement"); $cluster_fp = fopen("/opt/openfiler/etc/cluster.xml", "r"); while ($cluster_data = fread($cluster_fp, 4096)) xml_parse($cluster_parser, $cluster_data, feof($cluster_fp)); fclose($cluster_fp); xml_parser_free($cluster_parser); if ($HTTP_POST_VARS["action"] == "Create") { if ((!is_valid_foldername($volumename)) || (substr($volumename, 0, 12) == "of.snapshot.")) { header("Location: ./volumes.html"); exit; } if (strlen($HTTP_POST_VARS["volumedescription"]) <= 0) $volumedescription = $volumename; /* Custom mount paths are disabled for now $mountpath = trim($mountpath); if (substr($mountpath, strlen($mountpath) - 1, 1) == "/") $mountpath = substr($mountpath, 0, strlen($mountpath) - 1); */ $volumename = strtolower($volumename); $mountpath = "/mnt/" . $vgname . "/" . $volumename; $exists = 0; for ($i = 0; $i < count($volumes_id); $i++) if (($volumes_id[$i] == $volumename) && ($volumes_vg[$i] == $vgname)) { $exists = 1; break; } if (($exists == 0) && (!is_dir($mountpath)) && (!is_file($mountpath))) { exec("/usr/bin/sudo " . $GLOBALS["lvm_command_prefix"] . "lvcreate -L " . escapeshellarg($reqspace) . " -n " . escapeshellarg($volumename) . " " . escapeshellarg($vgname)); $lvp = popen("/usr/bin/sudo " . $GLOBALS["lvm_command_prefix"] . "lvdisplay -c /dev/" . escapeshellarg($vgname) . "/" . escapeshellarg($volumename), "r"); $i = 0; while (!feof($lvp)) $lvds[$i++] = fgets($lvp, 4096); pclose($lvp); $lvinfo = explode(":", trim($lvds[0], " ")); if ($lvinfo[0] == ("/dev/" . $vgname . "/" . $volumename)) { $fs = 0; $fsfound = false; for ($fsi = 0; $fsi < count($fs_info); $fsi++) { if ($fs_info[$fsi]["type"] == $fstype) { $fs = $fsi; $fsfound = true; break; } } if ($fsfound == false) $fs = 0; exec("/usr/bin/sudo " . $fs_info[$fs]["mkfs_command"] . " /dev/" . escapeshellarg($vgname) . "/" . escapeshellarg($volumename)); array_push($volumes_id, $volumename); array_push($volumes_name, urldecode($volumedescription)); array_push($volumes_mountpoint, $mountpath . "/"); array_push($volumes_vg, $vgname); array_push($volumes_fstype, $fs_info[$fs]["type"]); $volumesp = popen("/usr/bin/sudo /usr/bin/tee /opt/openfiler/etc/volumes.xml", "w"); fputs($volumesp, "\n"); fputs($volumesp, "\n"); for ($i = 0; $i < count($volumes_id); $i++) fputs($volumesp, "\t\n"); fputs($volumesp, "\n\n"); pclose($volumesp); exec("/usr/bin/sudo /bin/mkdir -p " . escapeshellarg($mountpath)); if (!$cluster_enabled) { $fstabp = popen("/usr/bin/sudo /usr/bin/tee -a /etc/fstab", "w"); fputs($fstabp, "/dev/" . $vgname . "/" . $volumename . " " . $mountpath . " " . $fs_info[$fs]["type"] . " " . $fs_info[$fs]["mount_options"] . " 0 0\n"); pclose($fstabp); } else { $service_winbind = (strstr(exec("/usr/bin/sudo /sbin/service winbind status"), "running") ? 1 : 0); $service_smb = (strstr(exec("/usr/bin/sudo /sbin/service smb status"), "running") ? 1 : 0); $service_nfsv3 = (strstr(exec("/usr/bin/sudo /sbin/service nfs status"), "running") ? 1 : 0); $service_http = (strstr(exec("/usr/bin/sudo /sbin/service httpd status"), "running") ? 1 : 0); $clusterp = popen("/usr/bin/sudo /usr/bin/tee /etc/ha.d/haresources", "w"); $cluster_resource_str = ""; for ($i = 0; $i < count($cluster_resource); $i++) $cluster_resource_str .= " " . $cluster_resource[$i]; for ($i = 0; $i < count($volumes_id); $i++) { $fstype = $volumes_fstype[$fsj]; $fs = 0; $fsfound = false; for ($fsi = 0; $fsi < count($fs_info); $fsi++) { if ($fs_info[$fsi]["type"] == $fstype) { $fs = $fsi; $fsfound = true; break; } } if ($fsfound == false) $fs = 0; $cluster_resource_str .= " Filesystem::/dev/" . $volumes_vg[$i] . "/" . $volumes_id[$i] . "::" . "/mnt/" . $volumes_vg[$i] . "/" . $volumes_id[$i] . "::" . $fs_info[$fs]["type"] . "::" . $fs_info[$fs]["mount_options"]; } for ($i = 0; $i < count($snapshots_id); $i++) { $fstype = ""; for ($fsj = 0; $fsj < count($volumes_id); $fsj++) { if (($snapshots_vgname[$i] == $volumes_vg[$fsj]) && ($snapshots_lvname[$i] == $volumes_id[$fsj])) { $fstype = $volumes_fstype[$fsj]; break; } } $fs = 0; $fsfound = false; for ($fsi = 0; $fsi < count($fs_info); $fsi++) { if ($fs_info[$fsi]["type"] == $fstype) { $fs = $fsi; $fsfound = true; break; } } if ($fsfound == false) $fs = 0; $cluster_resource_str .= " Filesystem::/dev/" . $snapshots_vgname[$i] . "/of.snapshot." . $snapshots_lvname[$i] . "." . $snapshots_id[$i] . "::" . "/mnt/snapshots/" . $snapshots_vgname[$i] . "/" . $snapshots_lvname[$i] . "/" . $snapshots_id[$i] . "::" . $fs_info[$fs]["type"] . "::" . $fs_info[$fs]["snapshot_mount_options"]; } if ($service_winbind > 0) $cluster_resource_str .= " winbind"; if ($service_http > 0) $cluster_resource_str .= " httpd"; if ($service_nfsv3 > 0) $cluster_resource_str .= " nfs"; if ($service_smb > 0) $cluster_resource_str .= " smb"; $cluster_resource_str .= " openfiler"; fputs($clusterp, $cluster_nodename . $cluster_resource_str . "\n"); pclose($clusterp); } exec("/usr/bin/sudo /bin/mount -t " . $fs_info[$fs]["type"] . " -o " . $fs_info[$fs]["mount_options"] . " /dev/" . $vgname . "/" . $volumename . " " . escapeshellarg($mountpath)); exec("/usr/bin/sudo /bin/touch " . escapeshellarg($mountpath) . "/aquota.group " . escapeshellarg($mountpath) . "/aquota.user"); exec("/usr/bin/sudo /bin/chown root:root " . escapeshellarg($mountpath) . "/aquota.group " . escapeshellarg($mountpath) . "/aquota.user"); exec("/usr/bin/sudo /bin/chmod 600 " . escapeshellarg($mountpath) . "/aquota.group " . escapeshellarg($mountpath) . "/aquota.user"); exec("/usr/bin/sudo /sbin/quotacheck -ug " . escapeshellarg($mountpath)); exec("/usr/bin/sudo /bin/umount " . escapeshellarg($mountpath)); exec("/usr/bin/sudo /bin/mount -t " . $fs_info[$fs]["type"] . " -o " . $fs_info[$fs]["mount_options"] . " /dev/" . $vgname . "/" . $volumename . " " . escapeshellarg($mountpath)); exec("/usr/bin/sudo /sbin/quotaon -ug " . escapeshellarg($mountpath)); exec("/usr/bin/sudo /bin/mkdir " . escapeshellarg($mountpath . "/homes/")); exec("/usr/bin/sudo /bin/chmod 777 " . escapeshellarg($mountpath . "/homes/")); } } apply_configuration(array("services" => "reload", "chmod" => "no", "chmod_path" => "")); header("Location: ./volumes.html"); exit; } generic_header(array("title" => _("Administration Section"))); single_begin(array()); print("

" . _("Home") . " / " . _("Administration Section") . "

\n"); ?>

Welcome Administrator. The following are various system information and preferences, arranged into tabs. Please click on a tab to open up that category.

0) printf("
\n"); print("

Block storage statistics for volume group \"" . htmlentities($vginfo[0]) . "\"

\n"); print("
\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\n"); print("
Total SpaceUsed SpaceFree Space
" . $vginfo[11] . " bytes (" . ($vginfo[11] / 1024) . " MB)" . ($vginfo[14] * ($vginfo[12]) / 2) . " bytes (" . (($vginfo[14] * ($vginfo[12])) / (1024 * 2)) . " MB)" . ($vginfo[15] * ($vginfo[12]) / 2) . " bytes (" . (($vginfo[15] * ($vginfo[12])) / (1024 * 2)) . " MB)
\n"); print("
\n"); print("

 

\n"); print("

Create a volume in \"" . htmlentities($vginfo[0]) . "\"

\n"); print("
\n"); print("\n"); print("
\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\n"); /* Custom mount paths are disabled for now print("\n"); print("\t\n"); print("\t\n"); print("\n"); */ print("\n"); print("\t\n"); print("\n"); print("
Volume Name (must be specified like a UNIX filename without its path)
Volume Description
Required Space (MB)
Filesystem type\n"); print("\n"); print("
Mount Path
\n"); print("
\n"); print("
\n"); print("

 

\n"); } nested_tab_end(); single_end(array()); generic_footer(array()); ?>