GeniSliver.pm.in 13.4 KB
Newer Older
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2008 University of Utah and the Flux Group.
# All rights reserved.
#
package GeniSliver;

#
use strict;
use Exporter;
use vars qw(@ISA @EXPORT);

@ISA    = "Exporter";
@EXPORT = qw ( );

# Must come after package declaration
use lib '@prefix@/lib';
use GeniDB;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
20
21
use GeniComponent;
use GeniCredential;
22
use GeniCertificate;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
23
use GeniAggregate;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
24
25
26
# Hate to import all this crap; need a utility library.
use libdb qw(TBGetUniqueIndex);
use libtestbed;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
27
28
use Experiment;
use Node;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
29
30
31
use English;
use Data::Dumper;
use File::Temp qw(tempfile);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
32
use overload ('""' => 'Stringify');
Leigh B. Stoller's avatar
Leigh B. Stoller committed
33
34
35
36
37
38
39
40
41

# Configure variables
my $TB		   = "@prefix@";
my $TBOPS          = "@TBOPSEMAIL@";
my $TBAPPROVAL     = "@TBAPPROVALEMAIL@";
my $TBAUDIT   	   = "@TBAUDITEMAIL@";
my $BOSSNODE       = "@BOSSNODE@";
my $OURDOMAIN      = "@OURDOMAIN@";
my $SIGNCRED	   = "$TB/sbin/signgenicred";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
42
43
44
my $AVAIL	   = "$TB/sbin/avail";
my $NALLOC	   = "$TB/bin/nalloc";
my $NFREE	   = "$TB/bin/nfree";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
45
my $NODEREBOOT	   = "$TB/bin/node_reboot";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
46
47
48
49
50
51
52
53
54
55
56

# Cache of instances to avoid regenerating them.
my %slivers      = ();

#
# Lookup by idx, or uuid.
#
sub Lookup($$)
{
    my ($class, $token) = @_;
    my $query_result;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
57
    my $idx;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
58
59

    if ($token =~ /^\d+$/) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
60
	$idx = $token;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
61
62
63
    }
    elsif ($token =~ /^\w+\-\w+\-\w+\-\w+\-\w+$/) {
	$query_result =
Leigh B. Stoller's avatar
Leigh B. Stoller committed
64
	    DBQueryWarn("select idx from geni_slivers ".
Leigh B. Stoller's avatar
Leigh B. Stoller committed
65
			"where uuid='$token'");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
66
67
68
69
	    return undef
		if (! $query_result || !$query_result->numrows);

	    ($idx) = $query_result->fetchrow_array();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
70
71
72
73
    }
    else {
	return undef;
    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
74
75
76
77
78
79
80
81

    # Look in cache first
    return $slivers{"$idx"}
        if (exists($slivers{"$idx"}));

    $query_result = DBQueryWarn("select * from geni_slivers ".
				"where idx='$idx'");

Leigh B. Stoller's avatar
Leigh B. Stoller committed
82
83
84
    return undef
	if (!$query_result || !$query_result->numrows);

Leigh B. Stoller's avatar
Leigh B. Stoller committed
85
86
87
88
    my $self              = {};
    $self->{'SLIVER'}     = $query_result->fetchrow_hashref();
    $self->{'COMPONENT'}  = undef;	# Client side.
    $self->{'CREDENTIAL'} = undef;	# Client side.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
89
    $self->{'AGGREGATE'}  = undef;	# server side.
90
91
92
93
94
95
96
97
98
99
100

    #
    # Grab the certificate, since we will probably want it.
    #
    my $uuid = $self->{'SLIVER'}->{'uuid'};
    my $certificate = GeniCertificate->Lookup($uuid);
    if (!defined($certificate)) {
	print STDERR "Could not find certificate for sliver $idx ($uuid)\n";
	return undef;
    }
    $self->{'CERTIFICATE'} = $certificate;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
    bless($self, $class);
    
    # Add to cache. 
    $slivers{$self->{'SLIVER'}->{'idx'}} = $self;
    
    return $self;
}

