showstuff.php3 48.8 KB
Newer Older
1
2
<?php
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
3
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
5
6
7
# All rights reserved.
#
#
8
9
10
11
12
13
14
15
16
17
18
# This is an included file. No headers or footers.
#
# Functions to dump out various things.  
#

#
# A project
#
function SHOWPROJECT($pid, $thisuid) {
    global $TBDBNAME;

19
20
    $query_result =
	DBQueryFatal("SELECT * FROM projects WHERE pid='$pid'");
21
22
    $row = mysql_fetch_array($query_result);

23
24
25
    echo "<center>
          <h3>Project Profile</h3>
          </center>
26
          <table align=center cellpadding=2 border=1>\n";
27
    
28
    $proj_created	= $row[created];
29
    #$proj_expires	= $row[expires];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
30
    $proj_name		= stripslashes($row[name]);
31
    $proj_URL		= $row[URL];
32
    $proj_public        = $row[public];
33
    $proj_funders	= stripslashes($row[funders]);;
34
35
36
    $proj_head_uid	= $row[head_uid];
    $proj_members       = $row[num_members];
    $proj_pcs           = $row[num_pcs];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
37
38
    $proj_ronpcs        = $row[num_ron];
    $proj_plabpcs       = $row[num_pcplab];
39
    $proj_why           = nl2br($row[why]);
40
    $control_node	= $row[control_node];
41
    $approved           = $row[approved];
42
43
    $expt_count         = $row[expt_count];
    $expt_last          = $row[expt_last];
44

45
46
47
48
49
50
51
    if ($proj_public) {
	$proj_public = "Yes";
    }
    else {
	$proj_public = "No";
    }

52
53
54
55
    if (!$expt_last) {
	$expt_last = "&nbsp";
    }

56
57
58
59
60
    #
    # Generate the table.
    # 
    echo "<tr>
              <td>Name: </td>
61
62
              <td class=\"left\">
                <a href='showproject.php3?pid=$pid'>$pid</a></td>
63
64
65
66
67
68
69
70
71
72
          </tr>\n";
    
    echo "<tr>
              <td>Long Name: </td>
              <td class=\"left\">$proj_name</td>
          </tr>\n";
    
    echo "<tr>
              <td>Project Head: </td>
              <td class=\"left\">
73
                <A href='showuser.php3?target_uid=$proj_head_uid'>
74
75
76
77
78
79
80
81
82
                     $proj_head_uid</A></td>
          </tr>\n";
    
    echo "<tr>
              <td>URL: </td>
              <td class=\"left\">
                  <A href='$proj_URL'>$proj_URL</A></td>
          </tr>\n";
    
83
84
85
86
87
    echo "<tr>
              <td>Publicly Visible: </td>
              <td class=\"left\">$proj_public</td>
          </tr>\n";
    
88
89
90
91
92
    echo "<tr>
              <td>Funders: </td>
              <td class=\"left\">$proj_funders</td>
          </tr>\n";

93
94
95
96
97
98
99
100
101
102
103
    echo "<tr>
              <td>#Project Members: </td>
              <td class=\"left\">$proj_members</td>
          </tr>\n";
    
    echo "<tr>
              <td>#PCs: </td>
              <td class=\"left\">$proj_pcs</td>
          </tr>\n";
    
    echo "<tr>
104
105
106
107
108
109
110
              <td>#Planetlab PCs: </td>
              <td class=\"left\">$proj_plabpcs</td>
          </tr>\n";
    
    echo "<tr>
              <td>#RON PCs: </td>
              <td class=\"left\">$proj_ronpcs</td>
111
112
113
114
115
116
117
          </tr>\n";
    
    echo "<tr>
              <td>Created: </td>
              <td class=\"left\">$proj_created</td>
          </tr>\n";
    
118
119
120
121
    #echo "<tr>
    #          <td>Expires: </td>
    #          <td class=\"left\">$proj_expires</td>
    #      </tr>\n";
122
    
123
124
125
126
127
128
129
130
131
132
    echo "<tr>
              <td>Experiments Created:</td>
              <td class=\"left\">$expt_count</td>
          </tr>\n";
    
    echo "<tr>
              <td>Date of last experiment:</td>
              <td class=\"left\">$expt_last</td>
          </tr>\n";
    
133
134
135
136
137
138
139
140
141
142
    echo "<tr>
              <td>Approved?: </td>\n";
    if ($approved) {
	echo "<td class=left><img alt=\"Y\" src=\"greenball.gif\"></td>\n";
    }
    else {
	echo "<td class=left><img alt=\"N\" src=\"redball.gif\"></td>\n";
    }
    echo "</tr>\n";

143
    echo "<tr>
144
              <td colspan='2'>Why?:</td>
145
146
147
148
149
150
151
152
153
          </tr>\n";
    
    echo "<tr>
              <td colspan='2' width=600>$proj_why</td>
          </tr>\n";
    
    echo "</table>\n";
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
154
155
156
157
#
# A Group
#
function SHOWGROUP($pid, $gid) {
158
159
    global $OURDOMAIN;
    
Leigh B. Stoller's avatar
Leigh B. Stoller committed
160
161
162
163
    $query_result =
	DBQueryFatal("SELECT * FROM groups WHERE pid='$pid' and gid='$gid'");
    $row = mysql_fetch_array($query_result);

164
165
166
167
    echo "<center>
          <h3>Group Profile</h3>
          </center>
          <table align=center border=1>\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
168
169
170

    $leader	= $row[leader];
    $created	= $row[created];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
171
    $description= stripslashes($row[description]);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
172
173
174
175
176
    $expt_count = $row[expt_count];
    $expt_last  = $row[expt_last];
    $unix_gid   = $row[unix_gid];
    $unix_name  = $row[unix_name];

177
178
179
180
181
    if (strcmp($pid,$gid))
	$mail = "$pid-$gid" . "-users@" . $OURDOMAIN;
    else
	$mail = "$pid" . "-users@" . $OURDOMAIN;

Leigh B. Stoller's avatar
Leigh B. Stoller committed
182
183
184
185
186
187
188
189
190
    if (!$expt_last) {
	$expt_last = "&nbsp";
    }

    #
    # Generate the table.
    # 
    echo "<tr>
              <td>GID: </td>
191
              <td class=\"left\">
Chad Barb's avatar
   
Chad Barb committed
192
                <a href='showgroup.php3?pid=$pid&gid=$gid'>$gid</a></td>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
193
194
195
196
          </tr>\n";
    
    echo "<tr>
              <td>PID: </td>
197
198
              <td class=\"left\">
                <a href='showproject.php3?pid=$pid'>$pid</a></td>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
          </tr>\n";
    
    echo "<tr>
              <td>Description: </td>
              <td class=\"left\">$description</td>
          </tr>\n";
    
    echo "<tr>
              <td>Unix GID: </td>
              <td class=\"left\">$unix_gid</td>
          </tr>\n";
    
    echo "<tr>
              <td>Unix Group Name: </td>
              <td class=\"left\">$unix_name</td>
          </tr>\n";
    
    echo "<tr>
              <td>Group Leader: </td>
              <td class=\"left\">
                <A href='showuser.php3?target_uid=$leader'>$leader</A></td>
          </tr>\n";
    
222
223
224
225
226
    echo "<tr>
              <td>Email List: </td>
              <td class=\"left\">$mail</td>
          </tr>\n";
    
Leigh B. Stoller's avatar
Leigh B. Stoller committed
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
    echo "<tr>
              <td>Created: </td>
              <td class=\"left\">$created</td>
          </tr>\n";
    
    echo "<tr>
              <td>Experiments Created:</td>
              <td class=\"left\">$expt_count</td>
          </tr>\n";
    
    echo "<tr>
              <td>Date of last experiment:</td>
              <td class=\"left\">$expt_last</td>
          </tr>\n";
    
    echo "</table>\n";
}

#
# A list of Group members.
#
248
function SHOWGROUPMEMBERS($pid, $gid, $prived = 0) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
249
250
251
252
253
254
255
256
    $query_result =
	DBQueryFatal("SELECT m.*,u.* FROM group_membership as m ".
		     "left join users as u on u.uid=m.uid ".
		     "WHERE pid='$pid' and gid='$gid'");
    
    if (! mysql_num_rows($query_result)) {
	return;
    }
257
    $showdel = (($prived && !strcmp($pid, $gid)) ? 1 : 0);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
258

259
260
261
262
263
264
265
266
    echo "<center>\n";
    if (strcmp($pid, $gid)) {
	echo "<h3>Group Members</h3>\n";
    }
    else {
	echo "<h3>Project Members</h3>\n";
    }
    echo "</center>
267
          <table align=center border=1 cellpadding=1 cellspacing=2>\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
268
269

    echo "<tr>
Chad Barb's avatar
   
Chad Barb committed
270
271
              <th>Name</th>
              <th>UID</th>
272
273
274
275
276
              <th>Privs</th>\n";
    if ($showdel) {
	echo "<th>Remove</th>\n";
    }
    echo "</tr>\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
277
278
279
280
281
282
283
284
285
286
287

    while ($row = mysql_fetch_array($query_result)) {
        $target_uid = $row[uid];
	$usr_name   = $row[usr_name];
	$trust      = $row[trust];

        echo "<tr>
                  <td>$usr_name</td>
                  <td>
                    <A href='showuser.php3?target_uid=$target_uid'>
                       $target_uid</A>
288
289
290
291
                  </td>\n";
	
	if (TBTrustConvert($trust) != $TBDB_TRUST_NONE) {
	    echo "<td>$trust</td>\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
292
293
	}
	else {
294
295
296
	    echo "<td><font color=red>$trust</font></td>\n";
	}
	if ($showdel) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
297
	    echo "<td align=center>
298
299
300
		      <A href='deleteuser.php3?target_uid=$target_uid";
	    echo         "&target_pid=$pid'>
                         <img alt=N src=redball.gif></td>\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
301
302
303
304
305
306
	}
	echo "</tr>\n";
    }
    echo "</table>\n";
}

