Commit 776fd069 authored by Mike Hibler's avatar Mike Hibler

By default, ignore SIGINT while allocating resources.

If they specify filesystem creation, it can take 5 minutes or longer
depending on the FS type and size. We print a warning about this.
parent 04c86c42
......@@ -503,8 +503,8 @@ sub UsingResources($) {
# Note that this could take a long time. It is up to the caller to lock
# the lease if atomicity is a concern.
#
sub AllocResources($;$) {
my ($self,$state) = @_;
sub AllocResources($;$$) {
my ($self,$state,$interruptable) = @_;
$state = "valid"
if (!defined($state));
......@@ -551,13 +551,34 @@ sub AllocResources($;$) {
$fstype = "";
}
#
# XXX hack, hack
# XXX this doesn't belong here
#
if ($fstype) {
print STDERR "NOTE: FS creation could take 5 minutes or longer, ";
if ($interruptable) {
print STDERR "please be patient!\n";
} else {
print STDERR "disabling SIGINT.\n";
}
}
#
# Call the blockstore control program to handle all things
# blockstore related (e.g., the actual allocation of storage
# on the storage servers).
#
my $idx = $self->lease_idx();
if (system("$BSCONTROL -l $idx -s $size $fstype create lease-$idx")) {
my $cmd = "$BSCONTROL -l $idx -s $size $fstype create lease-$idx";
my $rv;
if (!$interruptable) {
local $SIG{INT} = "IGNORE";
$rv = system($cmd);
} else {
$rv = system($cmd);
}
if ($rv) {
print STDERR "$self: AllocResources: could not allocate storage.\n";
$self->UpdateState("unapproved");
return LEASE_ERROR_FAILED();
......
......@@ -2748,6 +2748,11 @@ class createdataset:
self.usage();
return -1;
# Warn about filesystem creation
if params.has_key("fstype"):
print "WARNING: FS creation can take 5 minutes or longer, be patient!";
pass
# Send the rest of the args along as a list.
params["dataset"] = req_args[0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment