osiddefs.php3 4.71 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 Stoller's avatar
Leigh 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;
Leigh Stoller's avatar
Leigh Stoller committed
52
$osid_featurelist["xen-host"]   = 1;
53 54 55

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

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

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

79 80 81
#
# Helper function to write out a menu.
#
82 83
function WRITEOSIDMENU($caption, $value, $osid_result, $previous,
		       $delete_varname = "", $delete_varvalue = "")
84
{
85 86 87 88 89 90 91 92
    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>";
93 94 95 96 97 98
    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)) {
99 100 101
	$osid   = $row["osid"];
	$osname = $row["osname"];
	$pid    = $row["pid"];
102 103 104 105 106 107 108 109
	$selected = "";

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

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

119 120
function WRITEIMAGEIDMENU($caption, $value, $imageid_result, $previous,
			  $delete_varname = "", $delete_varvalue = "")
121
{
122 123 124 125 126 127 128 129
    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>";
130 131 132 133 134 135
    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)) {
136 137 138
	$imageid   = $row["imageid"];
	$imagename = $row["imagename"];
	$pid       = $row["pid"];
139 140 141 142 143 144 145 146
	$selected  = "";

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

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