307
308
309
310
#
# A list of groups for a user.
#
function SHOWGROUPMEMBERSHIP($uid) {
311
312
    $none = TBDB_TRUSTSTRING_NONE;
    
313
314
    $query_result =
	DBQueryFatal("SELECT * FROM group_membership ".
315
316
		     "WHERE uid='$uid' and trust!='$none' ".
		     "order by pid");
317
318
319
320
321
322
323
324
325
326
327
    
    if (! mysql_num_rows($query_result)) {
	return;
    }

    echo "<center>
          <h3>Group Membership</h3>
          </center>
          <table align=center border=1 cellpadding=1 cellspacing=2>\n";

    echo "<tr>
Chad Barb's avatar
   
Chad Barb committed
328
329
330
              <th>PID</th>
              <th>GID</th>
              <th>Privs</th>
331
332
333
334
335
336
337
          </tr>\n";

    while ($row = mysql_fetch_array($query_result)) {
	$pid   = $row[pid];
	$gid   = $row[gid];
	$trust = $row[trust];

338
339
	if (TBTrustConvert($trust) != $TBDB_TRUST_NONE) {
	    echo "<tr>
340
341
342
              <td><a href='showproject.php3?pid=$pid'>$pid</a></td>
              <td><a href='showgroup.php3?pid=$pid&gid=$gid'>$gid</a></td>
              <td>$trust</td>\n";
343
344
	    echo "</tr>\n";
	}
345
346
347
348
    }
    echo "</table>\n";
}

