_("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); $disksp = popen("/usr/bin/sudo /opt/openfiler/sbin/list-disks.pl", "r"); $i = 0; while (!feof($disksp)) { $dstr = trim(fgets($disksp, 4096)); // $dresult[$i++] = substr($dstr, 0, strlen($dstr) - 1); $dresult[$i++] = $dstr; } pclose($disksp); $of_disks = array(); if ($dresult[0] == "OPENFILER") { $i = 1; while ($i < count($dresult)) { if ($dresult[$i] == "DISK") { $p = $i; $i = $i + 8; $parts = array(); while (($dresult[$i] == "PARTITION") && ($i < count($dresult))) { array_push($parts, array("device" => $dresult[$i + 1], "type" => $dresult[$i + 2], "number" => $dresult[$i + 3], "start" => $dresult[$i + 4], "end" => $dresult[$i + 5], "blocks" => $dresult[$i + 6], "extended" => $dresult[$i + 7])); $i = $i + 8; } array_push($of_disks, array("device" => $dresult[$p + 1], "type" => $dresult[$p + 2], "description" => $dresult[$p + 3], "blocksize" => ($dresult[$p + 4] * 2), "cylinders" => $dresult[$p + 5], "heads" => $dresult[$p + 6], "sectors" => $dresult[$p + 7], "partitions" => $parts)); } else break; } } $vgp = popen("/usr/bin/sudo " . $GLOBALS["lvm_command_prefix"] . "vgdisplay -c", "r"); $i = 0; while (!feof($vgp)) $vgds[$i++] = fgets($vgp, 4096); pclose($vgp); $pvs_exist = false; $not_in_use = array(); for ($i = 0; $i < count($of_disks); $i++) { for ($j = 0; $j < count($of_disks[$i]["partitions"]); $j++) { $ptype = $of_disks[$i]["partitions"][$j]["type"]; $pv_device = $of_disks[$i]["partitions"][$j]["device"]; $not_in_use[$pv_device] = false; if ($ptype == "8e") { $pvp = popen("/usr/bin/sudo /sbin/pvdisplay " . $of_disks[$i]["partitions"][$j]["device"], "r"); $pvstr = trim(fgets($pvp, 4096)); pclose($pvp); if (strcmp($pvstr, "--- Physical volume ---") != 0) { $not_in_use[$pv_device] = true; $pvs_exist = true; } } } } if ($action == "addpvs") { $pvs = ""; for ($i = 0; $i < count($of_disks); $i++) { for ($j = 0; $j < count($of_disks[$i]["partitions"]); $j++) { $ptype = $of_disks[$i]["partitions"][$j]["type"]; $pv_device = $of_disks[$i]["partitions"][$j]["device"]; if (($ptype == "8e") && $not_in_use[$pv_device] && (${"check" . sha1($pv_device)} == "on")) $pvs = $pvs . " " . $pv_device; } } for ($i = 0; $i < count($vgds); $i++) { $vginfo = explode(":", trim($vgds[$i], " ")); if ($vginfo[11] <= 0) continue; if ($vginfo[0] == $vg) { exec("/usr/bin/sudo /sbin/vgextend " . escapeshellarg($vg) . $pvs); break; } } header("Location: ./volumes_vgmanage.html"); exit; } else if ($action == "createvg") { $pvs = ""; for ($i = 0; $i < count($of_disks); $i++) { for ($j = 0; $j < count($of_disks[$i]["partitions"]); $j++) { $ptype = $of_disks[$i]["partitions"][$j]["type"]; $pv_device = $of_disks[$i]["partitions"][$j]["device"]; if (($ptype == "8e") && $not_in_use[$pv_device] && (${"check" . sha1($pv_device)} == "on")) $pvs = $pvs . " " . $pv_device; } } $vg_found = false; for ($i = 0; $i < count($vgds); $i++) { $vginfo = explode(":", trim($vgds[$i], " ")); if ($vginfo[11] <= 0) continue; if ($vginfo[0] == $vgname) { $vg_found = true; break; } } if ((!$vg_found) && (is_valid_foldername($vgname))) exec("/usr/bin/sudo /sbin/vgcreate " . escapeshellarg($vgname) . $pvs); header("Location: ./volumes_vgmanage.html"); exit; } else if ($action == "deletevg") { $volume_group_in_use = false; for ($v = 0; $v < count($volumes_vg); $v++) if ($volumes_vg[$v] == $vg) $volume_group_in_use = true; if (!$volume_group_in_use) { exec("/usr/bin/sudo /sbin/vgchange -a n " . escapeshellarg($vg)); exec("/usr/bin/sudo /sbin/vgremove " . escapeshellarg($vg)); } header("Location: ./volumes_vgmanage.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.

Volume Group Management\n"); if (count($vgds) > 0) { print("
\n"); print("\n"); print("\n"); print("
\n"); print("\n"); print("\n"); print("\t\n"); print("\n"); $dcolor = 0; for ($i = 0; $i < count($of_disks); $i++) { for ($j = 0; $j < count($of_disks[$i]["partitions"]); $j++) { $ptype = $of_disks[$i]["partitions"][$j]["type"]; $pv_device = $of_disks[$i]["partitions"][$j]["device"]; if (($ptype == "8e") && $not_in_use[$pv_device]) { if ($dcolor == 0) { $dcolor = 1; $dvalue = $GLOBALS["color_table_row1"]; } else { $dcolor = 0; $dvalue = $GLOBALS["color_table_row2"]; } $part_size = ($of_disks[$i]["blocksize"] * $of_disks[$i]["partitions"][$j]["blocks"]); if ($part_size > (1024 * 1024 * 1024)) $part_size_string = sprintf("%.02f GB", ($part_size / (1024 * 1024 * 1024.0))); else if ($part_size > (1024 * 1024)) $part_size_string = sprintf("%.02f MB", ($part_size / (1024 * 1024.0))); else if ($part_size > (1024)) $part_size_string = sprintf("%.02f KB", ($part_size / (1024.0))); else $part_size_string = $part_size . " bytes"; print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); } } } print("\n"); print("\t\n"); print("\n"); print("
Select physical volumes to add
" . $pv_device . "" . $part_size_string . "
\n"); print("

Close Window

\n"); print("
\n"); print("
\n"); for ($ii = 0; $ii < count($vgds); $ii++) { $vginfo = explode(":", trim($vgds[$ii], " ")); if ($vginfo[11] <= 0) continue; print("
\n"); print("\n"); print("\n"); print("\t\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\n"); $dcolor = 0; for ($i = 0; $i < count($of_disks); $i++) { for ($j = 0; $j < count($of_disks[$i]["partitions"]); $j++) { $ptype = $of_disks[$i]["partitions"][$j]["type"]; $pv_device = $of_disks[$i]["partitions"][$j]["device"]; if ($ptype == "8e") { $pvp = popen("/usr/bin/sudo /sbin/pvdisplay -c " . $pv_device, "r"); $pvstr = trim(fgets($pvp, 4096)); pclose($pvp); } $pvinfo = explode(":", trim($pvstr, " ")); if ($pvinfo[0] != $pv_device) continue; if ($pvinfo[1] != $vginfo[0]) continue; if ($dcolor == 0) { $dcolor = 1; $dvalue = $GLOBALS["color_table_row1"]; } else { $dcolor = 0; $dvalue = $GLOBALS["color_table_row2"]; } $part_size = ($of_disks[$i]["blocksize"] * $of_disks[$i]["partitions"][$j]["blocks"]); if ($part_size > (1024 * 1024 * 1024)) $part_size_string = sprintf("%.02f GB", ($part_size / (1024 * 1024 * 1024.0))); else if ($part_size > (1024 * 1024)) $part_size_string = sprintf("%.02f MB", ($part_size / (1024 * 1024.0))); else if ($part_size > (1024)) $part_size_string = sprintf("%.02f KB", ($part_size / (1024.0))); else $part_size_string = $part_size . " bytes"; print("\n"); print("\n"); print("\n"); print("\n"); } } print("
Member PVs of VG “" . $vginfo[0] . "”
DeviceSize
" . $pv_device . "" . $part_size_string . "
\n"); print("

Close Window

\n"); print("
\n"); } print("
\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\t\n"); print("\n"); $dcolor = 0; for ($ii = 0; $ii < count($vgds); $ii++) { if ($dcolor == 0) { $dcolor = 1; $dvalue = $GLOBALS["color_table_row1"]; } else { $dcolor = 0; $dvalue = $GLOBALS["color_table_row2"]; } $vginfo = explode(":", trim($vgds[$ii], " ")); if ($vginfo[11] <= 0) break; print("\n"); print("\n"); $vg_size = $vginfo[11] * 1024; if ($vg_size > (1024 * 1024 * 1024)) $vg_size_string = sprintf("%.02f GB", ($vg_size / (1024 * 1024 * 1024.0))); else if ($vg_size > (1024 * 1024)) $vg_size_string = sprintf("%.02f MB", ($vg_size / (1024 * 1024.0))); else if ($vg_size > (1024)) $vg_size_string = sprintf("%.02f KB", ($vg_size / (1024.0))); else $vg_size_string = $vg_size . " bytes"; print("\n"); $vg_size = ($vginfo[12] / 2) * $vginfo[14] * 1024; if ($vg_size > (1024 * 1024 * 1024)) $vg_size_string = sprintf("%.02f GB", ($vg_size / (1024 * 1024 * 1024.0))); else if ($vg_size > (1024 * 1024)) $vg_size_string = sprintf("%.02f MB", ($vg_size / (1024 * 1024.0))); else if ($vg_size > (1024)) $vg_size_string = sprintf("%.02f KB", ($vg_size / (1024.0))); else $vg_size_string = $vg_size . " bytes"; print("\n"); $vg_size = ($vginfo[12] / 2) * $vginfo[15] * 1024; if ($vg_size > (1024 * 1024 * 1024)) $vg_size_string = sprintf("%.02f GB", ($vg_size / (1024 * 1024 * 1024.0))); else if ($vg_size > (1024 * 1024)) $vg_size_string = sprintf("%.02f MB", ($vg_size / (1024 * 1024.0))); else if ($vg_size > (1024)) $vg_size_string = sprintf("%.02f KB", ($vg_size / (1024.0))); else $vg_size_string = $vg_size . " bytes"; print("\n"); print("\n"); print("\n"); $volume_group_in_use = false; for ($v = 0; $v < count($volumes_vg); $v++) if ($volumes_vg[$v] == $vginfo[0]) $volume_group_in_use = true; if ($volume_group_in_use) print("\n"); else print("\n"); print("\n"); } print("
Volume Group NameSizeAllocatedFreeMembersAdd physical storageDelete VG
" . htmlentities($vginfo[0]) . "" . htmlentities($vg_size_string) . "" . htmlentities($vg_size_string) . "" . htmlentities($vg_size_string) . "View member PVsAdd PVsVG contains volumesDelete
\n"); print("
\n"); } else print("

No existing volume groups were found.

\n"); print("

 

\n"); print("
\n"); print("

Create a new volume group

\n"); if ($pvs_exist) { print("
\n"); print("\n"); print("
\n"); print("\n"); print("\n"); print("\t\n"); print("\n"); print("\n"); print("\t\n"); print("\n"); print("\n"); print("\t\n"); print("\n"); $dcolor = 0; for ($i = 0; $i < count($of_disks); $i++) { for ($j = 0; $j < count($of_disks[$i]["partitions"]); $j++) { $ptype = $of_disks[$i]["partitions"][$j]["type"]; $pv_device = $of_disks[$i]["partitions"][$j]["device"]; if (($ptype == "8e") && $not_in_use[$pv_device]) { if ($dcolor == 0) { $dcolor = 1; $dvalue = $GLOBALS["color_table_row1"]; } else { $dcolor = 0; $dvalue = $GLOBALS["color_table_row2"]; } $part_size = ($of_disks[$i]["blocksize"] * $of_disks[$i]["partitions"][$j]["blocks"]); if ($part_size > (1024 * 1024 * 1024)) $part_size_string = sprintf("%.02f GB", ($part_size / (1024 * 1024 * 1024.0))); else if ($part_size > (1024 * 1024)) $part_size_string = sprintf("%.02f MB", ($part_size / (1024 * 1024.0))); else if ($part_size > (1024)) $part_size_string = sprintf("%.02f KB", ($part_size / (1024.0))); else $part_size_string = $part_size . " bytes"; print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); } } } print("\n"); print("\t\n"); print("\n"); print("
Volume group name
Select physical volumes to add
" . $pv_device . "" . $part_size_string . "
\n"); print("
\n"); print("
\n"); } else print("

No existing physical volumes were found.
You can create some.

\n"); print("

 

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