Commit f8a4a366 authored by Leigh B Stoller's avatar Leigh B Stoller

Add -a option to specify aggregate to use. Firewalling support;

if a profile is public, make sure all the nodes are firewalled.
parent cee38539
...@@ -39,12 +39,12 @@ use Data::Dumper; ...@@ -39,12 +39,12 @@ use Data::Dumper;
# #
sub usage() sub usage()
{ {
print "Usage: quickvm [-l] [-u uuid] <xmlfile>\n"; print "Usage: quickvm [-l] [-u uuid] [-a aggregate] <xmlfile>\n";
print "Usage: quickvm -k <uuid>\n"; print "Usage: quickvm -k <uuid>\n";
print "Usage: quickvm -e <seconds> <uuid>\n"; print "Usage: quickvm -e <seconds> <uuid>\n";
exit(1); exit(1);
} }
my $optlist = "dkve:lu:"; my $optlist = "dkve:lu:a:";
my $debug = 0; my $debug = 0;
my $verbose = 1; my $verbose = 1;
my $killit = 0; my $killit = 0;
...@@ -54,6 +54,7 @@ my $localuser = 0;; ...@@ -54,6 +54,7 @@ my $localuser = 0;;
my $xmlfile; my $xmlfile;
my $extend; my $extend;
my $quickuuid; my $quickuuid;
my $aggregate;
# Protos # Protos
sub fatal($); sub fatal($);
...@@ -101,6 +102,7 @@ use GeniAuthority; ...@@ -101,6 +102,7 @@ use GeniAuthority;
use GeniHRN; use GeniHRN;
use Genixmlrpc; use Genixmlrpc;
use GeniResponse; use GeniResponse;
use GeniXML;
# #
# Parse command arguments. Once we return from getopts, all that should be # Parse command arguments. Once we return from getopts, all that should be
...@@ -110,6 +112,9 @@ my %options = (); ...@@ -110,6 +112,9 @@ my %options = ();
if (! getopts($optlist, \%options)) { if (! getopts($optlist, \%options)) {
usage(); usage();
} }
if (defined($options{"a"})) {
$aggregate = $options{"a"};
}
if (defined($options{"d"})) { if (defined($options{"d"})) {
$debug = 1; $debug = 1;
} }
...@@ -211,7 +216,10 @@ Genixmlrpc->SetContext($context); ...@@ -211,7 +216,10 @@ Genixmlrpc->SetContext($context);
# #
my $CMURN; my $CMURN;
if ($utahddc) { if (defined($aggregate)) {
$CMURN = $aggregate;
}
elsif ($utahddc) {
$CMURN = $DDCURN; $CMURN = $DDCURN;
} }
else { else {
...@@ -291,7 +299,9 @@ my $profile_object = APT_Profile->Lookup($value); ...@@ -291,7 +299,9 @@ my $profile_object = APT_Profile->Lookup($value);
if (!defined($profile_object)) { if (!defined($profile_object)) {
fatal("No such profile: $value"); fatal("No such profile: $value");
} }
my $rspecstr = $profile_object->rspec(); my $rspecstr =
($profile_object->public() ?
$profile_object->Condomize() : $profile_object->rspec());
$profile = $profile_object->idx(); $profile = $profile_object->idx();
# #
...@@ -464,6 +474,7 @@ my $instance = APT_Instance->Create({'uuid' => $quickvm_uuid, ...@@ -464,6 +474,7 @@ my $instance = APT_Instance->Create({'uuid' => $quickvm_uuid,
'creator' => $geniuser->uid(), 'creator' => $geniuser->uid(),
'creator_idx' => $geniuser->idx(), 'creator_idx' => $geniuser->idx(),
'creator_uuid' => $geniuser->uuid(), 'creator_uuid' => $geniuser->uuid(),
'aggregate_urn'=> $CMURN,
'status' => "created"}); 'status' => "created"});
if (!defined($instance)) { if (!defined($instance)) {
$slice->Delete(); $slice->Delete();
...@@ -613,7 +624,18 @@ sub Terminate($) ...@@ -613,7 +624,18 @@ sub Terminate($)
if (! defined($instance)) { if (! defined($instance)) {
fatal("No such quick VM: $uuid"); fatal("No such quick VM: $uuid");
} }
if (defined($instance->aggregate_urn()) &&
$instance->aggregate_urn() ne $CMURN) {
$CMURN = $instance->aggregate_urn();
$cm_authority = GeniAuthority->Lookup($CMURN);
if (!defined($cm_authority)) {
$cm_authority = GeniAuthority->CreateFromRegistry("cm", $CMURN);
if (!defined($cm_authority)) {
fatal("Could not load CM authority object");
}
}
}
my $geniuser = GeniUser->Lookup($instance->creator_uuid(), 1); my $geniuser = GeniUser->Lookup($instance->creator_uuid(), 1);
if (!defined($geniuser)) { if (!defined($geniuser)) {
fatal("No creator for quick VM: $uuid"); fatal("No creator for quick VM: $uuid");
...@@ -714,6 +736,18 @@ sub Extend($$) ...@@ -714,6 +736,18 @@ sub Extend($$)
if (! defined($instance)) { if (! defined($instance)) {
fatal("No such quick VM: $uuid"); fatal("No such quick VM: $uuid");
} }
if (defined($instance->aggregate_urn()) &&
$instance->aggregate_urn() ne $CMURN) {
$CMURN = $instance->aggregate_urn();
$cm_authority = GeniAuthority->Lookup($CMURN);
if (!defined($cm_authority)) {
$cm_authority = GeniAuthority->CreateFromRegistry("cm", $CMURN);
if (!defined($cm_authority)) {
fatal("Could not load CM authority object");
}
}
}
my $geniuser = GeniUser->Lookup($instance->creator_uuid(), 1); my $geniuser = GeniUser->Lookup($instance->creator_uuid(), 1);
if (!defined($geniuser)) { if (!defined($geniuser)) {
fatal("No creator for quick VM: $uuid"); fatal("No creator for quick VM: $uuid");
......
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