349
350
351
352
353
#
# A User
#
function SHOWUSER($uid) {
    global $TBDBNAME;
354
355
356

    $userinfo_result =
	DBQueryFatal("SELECT * from users where uid='$uid'");
357
358

    $row	= mysql_fetch_array($userinfo_result);
359
    #$usr_expires = $row[usr_expires];
360
361
    $usr_email   = $row[usr_email];
    $usr_URL     = $row[usr_URL];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
362
    $usr_addr    = stripslashes($row[usr_addr]);
363
364
365
366
    $usr_addr2   = stripslashes($row[usr_addr2]);
    $usr_city    = stripslashes($row[usr_city]);
    $usr_state   = stripslashes($row[usr_state]);
    $usr_zip     = stripslashes($row[usr_zip]);
Chad Barb's avatar
   
Chad Barb committed
367
    $usr_country = stripslashes($row[usr_country]);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
368
    $usr_name    = stripslashes($row[usr_name]);
369
    $usr_phone   = $row[usr_phone];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
370
371
    $usr_title   = stripslashes($row[usr_title]);
    $usr_affil   = stripslashes($row[usr_affil]);
372
    $status      = $row[status];
373
374
    $admin       = $row[admin];
    $adminoff    = $row[adminoff];
375

376
377
378
379
380
381
382
383
    if (!strcmp($usr_addr2, ""))
	$usr_addr2 = "&nbsp";
    if (!strcmp($usr_city, ""))
	$usr_city = "&nbsp";
    if (!strcmp($usr_state, ""))
	$usr_state = "&nbsp";
    if (!strcmp($usr_zip, ""))
	$usr_zip = "&nbsp";
Chad Barb's avatar
   
Chad Barb committed
384
385
    if (!strcmp($usr_country, ""))
	$usr_country = "&nbsp";
386

387
388
389
390
391
    #
    # Last Login info.
    #
    if (($lastweblogin = LASTWEBLOGIN($uid)) == 0)
	$lastweblogin = "&nbsp";
392
    if (($lastuserslogininfo = TBUsersLastLogin($uid)) == 0)
393
394
395
	$lastuserslogin = "N/A";
    else {
	$lastuserslogin = $lastuserslogininfo["date"] . " " .
396
		          $lastuserslogininfo["time"];
397
398
399
400
401
402
403
404
405
    }
    
    if (($lastnodelogininfo = TBUidNodeLastLogin($uid)) == 0)
	$lastnodelogin = "N/A";
    else {
	$lastnodelogin = $lastnodelogininfo["date"] . " " .
		         $lastnodelogininfo["time"] . " " .
                         "(" . $lastnodelogininfo["node_id"] . ")";
    }
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
    
    echo "<table align=center border=1>\n";
    
    echo "<tr>
              <td>Username:</td>
              <td>$uid</td>
          </tr>\n";
    
    echo "<tr>
              <td>Full Name:</td>
              <td>$usr_name</td>
          </tr>\n";
    
    echo "<tr>
              <td>Email Address:</td>
              <td>$usr_email</td>
          </tr>\n";
    
    echo "<tr>
              <td>Home Page URL:</td>
              <td><A href='$usr_URL'>$usr_URL</A></td>
          </tr>\n";
    
429
430
431
432
    #echo "<tr>
    #          <td>Expiration date:</td>
    #          <td>$usr_expires</td>
    #      </tr>\n";
433
434
    
    echo "<tr>
435
              <td>Address 1:</td>
436
437
438
              <td>$usr_addr</td>
          </tr>\n";
    
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
    echo "<tr>
              <td>Address 2:</td>
              <td>$usr_addr2</td>
          </tr>\n";
    
    echo "<tr>
              <td>City:</td>
              <td>$usr_city</td>
          </tr>\n";
    
    echo "<tr>
              <td>State:</td>
              <td>$usr_state</td>
          </tr>\n";
    
    echo "<tr>
Chad Barb's avatar
   
Chad Barb committed
455
              <td>ZIP:</td>
456
457
              <td>$usr_zip</td>
          </tr>\n";
Chad Barb's avatar
   
Chad Barb committed
458
459
460
461
462

    echo "<tr>
              <td>Country:</td>
              <td>$usr_country</td>
          </tr>\n";
463
    
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
    echo "<tr>
              <td>Phone #:</td>
              <td>$usr_phone</td>
          </tr>\n";
    
    echo "<tr>
              <td>Title/Position:</td>
              <td>$usr_title</td>
         </tr>\n";
    
    echo "<tr>
              <td>Institutional Affiliation:</td>
              <td>$usr_affil</td>
          </tr>\n";
    
479
480
481
482
    echo "<tr>
              <td>Status:</td>
              <td>$status</td>
          </tr>\n";
483
484
485
486
487
488
489
490
491
492
493

    if ($admin) {
	$onoff = ($adminoff ? "Off" : "On");
	$flip  = ($adminoff ? 0 : 1);
	echo "<tr>
                  <td>Admin (on/off):</td>
                  <td>Yes
                      <a href=adminmode.php3?target_uid=$uid&adminoff=$flip>
                         ($onoff)</td>
              </tr>\n";
    }
494
    
495
496
497
498
499
500
501
502
503
504
    echo "<tr>
              <td>Last Web Login:</td>
              <td>$lastweblogin</td>
          </tr>\n";
    
    echo "<tr>
              <td>Last Users Login:</td>
              <td>$lastuserslogin</td>
          </tr>\n";
    
505
506
507
508
509
    echo "<tr>
              <td>Last Node Login:</td>
              <td>$lastnodelogin</td>
          </tr>\n";
    
510
511
512
513
    echo "</table>\n";

}

