Commit bdc0b6df authored by Leigh Stoller's avatar Leigh Stoller

Oops, left this out of previous commit.

parent bc5b1968
......@@ -51,6 +51,8 @@ my $rspec;
my $script;
my $profile;
my $instance;
my $aggregate;
my $node_id;
my $webtask;
my $webtask_id;
......@@ -318,7 +320,12 @@ if ($snap) {
if (!defined($instance)) {
fatal("Could not look up instance $uuid");
}
my $manifest = GeniXML::Parse($instance->manifest());
if (@{ $instance->AggregateList() } != 1) {
$errors{"error"} = "Must be only one aggregate to snapshot";
UserError();
}
($aggregate) = @{ $instance->AggregateList() };
my $manifest = GeniXML::Parse($aggregate->manifest());
if (! defined($manifest)) {
fatal("Could not parse manifest");
}
......@@ -327,6 +334,12 @@ if ($snap) {
$errors{"error"} = "Too many nodes (> 1) to snapshot";
UserError();
}
my $sliver_urn = GeniXML::GetSliverId($nodes[0]);
$node_id = GeniXML::GetVirtualId($nodes[0]);
if (! (defined($sliver_urn) && $sliver_urn eq $aggregate->aggregate_urn())){
$errors{"error"} = "$node_id is not at " . $aggregate->aggregate_urn();
UserError();
}
}
if ($update) {
$profile = APT_Profile->Lookup($uuid);
......@@ -405,13 +418,6 @@ else {
# Now do the snapshot operation.
#
if (defined($instance)) {
my $manifest = GeniXML::Parse($instance->manifest());
if (! defined($manifest)) {
fatal("Could not parse manifest");
}
my ($node) = GeniXML::FindNodes("n:node", $manifest)->get_nodelist();
my $sliver_urn = GeniXML::GetSliverId($node);
my $node_id = GeniXML::GetVirtualId($node);
my $apt_uuid = $instance->uuid();
my $imagename = $profile->name();
......
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