function nas_create_default_mounts($obj, $mapping = array()) { $mounts = nas_list_default_mounts(); foreach ($mounts as $m) { $storage_export_id = $m["storage_export_id"]; if ($storage_export_id) { $e = nas_get_export_by_id($storage_export_id); if ($e["default"] != "no") { $storage_export_id = $mapping[$storage_export_id]; } } nas_mount_add($storage_export_id, $m["vps_id"] ? $m["vps_id"] : $obj["vps_id"], $m["mode"], $m["server_id"], nas_resolve_vars($m["src"], $obj), $m["dst"], $m["mount_opts"], $m["umount_opts"], $m["mount_type"], $m["cmd_premount"], $m["cmd_postmount"], $m["cmd_preumount"], $m["cmd_postumount"], false, false); } }
$xtpl->table_td($e["path"]); $xtpl->table_td(nas_size_to_humanreadable($e["export_quota"])); $xtpl->table_td($e["export_type"]); $xtpl->table_td('<a href="?page=cluster&action=nas_def_export_edit&id=' . $e["export_id"] . '"><img src="template/icons/edit.png" title="' . _("Edit") . '"></a>'); $xtpl->table_td('<a href="?page=cluster&action=nas_def_export_del&id=' . $e["export_id"] . '"><img src="template/icons/delete.png" title="' . _("Delete") . '"></a>'); $xtpl->table_tr(); } $xtpl->table_out(); $xtpl->table_title(_("Default mounts created for new VPS")); $xtpl->table_add_category(_("Source")); $xtpl->table_add_category(_("Destination")); $xtpl->table_add_category(_("Mount options")); $xtpl->table_add_category(_("Umount options")); $xtpl->table_add_category(''); $xtpl->table_add_category(''); $mounts = nas_list_default_mounts(); foreach ($mounts as $m) { $xtpl->table_td($m["storage_export_id"] ? $m["root_label"] . ":" . $m["path"] : $m["server_name"] . ":" . $m["src"]); $xtpl->table_td($m["dst"]); $xtpl->table_td($m["mount_opts"]); $xtpl->table_td($m["umount_opts"]); $xtpl->table_td('<a href="?page=cluster&action=nas_def_mount_edit&id=' . $m["mount_id"] . '"><img src="template/icons/edit.png" title="' . _("Edit") . '"></a>'); $xtpl->table_td('<a href="?page=cluster&action=nas_def_mount_del&id=' . $m["mount_id"] . '"><img src="template/icons/delete.png" title="' . _("Delete") . '"></a>'); $xtpl->table_tr(); } $xtpl->table_out(); $xtpl->sbar_add(_("Back"), '?page=cluster'); $xtpl->sbar_add(_("Add default export for member"), '?page=cluster&action=nas_def_export_add&for=member'); $xtpl->sbar_add(_("Add default export for VPS"), '?page=cluster&action=nas_def_export_add&for=vps'); $xtpl->sbar_add(_("Add default mount for VPS"), '?page=cluster&action=nas_def_mount_add'); break;