514
515
516
517
#
# Show an experiment.
#
function SHOWEXP($pid, $eid) {
518
    global $TBDBNAME, $TBDOCBASE;
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
    $nodecounts  = array();

    # Node counts, by class. 
    $query_result =
	DBQueryFatal("select nt.class,count(*) from reserved as r ".
		     "left join nodes as n on n.node_id=r.node_id ".
		     "left join node_types as nt on n.type=nt.type ".
		     "where pid='$pid' and eid='$eid' group by nt.class");

    while ($row = mysql_fetch_array($query_result)) {
	$class = $row[0];
	$count = $row[1];
	
	$nodecounts[$class] = $count;
    }
534
		
Leigh B. Stoller's avatar
Leigh B. Stoller committed
535
    $query_result =
536
537
538
	DBQueryFatal("select e.*, round(minimum_nodes+.1,0) as min_nodes ".
		     " from experiments as e ".
		     "where e.pid='$pid' and e.eid='$eid'");
539
    
Leigh B. Stoller's avatar
Leigh B. Stoller committed
540
541
542
    if (($exprow = mysql_fetch_array($query_result)) == 0) {
	TBERROR("Experiment $eid in project $pid is gone!\n", 1);
    }
543

Leigh B. Stoller's avatar
Leigh B. Stoller committed
544
    $exp_gid     = $exprow[gid];
545
    #$exp_expires = $exprow[expt_expires];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
546
    $exp_name    = stripslashes($exprow[expt_name]);
547
    $exp_created = $exprow[expt_created];
548
    $exp_swapped = $exprow[expt_swapped];
549
    $exp_swapuid = $exprow[expt_swap_uid];
550
551
552
    $exp_end     = $exprow[expt_end];
    $exp_created = $exprow[expt_created];
    $exp_head    = $exprow[expt_head_uid];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
553
    $exp_status  = $exprow[state];
554
    $exp_shared  = $exprow[shared];
555
556
557
558
    $exp_path    = $exprow[path];
    $batchmode   = $exprow[batchmode];
    $attempts    = $exprow[attempts];
    $batchstate  = $exprow[batchstate];
559
560
    $priority    = $exprow[priority];
    $swappable   = $exprow[swappable];
561
    $idle_ignore = $exprow[idle_ignore];
562
563
    $swapreqs    = $exprow[swap_requests];
    $lastswapreq = $exprow[last_swap_req];
564
    $minnodes    = $exprow["min_nodes"];
565
566

    if ($swappable)
567
568
569
	$swappable = "Yes
<a href=\"toggle.php?type=swappable&value=0&pid=$pid&eid=$eid\">
<img src=\"greenball.gif\" border=0 alt=\"Toggle\"></a>";
570
    else
571
572
	$swappable = "No
<a href=\"toggle.php?type=swappable&value=1&pid=$pid&eid=$eid\">
573
574
575
576
577
578
579
580
581
<img src=\"redball.gif\" border=0 alt=\"Toggle\"></a>";

    if ($idle_ignore)
	$idle_ignore = "Yes
<a href=\"toggle.php?type=idle_ignore&value=0&pid=$pid&eid=$eid\">
<img src=\"greenball.gif\" border=0 alt=\"Toggle\"></a>";
    else
	$idle_ignore = "No
<a href=\"toggle.php?type=idle_ignore&value=1&pid=$pid&eid=$eid\">
582
<img src=\"redball.gif\" border=0 alt=\"Toggle\"></a>";
583
584
585
586

    #
    # Generate the table.
    #
Chad Barb's avatar
   
Chad Barb committed
587
    echo "<table align=center cellpadding=2 cellspacing=2 border=1>\n";
588
589
590

    echo "<tr>
            <td>Name: </td>
591
            <td class=left>$eid</td>
592
593
594
595
596
597
598
599
600
          </tr>\n";

    echo "<tr>
            <td>Long Name: </td>
            <td class=\"left\">$exp_name</td>
          </tr>\n";

    echo "<tr>
            <td>Project: </td>
601
            <td class=\"left\">
602
              <a href='showproject.php3?pid=$pid'>$pid</a></td>
603
604
          </tr>\n";

Leigh B. Stoller's avatar
Leigh B. Stoller committed
605
606
607
    echo "<tr>
            <td>Group: </td>
            <td class=\"left\">
608
              <a href='showgroup.php3?pid=$pid&gid=$exp_gid'>$exp_gid</a></td>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
609
610
          </tr>\n";

611
612
613
    echo "<tr>
            <td>Experiment Head: </td>
            <td class=\"left\">
614
              <a href='showuser.php3?target_uid=$exp_head'>$exp_head</a></td>
615
616
617
618
619
620
621
          </tr>\n";

    echo "<tr>
            <td>Created: </td>
            <td class=\"left\">$exp_created</td>
          </tr>\n";

622
623
624
625
626
627
    if ($exp_swapped) {
        echo "<tr>
                <td>Last Swap/Modify: </td>
                <td class=\"left\">$exp_swapped ($exp_swapuid)</td>
              </tr>\n";
    }
628

629
    echo "<tr>
630
            <td><a href='$TBDOCBASE/faq.php3#UTT-Swapping'>Swappable:</a></td>
631
632
633
            <td class=\"left\">$swappable</td>
          </tr>\n";

634
635
636
637
638
639
640
641
642
    # XXX: isadmin doesn't use the uid you give it, and we don't have a real
    # uid to send here. so just make something up to match the prototype.
    if (isadmin(123)) {
	echo "<tr>
            <td>Idle Ignore:</td>
            <td class=\"left\">$idle_ignore</td>
          </tr>\n";
    }
    
643
644
645
646
647
    echo "<tr>
            <td>Priority: (0 is highest) </td>
            <td class=\"left\">$priority</td>
          </tr>\n";

648
649
650
651
652
653
654
655
656
657
658
659
    echo "<tr>
            <td>Shared: </td>
            <td class=\"left\">";
    if ($exp_shared) {
	echo "<A href='expaccess_form.php3?pid=$pid&eid=$eid'>Yes</a>";
    }
    else {
	echo "No";
    }
    echo "   </td>
          </tr>\n";

660
661
662
663
664
    echo "<tr>
            <td>Path: </td>
            <td class=left>$exp_path</td>
          </tr>\n";

665
666
667
668
669
    echo "<tr>
            <td>Status: </td>
            <td class=\"left\">$exp_status</td>
          </tr>\n";

670
    if (count($nodecounts)) {
671
	echo "<tr>
672
            <td>Reserved Nodes: </td>
673
674
675
676
677
            <td class=\"left\">\n";
	while (list ($class, $count) = each($nodecounts)) {
	    echo "$count ($class) &nbsp ";
	}
	echo "</td>
678
          </tr>\n";
679
680
681
682
683
684
685
    } else {
	echo "<tr>
            <td>Minumum Nodes: </td>
            <td class=\"left\"><font color=blue>
               $minnodes (estimate)</font></td>
          </tr>\n";
    }
686

687
688
    $lastact = TBGetExptLastAct($pid,$eid);
    $idletime = TBGetExptIdleTime($pid,$eid);
689
690
    $stale = TBGetExptIdleStale($pid,$eid);
    
691
692
    if ($lastact != -1) {
	echo "<tr>
693
694
695
696
            <td>Last Activity: </td>
            <td class=\"left\">$lastact</td>
          </tr>\n";

697
698
	if ($stale) { $str = "(stale)"; } else { $str = ""; }
	
699
	echo "<tr>
700
            <td>Idle Time: </td>
701
            <td class=\"left\">$idletime hours $str</td>
702
          </tr>\n";
703
    }
704

705
706
707
708
709
710
711
712
713
714
715
716
    if (! ($swapreqs=="" || $swapreqs==0)) {
	echo "<tr>
            <td>Swap Requests: </td>
            <td class=\"left\">$swapreqs</td>
          </tr>\n";

	echo "<tr>
            <td>Last Swap Req.: </td>
            <td class=\"left\">$lastswapreq</td>
          </tr>\n";
    }
    
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
    if ($batchmode) {
	    echo "<tr>
                    <td>Batch Mode: </td>
                    <td class=\"left\">Yes</td>
                  </tr>\n";

	    echo "<tr>
                    <td>Batch Status: </td>
                    <td class=\"left\">$batchstate</td>
                  </tr>\n";

	    echo "<tr>
                    <td>Start Attempts: </td>
                    <td class=\"left\">$attempts</td>
                  </tr>\n";
    }

734
735
736
    echo "</table>\n";
}

