osiddefs.php3 4.68 KB
Newer Older
1 2
<?php
#
3
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
23 24 25 26 27 28 29
#
# Stuff for OSIDs. All this stuff should come from the DB instead!
#

# List of allowed OS types for creating OSIDs. The value is a user-okay flag.
$osid_oslist			= array();
$osid_oslist["Linux"]		= 1;
30
$osid_oslist["Fedora"]		= 1;
31 32
$osid_oslist["FreeBSD"]		= 1;
$osid_oslist["NetBSD"]		= 1;
33
$osid_oslist["Windows"]		= 1;
34
$osid_oslist["TinyOS"]		= 1;
35 36 37 38 39 40 41 42 43 44 45
$osid_oslist["Oskit"]		= 0;
$osid_oslist["Other"]		= 1;

# List of allowed OS features. The value is a user-okay flag.
$osid_featurelist		= array();
$osid_featurelist["ping"]	= 1;
$osid_featurelist["ssh"]	= 1;
$osid_featurelist["ipod"]	= 1;
$osid_featurelist["isup"]	= 1;
$osid_featurelist["veths"]	= 0;
$osid_featurelist["mlinks"]	= 0;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
46
$osid_featurelist["linktest"]	= 1;
47 48
$osid_featurelist["linkdelays"]	= 1;
$osid_featurelist["vlans"]	= 1;
49
$osid_featurelist["suboses"]	= 1;
50 51
$osid_featurelist["loc-bstore"] = 1;
$osid_featurelist["rem-bstore"] = 1;
52 53 54

# Default op modes. The value is a user-okay flag.
$osid_opmodes			= array();
55 56
$osid_opmodes["NORMALv2"]	= 1;
$osid_opmodes["NORMALv1"]	= 0;
57 58
$osid_opmodes["MINIMAL"]	= 1;
$osid_opmodes["NORMAL"]		= 1;
59
$osid_opmodes["ALWAYSUP"]	= 1;
60
$osid_opmodes["PCVM"]		= 1;
61

62
define("TBDB_DEFAULT_OSID_OPMODE",	"NORMALv2");
63
define("TBDB_MINIMAL_OPMODE",		"MINIMAL");
64
define("TBDB_ALWAYSUP_OPMODE",		"ALWAYSUP");
65
define("TBDB_PCVM_OPMODE",		"PCVM");
66

67 68 69
# Default OSID boot wait timeouts. User is not allowed to edit this.
$osid_reboot_waitlist			= array();
$osid_reboot_waitlist["Linux"]		= 120;
70
$osid_reboot_waitlist["Fedora"]		= 120;
71 72
$osid_reboot_waitlist["FreeBSD"]	= 120;
$osid_reboot_waitlist["NetBSD"]		= 120;
73
$osid_reboot_waitlist["Windows"]	= 240;
74 75 76 77
$osid_reboot_waitlist["TinyOS"]		= 60;
$osid_reboot_waitlist["Oskit"]		= 60;
$osid_reboot_waitlist["Other"]		= 60;

78 79 80
#
# Helper function to write out a menu.
#
81 82
function WRITEOSIDMENU($caption, $value, $osid_result, $previous,
		       $delete_varname = "", $delete_varvalue = "")
83
{
84 85 86 87 88 89 90 91
    echo "<tr>";
    if ($delete_varname != "") {
	echo "<td align=center>
                  <input type=checkbox value=checked
                         name=\"$delete_varname\" $delete_varvalue>
                </td>\n";
    }
    echo "  <td>*$caption:</td>";
92 93 94 95 96 97
    echo "  <td><select name=\"$value\">
                <option value=X>Please Select </option>\n";

    mysql_data_seek($osid_result, 0);

    while ($row = mysql_fetch_array($osid_result)) {
98 99 100
	$osid   = $row["osid"];
	$osname = $row["osname"];
	$pid    = $row["pid"];
101 102 103 104 105 106 107 108
	$selected = "";

	if (strcmp($previous, "$osid") == 0)
	    $selected = "selected";

	echo "<option $selected value='$osid'>$pid - $osname</option>\n";
    }
    $selected = "";
109
    if (!isset($previous) || $previous == "none" || $previous == "")
110 111 112 113 114 115 116 117
	$selected = "selected";
	
    echo "         <option $selected value=none>No OS</option>\n";
    echo "       </select>";
    echo "    </td>
          </tr>\n";
}

118 119
function WRITEIMAGEIDMENU($caption, $value, $imageid_result, $previous,
			  $delete_varname = "", $delete_varvalue = "")
120
{
121 122 123 124 125 126 127 128
    echo "<tr>";
    if ($delete_varname != "") {
	echo "<td align=center>
                  <input type=checkbox value=checked
                         name=\"$delete_varname\" $delete_varvalue>
                </td>\n";
    }
    echo "<td>*$caption:</td>";
129 130 131 132 133 134
    echo "  <td><select name=\"$value\">
                <option value=X>Please Select </option>\n";

    mysql_data_seek($imageid_result, 0);

    while ($row = mysql_fetch_array($imageid_result)) {
135 136 137
	$imageid   = $row["imageid"];
	$imagename = $row["imagename"];
	$pid       = $row["pid"];
138 139 140 141 142 143 144 145
	$selected  = "";

	if (strcmp($previous, "$imageid") == 0)
	    $selected = "selected";

	echo "<option $selected value='$imageid'>$pid - $imagename</option>\n";
    }
    $selected = "";
146
    if (!isset($previous) || $previous == "none" || $previous == "")
147 148 149 150 151 152 153 154
	$selected = "selected";
	
    echo "         <option $selected value=none>No ImageID</option>\n";
    echo "       </select>";
    echo "    </td>
          </tr>\n";
}