#
# Stringify for output.
#
sub Stringify($)
{
    my ($self) = @_;
    
    my $uuid = $self->uuid();
    my $idx  = $self->idx();

    return "[GeniSliver: $uuid, IDX: $idx]";
}

#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
123
# Create a sliver record in the DB. On the client side we save the credential
Leigh B. Stoller's avatar
Leigh B. Stoller committed
124
# that allows control of it, for later operations.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
125
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
126
sub Create($$$;$$)
Leigh B. Stoller's avatar
Leigh B. Stoller committed
127
{
Leigh B. Stoller's avatar
Leigh B. Stoller committed
128
    my ($class, $slice, $user, $resource_uuid, $credential, $component) = @_;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
129
    my @insert_data = ();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
130
    my $uuid;
131
    my $certificate;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
132
133
134

    # Every sliver gets a new unique index.
    my $idx = TBGetUniqueIndex('next_sliver', 1);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
135
    if (defined($credential)) {
136
137
138
139
140
141
	# Store the certificate for later use.
	$certificate = GeniCertificate->StorePublic($credential->this_cert());
	if (!defined($certificate)) {
	    print STDERR "Could not store certificate\n";
	    return undef;
	}
Leigh B. Stoller's avatar
Leigh B. Stoller committed
142
143
144
145
146
147
148
	$uuid = $credential->this_uuid();

	# Store the credential
	return undef
	    if ($credential->Store() != 0);
    }
    else {
149
150
151
152
	# Create a cert pair, which gives us a new uuid.
	$certificate = GeniCertificate->Create("sliver");
	if (!defined($certificate)) {
	    print STDERR "Could not generate new certificate and UUID!\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
153
154
	    return undef;
	}
155
	$uuid = $certificate->uuid();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
156
    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
157
158
    my $slice_uuid     = $slice->uuid();
    my $owner_uuid     = $user->uuid();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
159
160
161
162
163

    # Now tack on other stuff we need.
    push(@insert_data, "created=now()");
    push(@insert_data, "idx='$idx'");
    push(@insert_data, "uuid='$uuid'");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
164
165
    push(@insert_data, "resource_uuid='$resource_uuid'")
	if (defined($resource_uuid));
Leigh B. Stoller's avatar
Leigh B. Stoller committed
166
167
168
    push(@insert_data, "creator_uuid='$owner_uuid'");
    push(@insert_data, "slice_uuid='$slice_uuid'");

Leigh B. Stoller's avatar
Leigh B. Stoller committed
169
170
171
172
    # Only on the client side.
    push(@insert_data, "credential_idx=" . $credential->idx())
	if (defined($credential));
    # Only on the client side.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
173
174
    push(@insert_data, "component_idx=" . $component->idx())
	if (defined($component));
Leigh B. Stoller's avatar
Leigh B. Stoller committed
175

Leigh B. Stoller's avatar
Leigh B. Stoller committed
176
    # Insert into DB.
177
178
179
    if (!DBQueryWarn("insert into geni_slivers set " .
		     join(",", @insert_data))) {
	$certificate->Delete();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
180
181
182
	return undef;
    }

Leigh B. Stoller's avatar
Leigh B. Stoller committed
183
184
185
    my $sliver = GeniSliver->Lookup($idx);
    return undef
	if (!defined($sliver));
Leigh B. Stoller's avatar
Leigh B. Stoller committed
186
187
188
    
    $sliver->{'CREDENTIAL'} = $credential
	if (defined($credential));
Leigh B. Stoller's avatar
Leigh B. Stoller committed
189
190
191
    $sliver->{'COMPONENT'} = $component
	if (defined($component));
    $sliver->{'AGGREGATE'} = undef;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
192
193

    return $sliver;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
194
195
196
197
198
199
200
201
}
# accessors
sub field($$) { return ((! ref($_[0])) ? -1 : $_[0]->{'SLIVER'}->{$_[1]}); }
sub idx($)		{ return field($_[0], "idx"); }
sub uuid($)		{ return field($_[0], "uuid"); }
sub slice_uuid($)	{ return field($_[0], "slice_uuid"); }
sub creator_uuid($)	{ return field($_[0], "creator_uuid"); }
sub created($)		{ return field($_[0], "created"); }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
202
sub credential_idx($)	{ return field($_[0], "credential_idx"); }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
203
sub resource_uuid($)	{ return field($_[0], "resource_uuid"); }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
204
205
sub ticket_idx($)	{ return field($_[0], "ticket_idx"); }
sub component_idx($)	{ return field($_[0], "component_idx"); }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
206
207
sub aggregate_idx($)	{ return field($_[0], "aggregate_idx"); }
sub status($)		{ return field($_[0], "status"); }
208
209
sub cert($)		{ return $_[0]->{'CERTIFICATE'}->cert(); }
sub GetCertificate($)   { return $_[0]->{'CERTIFICATE'}; }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
210
211
212
213
214
215
216
217
218
219
220

#
# Delete the sliver. The sliver should not be provisioned when this done.
#
sub Delete($)
{
    my ($self) = @_;

    return -1
	if (! ref($self));

221
222
    my $idx  = $self->idx();
    my $uuid = $self->uuid();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
223

224
225
226
227
    DBQueryWarn("delete from geni_credentials where this_uuid='$uuid'")
	or return -1;
    DBQueryWarn("delete from geni_certificates where uuid='$uuid'")
	or return -1;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
228
229
230
231
232
233
    DBQueryWarn("delete from geni_slivers where idx='$idx'")
	or return -1;
    
    return 0;
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
#
# Set the aggregate for a sliver.
#
sub SetAggregate($$)
{
    my ($self, $aggregate) = @_;

    return -1
	if (! (ref($self) && ref($aggregate)));

    my $idx     = $self->idx();
    my $agg_idx = $aggregate->idx();

    return -1
	if (!DBQueryWarn("update geni_slivers set ".
			 "  aggregate_idx='$agg_idx' ".
			 "where idx='$idx'"));
    
    $self->{'SLIVER'}->{'aggregate_idx'} = $agg_idx;
    $self->{'AGGREGATE'} = $aggregate;
    return 0;
}

#
# Get the aggregate for a sliver.
#
sub GetAggregate($)
{
    my ($self) = @_;

    return undef
	if (! ref($self));

    return $self->{'AGGREGATE'} if (defined($self->{'AGGREGATE'}));
    return undef
	if (!defined($self->aggregate_idx()));

    my $aggregate = GeniAggregate->Lookup($self->aggregate_idx());
    if (!defined($aggregate)) {
	print STDERR "Could not get aggregate object associated with $self\n";
	return undef;
    }
    $self->{'AGGREGATE'} = $aggregate;
    return $aggregate;
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
280
281
282
283
284
285
286
287
288
289
290
291
292
#
# Get the experiment for the slice this sliver belongs to.
#
sub GetExperiment($)
{
    my ($self) = @_;

    return undef
	if (! ref($self));

    return Experiment->Lookup($self->slice_uuid());
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
293
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
294
# Get the credential for the sliver.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
295
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
296
sub GetCredential($)
Leigh B. Stoller's avatar
Leigh B. Stoller committed
297
298
299
300
301
302
{
    my ($self) = @_;

    return undef
	if (! ref($self));

Leigh B. Stoller's avatar
Leigh B. Stoller committed
303
304
305
306
307
308
309
310
311
    return $self->{'CREDENTIAL'} if (defined($self->{'CREDENTIAL'}));

    if (!defined($self->credential_idx())) {
	print STDERR "No credential associated with $self\n";
	return undef;
    }
    my $credential = GeniCredential->Lookup($self->credential_idx());
    if (!defined($credential)) {
	print STDERR "Could not get credential object associated with $self\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
312
313
	return undef;
    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
    $self->{'CREDENTIAL'} = $credential;
    return $credential;
}

#
# Get the component for the sliver.
#
sub GetComponent($)
{
    my ($self) = @_;

    return undef
	if (! ref($self));

    return $self->{'COMPONENT'} if (defined($self->{'COMPONENT'}));

    if (!defined($self->component_idx())) {
	print STDERR "No component associated with $self\n";
	return undef;
    }
    my $component = GeniComponent->Lookup($self->component_idx());
    if (!defined($component)) {
	print STDERR "Could not get component object associated with $self\n";
	return undef;
    }
    $self->{'COMPONENT'} = $component;
    return $component;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
341
342
}

343
344
345
346
347
348
349
350
351
352
353
354
#
# Client side method to contact the sliver component and destroy it.
#
sub Destroy($$)
{
    my ($self, $user) = @_;

    return -1
	if (! ref($self));

    my $component = $self->GetComponent();
    return -1
Leigh B. Stoller's avatar
Leigh B. Stoller committed
355
	if (!defined($component));
356
357
358
359
360
361
362
363
364
365
366

    return -1
	if ($component->DestroySliver($self, $user) != 0);

    # Delete the local object from the DB.
    $self->Delete() == 0
	or return -1;

    return 0;
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
#
# Client side method to contact the sliver component and start it.
#
sub Start($$)
{
    my ($self, $user) = @_;

    return -1
	if (! ref($self));

    my $component = $self->GetComponent();
    return -1
	if (!defined($component));

    return -1
	if ($component->StartSliver($self, $user) != 0);

    return 0;
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
387
388
389
390
391
#
# Provision a slice. We actually did this when the ticket was requested.
#
sub Provision($)
{
Leigh B. Stoller's avatar
Leigh B. Stoller committed
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
    my ($self) = @_;

    return -1
	if (! ref($self));

    #
    # the node is already allocated to the sliver, but still need to enter
    # a virt_nodes entry, and possibly more virt table entries, so that the
    # node will boot properly, and is otherwie controllable.
    #
    my $experiment = Experiment->Lookup($self->slice_uuid());
    if (!defined($experiment)) {
	print STDERR "Could not map $self to its experiment\n";
	return -1;
    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
407
    my $resource_uuid = $self->resource_uuid();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
408
    return 0
Leigh B. Stoller's avatar
Leigh B. Stoller committed
409
410
	if (!defined($resource_uuid));
    my $node       = Node->Lookup($resource_uuid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
411
    if (!defined($node)) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
412
	print STDERR "Could not map node $resource_uuid to its object\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
413
414
415
416
417
418
419
420
421
422
423
424
	return -1;
    }
    my $reservation = $node->Reservation();
    if (!defined($reservation)) {
	print STDERR "$node was already released from $self\n";
	return -1;
    }
    if ($reservation->SameExperiment($experiment)) {
	if ($experiment->InsertVirtNode($node) != 0) {
	    print STDERR "Could not add virtnode entry for $node to $self\n";
	    return -1;
	}
Leigh B. Stoller's avatar
Leigh B. Stoller committed
425
426
427
428
	# Set sliver_idx in the reservation so that Emulab knows.
	if ($node->ModifyReservation({"genisliver_idx" => $self->idx()}) != 0){
	    return -1;
	}
Leigh B. Stoller's avatar
Leigh B. Stoller committed
429
430
431
432
433
434
    }
    else {
	print STDERR "$node is reserved to another, not $self\n";
	# Signal error so we can look at what happened.
	return -1;
    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
435
436
437
    return 0;
}

438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
#
# Create a signed credential for this sliver, issued to the provided user.
# The credential will grant all permissions for now.
#
# Should we store these credentials in the DB, recording what we hand out?
#
sub NewCredential($$)
{
    my ($self, $owner) = @_;

    return undef
	if (! (ref($self) && ref($owner)));

    my $credential = GeniCredential->Create($self, $owner);
    if (!defined($credential)) {
	print STDERR "Could not create credential for $self, $owner\n";
	return undef;
    }
    if ($credential->Sign($self->GetCertificate()) != 0) {
	print STDERR "Could not sign credential for $self, $owner\n";
	return undef;
    }
    return $credential;
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
463
464
465
466
467
468
469
470
471
472
473
#
# Unprovision a sliver. 
#
sub UnProvision($)
{
    my ($self) = @_;

    return -1
	if (! ref($self));

    my $experiment = Experiment->Lookup($self->slice_uuid());
Leigh B. Stoller's avatar
Leigh B. Stoller committed
474
475
476
477
    if (!defined($experiment)) {
	print STDERR "Could not map $self to its experiment\n";
	return -1;
    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
478
    my $resource_uuid = $self->resource_uuid();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
479
    return 0
Leigh B. Stoller's avatar
Leigh B. Stoller committed
480
481
	if (!defined($resource_uuid));
    my $node       = Node->Lookup($resource_uuid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
482
    if (!defined($node)) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
483
	print STDERR "Could not map node $resource_uuid to its object\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
484
485
486
487
488
489
490
491
	return -1;
    }
    my $reservation = $node->Reservation();
    if (!defined($reservation)) {
	print STDERR "$node was already released from $self\n";
	return 0;
    }
    if ($reservation->SameExperiment($experiment)) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
492
	my $node_id = $node->node_id();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
493
494
	my $pid = $experiment->pid();
	my $eid = $experiment->eid();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
495
496
497
498
499

	if ($experiment->DeleteVirtNode($node) != 0) {
	    print STDERR "Could remove virtnode entry for $node from $self\n";
	    return -1;
	}
Leigh B. Stoller's avatar
Leigh B. Stoller committed
500
	
Leigh B. Stoller's avatar
Leigh B. Stoller committed
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
	system("export NORELOAD=1; $NFREE -q $pid $eid $node_id");
	if ($?) {
	    print STDERR "Could not deallocate $node from $self\n";
	    return -1;
	}
    }
    else {
	print STDERR "$node is reserved to another, not $self\n";
	# Signal error so we can look at what happened.
	return -1;
    }
    return 0;
}

#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
516
# Start a sliver, which roughly translates to reboot the node.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
517
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
518
sub StartUp($)
Leigh B. Stoller's avatar
Leigh B. Stoller committed
519
520
521
522
523
524
525
526
527
528
529
{
    my ($self) = @_;

    return -1
	if (! ref($self));

    my $experiment = Experiment->Lookup($self->slice_uuid());
    if (!defined($experiment)) {
	print STDERR "Could not map $self to its experiment\n";
	return -1;
    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
530
    my $resource_uuid = $self->resource_uuid();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
531
    return 0
Leigh B. Stoller's avatar
Leigh B. Stoller committed
532
533
	if (!defined($resource_uuid));
    my $node       = Node->Lookup($resource_uuid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
534
    if (!defined($node)) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
535
	print STDERR "Could not map node $resource_uuid to its object\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
536
537
538
539
540
541
542
543
	return -1;
    }
    my $reservation = $node->Reservation();
    if (!defined($reservation)) {
	print STDERR "$node was already released from $self\n";
	return -1;
    }
    if ($reservation->SameExperiment($experiment)) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
544
	my $node_id = $node->node_id();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
545
546
547
	#
	# Reboot and wait?
	#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
548
	system("$NODEREBOOT $node_id");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
549
550
551
552
553
    }
    else {
	print STDERR "$node is reserved to another, not $self\n";
	# Signal error so we can look at what happened.
	return -1;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
554
555
556
    }
    return 0;
}
Leigh B. Stoller's avatar
Leigh B. Stoller committed
557

Leigh B. Stoller's avatar
Leigh B. Stoller committed
558

Leigh B. Stoller's avatar
Leigh B. Stoller committed
559
560
# _Always_ make sure that this 1 is at the end of the file...
1;