737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
#
# Show a listing of experiments by user/pid/gid
#
function SHOWEXPLIST($type,$id) {
    if ($type == "USER") {
	$where = "expt_head_uid='$id'";
	$title = "Current";
    } elseif ($type == "PROJ") {
	$where = "e.pid='$id'";
	$title = "Project";
	$nopid = 1;
    } elseif ($type == "GROUP") {
	$where = "e.gid='$id'";
	$title = "Group";
	$nopid = 1;
    } else {
	$where = "e.eid='$id'";
	$title = "Bad id '$id'!";
    }
    
    $query_result =
	DBQueryFatal("select e.*,count(r.node_id) as nodes, ".
		     "round(minimum_nodes+.1,0) as min_nodes ".
		     "from experiments as e ".
		     "left join reserved as r on e.pid=r.pid and e.eid=r.eid ".
		     "where $where ".
		     "group by e.pid,e.eid order by e.state,e.eid");
    
    if (mysql_num_rows($query_result)) {
	echo "<center>
          <h3>$title Experiments</h3>
          </center>
          <table align=center border=1 cellpadding=2 cellspacing=2>\n";

	if ($nopid) {
	    $pidrow="";
	} else {
	    $pidrow="\n<th>PID</th>";
	}
	
	echo "<tr>$pidrow
              <th>EID</th>
              <th>State</th>
780
781
              <th align=center>Nodes [1]</th>
              <th align=center>Hours Idle [2]</th>
782
783
784
              <th>Description</th>
          </tr>\n";

785
786
787
	$idlemark = "<b>*</b>";
	$stalemark = "<b>?</b>";
	
788
789
790
791
792
793
794
	while ($row = mysql_fetch_array($query_result)) {
	    $pid  = $row[pid];
	    $eid  = $row[eid];
	    $state= $row[state];
	    $nodes= $row["nodes"];
	    $minnodes = $row["min_nodes"];
	    $idlehours = TBGetExptIdleTime($pid,$eid);
795
796
	    $stale = TBGetExptIdleStale($pid,$eid);
	    $ignore = $row["idle_ignore"];
797
798
	    $name = stripslashes($row[expt_name]);
	    if ($nodes==0) {
799
		$nodes = "<font color=green>$minnodes</font>";
800
801
	    } elseif ($row[swap_requests] > 0) {
		$nodes .= $idlemark;
802
803
804
805
806
807
808
809
	    }

	    if ($nopid) {
		$pidrow="";
	    } else {
		$pidrow="\n<td>".
		    "<A href='showproject.php3?pid=$pid'>$pid</A></td>";
	    }
810
811
812
813
814
815

	    $idlestr = $idlehours;
	    if ($idlehours > 0) {
		if ($stale) { $idlestr .= $stalemark; }
		if ($ignore) { $idlestr = "($idlestr)"; $parens=1; }
	    } elseif ($idlehours == -1) { $idlestr = "&nbsp;"; }
816
817
818
819
820
	    
	    echo "<tr>$pidrow
                 <td><A href='showexp.php3?pid=$pid&eid=$eid'>$eid</A></td>
		 <td>$state</td>
                 <td align=center>$nodes</td>
821
                 <td align=center>$idlestr</td>
822
823
824
825
                 <td>$name</td>
             </tr>\n";
	}
	echo "</table>\n";
826
827
828
	echo "<table align=center cellpadding=0 class=stealth><tr>\n".
	    "<td class=stealth align=left><font size=-1><ol>\n".
	    "<li>Node counts in <font color=green><b>green</b></font>\n".
829
	    "show a rough estimate of the minimum number of \n".
830
831
832
833
834
835
836
837
838
839
840
841
	    "nodes <br>required to swap in.\n".
	    "They account for delay nodes, but not for node types, etc.\n".
	    "<li>A $stalemark indicates that the data is stale, and ".
	    "at least one node in the experiment has not <br>reported ".
	    "on its proper schedule.\n"; 
	if ($parens) {
            # don't show this unless we did it... most users shouldn't ever
	    # need to know that some expts have their idleness ignored
	    echo "Values are in parenthesis for idle-ignore experiments.\n";
	}
	echo "</ol></font></td></tr></table>\n";

842
843
844
    }   
}

845
846
847
848
849
#
# Show Node information for an experiment.
#
function SHOWNODES($pid, $eid) {
    global $TBDBNAME;
850
    global $TBOPSPID;
851
852
853
    global $altnodesort;
    global $SCRIPT_NAME;
    
854
855
856
    $reserved_result =
	DBQueryFatal("SELECT * FROM reserved WHERE ".
		     "eid='$eid' and pid='$pid'");
857
    
858
859
860
861
    # If this is an expt in emulab-ops, we don't care about vname,
    # since it won't be defined. But we do want to know when the node
    # entered the experiment, since it won't match the experiment's
    # swapin date.
862
863
    $nodename="<a href=\"$SCRIPT_NAME?pid=$pid&eid=$eid&altnodesort=1\">".
	"Node Name</a>";
864
865
    $vnamefield="vname";
    if (!strcmp($pid, $TBOPSPID)) {
866
867
      $nodename="<a href=\"$SCRIPT_NAME?pid=$pid&eid=$eid&altnodesort=2\">".
	  "Reserve Time</a>";
868
      $vnamefield="rsrvtime";
869
      if (!isset($altnodesort)) { $altnodesort = 2; }
870
    }
871

872
    if (mysql_num_rows($reserved_result)) {
873
874
875

	if (!isset($altnodesort)) { $altnodesort = 1; }
	
876
877
878
879
880
	echo "<center>
              <h3>Reserved Nodes</h3>
              </center>
              <table align=center border=1>
              <tr>
881
882
                <th><a href=\"$SCRIPT_NAME?pid=$pid&eid=$eid&altnodesort=0\">".
	            "Node ID</a></th>
Chad Barb's avatar
   
Chad Barb committed
883
884
                <th>$nodename</th>
                <th>Type</th>
885
886
                <th>Default OSID</th>
                <th>Node<br>Status</th>
887
                <th>Hours<br>Idle</th>
888
889
                <th>Startup<br>Status[<b>1</b>]</th>
                <th>Ready<br>Status[<b>2</b>]</th>
890
              </tr>\n";
891
892
893
894

	$sort = "type,priority";
	if ($altnodesort==1) {
	    $sort = "vname";
895
896
	} elseif ($altnodesort==2) {
	    $sort = "rsrvtime";
897
898
	} # Can add other alt sorts here too
	
899
	
900
	$query_result =
901
	    DBQueryFatal("SELECT nodes.*,reserved.*,ns.status as nodestatus, ".
902
	        "date_format(rsrv_time,\"%Y-%m-%d&nbsp;%T\") as rsrvtime ".
903
904
905
	        "FROM nodes LEFT JOIN node_activity ".
		"on nodes.node_id=node_activity.node_id ".
		"LEFT JOIN reserved ON nodes.node_id=reserved.node_id ".
906
		"LEFT JOIN node_status as ns ON ns.node_id=nodes.node_id ".
907
	        "WHERE reserved.eid=\"$eid\" and reserved.pid=\"$pid\" ".
908
	        "ORDER BY $sort");
909
910
911

	while ($row = mysql_fetch_array($query_result)) {
	    $node_id = $row[node_id];
912
	    $vname   = $row[$vnamefield];
913
	    $type    = $row[type];
914
915
916
	    $def_boot_osid = $row[def_boot_osid];
	    $startstatus   = $row[startstatus];
	    $readystatus   = $row[ready];
917
	    $status        = $row[nodestatus];
918
	    $bootstate     = $row[eventstate];
919
	    $idlehrs       = TBGetNodeIdleTime($node_id);
920

921
922
	    if (!$vname)
		$vname = "--";
923
924
925
926
	    if ($readystatus)
		$readylabel = "Yes";
	    else
		$readylabel = "No";
927
928

	    echo "<tr>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
929
930
                    <td><A href='shownode.php3?node_id=$node_id'>$node_id</a>
                        </td>
931
                    <td>$vname</td>
932
                    <td>$type</td>\n";
933
934
935
936
937
	    if ($def_boot_osid) {
		echo "<td>";
		SPITOSINFOLINK($def_boot_osid);
		echo "</td>";
	    }
938
939
	    else
		echo "<td>&nbsp</td>\n";
940
941
942
943
944
945

	    if ($bootstate != "ISUP") {
		echo "  <td>$status ($bootstate)</td>\n";
	    } else {
		echo "  <td>$status</td>\n";
	    }
946
	    
947
	    echo "  <td>$idlehrs</td>
948
                    <td align=center>$startstatus</td>
949
                    <td align=center>$readylabel</td>
950
                   </tr>\n";
951
952
	}
	echo "</table>\n";
953
954
955
	echo "<h4><blockquote><blockquote><blockquote>
              <ol>
                <li>Exit value of the node startup command. A value of
956
                        666 indicates a testbed internal error.
957
958
959
                <li>User application ready status, reported via TMCC.
              </ol>
              </blockquote></blockquote></blockquote></h4>\n";
960
961
962
    }
}

963
964
965
966
967
968
#
# Show OS INFO record.
#
function SHOWOSINFO($osid) {
    global $TBDBNAME;
		
969
970
    $query_result =
	DBQueryFatal("SELECT * FROM os_info WHERE osid='$osid'");
971
972
973

    $osrow = mysql_fetch_array($query_result);

Leigh B. Stoller's avatar
Leigh B. Stoller committed
974
    $os_description = stripslashes($osrow[description]);
975
976
977
978
979
    $os_OS          = $osrow[OS];
    $os_version     = $osrow[version];
    $os_path        = $osrow[path];
    $os_magic       = $osrow[magic];
    $os_osfeatures  = $osrow[osfeatures];
980
    $os_op_mode     = $osrow[op_mode];
981
    $os_pid         = $osrow[pid];
982
983
    $os_shared      = $osrow[shared];
    $os_osname      = $osrow[osname];
984
985
    $creator        = $osrow[creator];
    $created        = $osrow[created];
986
    $mustclean      = $osrow[mustclean];
987
    $nextosid       = $osrow[nextosid];
988
989
990
991
992
993
994
995
996
997
998

    if (!$os_description)
	$os_description = "&nbsp";
    if (!$os_version)
	$os_version = "&nbsp";
    if (!$os_path)
	$os_path = "&nbsp";
    if (!$os_magic)
	$os_magic = "&nbsp";
    if (!$os_osfeatures)
	$os_osfeatures = "&nbsp";
999
1000
    if (!$os_op_mode)
	$os_op_mode = "&nbsp";
1001
1002
    if (!$created)
	$created = "N/A";
1003
1004
1005
1006
1007
1008
1009

    #
    # Generate the table.
    #
    echo "<table align=center border=1>\n";

    echo "<tr>
1010
1011
1012
1013
1014
1015
            <td>Name: </td>
            <td class=\"left\">$os_osname</td>
          </tr>\n";

    echo "<tr>
            <td>Project: </td>
1016
1017
            <td class=\"left\">
              <a href='showproject.php3?pid=$os_pid'>$os_pid</a></td>
1018
1019
          </tr>\n";

1020
1021
    echo "<tr>
            <td>Creator: </td>
1022
1023
            <td class=left>
              <a href='showuser.php3?target_uid=$creator'>$creator</a></td>
1024
1025
1026
1027
1028
1029
1030
 	  </tr>\n";

    echo "<tr>
            <td>Created: </td>
            <td class=left>$created</td>
 	  </tr>\n";

1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
    echo "<tr>
            <td>Description: </td>
            <td class=\"left\">$os_description</td>
          </tr>\n";

    echo "<tr>
            <td>Operating System: </td>
            <td class=\"left\">$os_OS</td>
          </tr>\n";

    echo "<tr>
            <td>Version: </td>
            <td class=\"left\">$os_version</td>
          </tr>\n";

    echo "<tr>
            <td>Path: </td>
            <td class=\"left\">$os_path</td>
          </tr>\n";

    echo "<tr>
            <td>Magic (uname -r -s): </td>
            <td class=\"left\">$os_magic</td>
          </tr>\n";

    echo "<tr>
1057
1058
            <td>Features: </td>
            <td class=\"left\">$os_osfeatures</td>
1059
1060
          </tr>\n";

1061
1062
1063
1064
1065
    echo "<tr>
            <td>Operational Mode: </td>
            <td class=\"left\">$os_op_mode</td>
          </tr>\n";

1066
    echo "<tr>
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
            <td>Shared?: </td>
            <td class=left>\n";

    if ($os_shared)
	echo "Yes";
    else
	echo "No";
    
    echo "  </td>
          </tr>\n";

1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
    echo "<tr>
            <td>Must Clean?: </td>
            <td class=left>\n";

    if ($mustclean)
	echo "Yes";
    else
	echo "No";
    
    echo "  </td>
          </tr>\n";

1090
1091
1092
1093
1094
1095
1096
1097
    if ($nextosid) {
	echo "<tr>
                <td>Next Osid: </td>
                <td class=left>
                    <A href='showosinfo.php3?osid=$nextosid'>$nextosid</A></td>
              </tr>\n";
    }

1098
1099
1100
    echo "<tr>
            <td>Internal ID: </td>
            <td class=\"left\">$osid</td>
1101
1102
1103
1104
1105
          </tr>\n";

    echo "</table>\n";
}

1106
1107
1108
#
# Show ImageID record.
#
1109
function SHOWIMAGEID($imageid, $edit, $isadmin = 0) {
1110
1111
    global $TBDBNAME;
		
1112
1113
    $query_result =
	DBQueryFatal("select * from images where imageid='$imageid'");
1114
1115
1116

    $row = mysql_fetch_array($query_result);

1117
1118
    $imagename   = $row[imagename];
    $pid         = $row[pid];
1119
    $gid         = $row[gid];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1120
    $description = stripslashes($row[description]);
1121
1122
1123
1124
1125
1126
1127
1128
1129
    $loadpart	 = $row[loadpart];
    $loadlength	 = $row[loadlength];
    $part1_osid	 = $row[part1_osid];
    $part2_osid	 = $row[part2_osid];
    $part3_osid	 = $row[part3_osid];
    $part4_osid	 = $row[part4_osid];
    $default_osid= $row[default_osid];
    $path 	 = $row[path];
    $loadaddr	 = $row[load_address];
1130
    $shared	 = $row[shared];
1131
    $globalid	 = $row["global"];
1132
1133
    $creator     = $row[creator];
    $created     = $row[created];
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149

    if ($edit) {
	if (!$description)
	    $description = "";
	if (!$path)
	    $path = "";
	if (!$loadaddr)
	    $loadaddr = "";
    }
    else {
	if (!$description)
	    $description = "&nbsp";
	if (!$path)
	    $path = "&nbsp";
	if (!$loadaddr)
	    $loadaddr = "&nbsp";
1150
1151
	if (!$created)
	    $created = "N/A";
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
    }
    
    #
    # Generate the table.
    #
    echo "<table align=center border=2 cellpadding=2 cellspacing=2>\n";

    if ($edit) {
	$imageid_encoded = rawurlencode($imageid);
	
	echo "<form action='editimageid.php3?imageid=$imageid_encoded'
                    method=post>\n";
    }

    echo "<tr>
1167
1168
1169
1170
1171
1172
            <td>Image Name: </td>
            <td class=\"left\">$imagename</td>
          </tr>\n";

    echo "<tr>
            <td>Project: </td>
1173
1174
            <td class=\"left\">
              <a href='showproject.php3?pid=$pid'>$pid</a></td>
1175
          </tr>\n";
1176

1177
1178
1179
1180
1181
1182
    echo "<tr>
              <td>Group: </td>
              <td class=\"left\">
                <a href='showgroup.php3?pid=$pid&gid=$gid'>$gid</a></td>
          </tr>\n";
    
1183
1184
1185
1186
1187
1188
1189
1190
1191
    echo "<tr>
            <td>Creator: </td>
            <td class=left>$creator</td>
 	  </tr>\n";

    echo "<tr>
            <td>Created: </td>
            <td class=left>$created</td>
 	  </tr>\n";
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218

    echo "<tr>
            <td>Description: </td>
            <td class=left>\n";

    if ($edit) {
	echo "<input type=text name=description size=60
                     maxlength=256 value='$description'>";
    }
    else {
	echo "$description";
    }
    echo "   </td>
 	  </tr>\n";

    echo "<tr>
            <td>Load Partition: </td>
            <td class=\"left\">$loadpart</td>
          </tr>\n";

    echo "<tr>
            <td>Load Length: </td>
            <td class=\"left\">$loadlength</td>
          </tr>\n";

    if ($part1_osid) {
	echo "<tr>
1219
1220
1221
1222
                 <td>Partition 1 OS: </td>
                 <td class=\"left\">";
	SPITOSINFOLINK($part1_osid);
	echo "   </td>
1223
1224
1225
1226
1227
              </tr>\n";
    }

    if ($part2_osid) {
	echo "<tr>
1228
1229
1230
1231
                 <td>Partition 2 OS: </td>
                 <td class=\"left\">";
	SPITOSINFOLINK($part2_osid);
	echo "   </td>
1232
1233
1234
1235
1236
              </tr>\n";
    }

    if ($part3_osid) {
	echo "<tr>
1237
1238
1239
1240
                 <td>Partition 3 OS: </td>
                 <td class=\"left\">";
	SPITOSINFOLINK($part3_osid);
	echo "   </td>
1241
1242
1243
1244
1245
              </tr>\n";
    }

    if ($part4_osid) {
	echo "<tr>
1246
1247
1248
1249
                 <td>Partition 4 OS: </td>
                 <td class=\"left\">";
	SPITOSINFOLINK($part4_osid);
	echo "   </td>
1250
1251
1252
1253
1254
              </tr>\n";
    }

    if ($default_osid) {
	echo "<tr>
1255
1256
1257
1258
                 <td>Boot OS: </td>
                 <td class=\"left\">";
	SPITOSINFOLINK($default_osid);
	echo "   </td>
1259
1260
1261
1262
              </tr>\n";
    }

    echo "<tr>
1263
            <td>Filename: </td>
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
            <td class=left>\n";

    if ($edit) {
	echo "<input type=text name=path size=60
                     maxlength=256 value='$path'>";
    }
    else {
	echo "$path";
    }
    echo "  </td>
          </tr>\n";

1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
    if (! $edit) {
	echo "<tr>
                  <td>Types: </td>
                  <td class=left>\n";

	$types_result =
	    DBQueryFatal("select distinct type from osidtoimageid ".
			 "where imageid='$imageid'");

	if (mysql_num_rows($types_result)) {
	    while ($row = mysql_fetch_array($types_result)) {
		$type = $row[type];
		echo "$type &nbsp ";
	    }
	}
	else {
	    echo "&nbsp";
	}
	echo "  </td>
              </tr>\n";
    }

    echo "<tr>
            <td>Shared?: </td>
            <td class=left>\n";

    if ($shared)
	echo "Yes";
    else
	echo "No";
    
    echo "  </td>
          </tr>\n";

1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
    echo "<tr>
            <td>Global?: </td>
            <td class=left>\n";

    if ($globalid)
	echo "Yes";
    else
	echo "No";
    
    echo "  </td>
          </tr>\n";

1322
1323
1324
1325
1326
    echo "<tr>
            <td>Internal ID: </td>
            <td class=left>$imageid</td>
          </tr>\n";

1327
1328
1329
1330
    echo "<tr>
            <td>Load Address: </td>
            <td class=left>\n";

1331
    if ($edit && $isadmin) {
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
	echo "<input type=text name=loadaddr size=20
                     maxlength=256 value='$loadaddr'>";
    }
    else {
	echo "$loadaddr";
    }
    echo "  </td>
          </tr>\n";

    if ($edit) {
	echo "<tr>
                 <td colspan=2 align=center>
                     <b><input type=submit value=Submit></b>
                 </td>
              </tr>
              </form>\n";
    }

    echo "</table>\n";
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
1353
1354
1355
1356
1357
#
# Show node record.
#
function SHOWNODE($node_id) {
    $query_result =
1358
1359
1360
	DBQueryFatal("select n.*,na.*,r.vname,r.pid,r.eid,i.IP, ".
		     "greatest(last_tty_act,last_net_act,last_cpu_act,".
		     "last_ext_act) as last_act, ".
1361
1362
		     " t.isvirtnode,t.isremotenode ".
		     " from nodes as n ".
1363
		     "left join reserved as r on n.node_id=r.node_id ".
1364
		     "left join node_activity as na on n.node_id=na.node_id ".
1365
1366
1367
		     "left join node_types as t on t.type=n.type ".
		     "left join interfaces as i on i.card=t.control_net ".
		     " and i.node_id=n.node_id ".
1368
		     "where n.node_id='$node_id'");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1369
1370
1371
1372
1373
1374
1375
    
    if (mysql_num_rows($query_result) == 0) {
	TBERROR("The node $node_id is not a valid nodeid!", 1);
    }
		
    $row = mysql_fetch_array($query_result);

1376
    $phys_nodeid        = $row[phys_nodeid]; 
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1377
    $type               = $row[type];
1378
    $vname		= $row[vname];
1379
1380
    $pid 		= $row[pid];
    $eid		= $row[eid];
1381
    $bios               = $row[bios_version];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1382
1383
1384
1385
1386
1387
1388
1389
1390
    $def_boot_osid      = $row[def_boot_osid];
    $def_boot_path      = $row[def_boot_path];
    $def_boot_cmd_line  = $row[def_boot_cmd_line];
    $next_boot_osid     = $row[next_boot_osid];
    $next_boot_path     = $row[next_boot_path];
    $next_boot_cmd_line = $row[next_boot_cmd_line];
    $rpms               = $row[rpms];
    $tarballs           = $row[tarballs];
    $startupcmd         = $row[startupcmd];
1391
    $routertype         = $row[routertype];
1392
1393
    $eventstate         = $row[eventstate];
    $state_timestamp    = $row[state_timestamp];
1394
1395
    $allocstate         = $row[allocstate];
    $allocstate_timestamp= $row[allocstate_timestamp];
1396
1397
    $op_mode            = $row[op_mode];
    $op_mode_timestamp  = $row[op_mode_timestamp];
1398
    $IP                 = $row[IP];
1399
1400
1401
1402
1403
    $isvirtnode         = $row[isvirtnode];
    $isremotenode       = $row[isremotenode];
    $ipport_low		= $row[ipport_low];
    $ipport_next	= $row[ipport_next];
    $ipport_high	= $row[ipport_high];
1404
1405
1406
1407
1408
1409
1410
    $last_act           = $row[last_act];
    $last_tty_act       = $row[last_tty_act];
    $last_net_act       = $row[last_net_act];
    $last_cpu_act       = $row[last_cpu_act];
    $last_ext_act       = $row[last_ext_act];
    $last_report        = $row[last_report];
    
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
    if (!$def_boot_cmd_line)
	$def_boot_cmd_line = "&nbsp";
    if (!$def_boot_path)
	$def_boot_path = "&nbsp";
    if (!$next_boot_path)
	$next_boot_path = "&nbsp";
    if (!$next_boot_cmd_line)
	$next_boot_cmd_line = "&nbsp";
    if (!$rpms)
	$rpms = "