diff --git a/apt/APT_Profile.pm.in b/apt/APT_Profile.pm.in index f9985cfdaeb66f3f3386fabb85ad9c1253699033..12527a806d9340e83f921c0a5a65db91be121d44 100644 --- a/apt/APT_Profile.pm.in +++ b/apt/APT_Profile.pm.in @@ -762,7 +762,7 @@ sub ConvertDiskImages($) } # Total nonsense, to be thrown away. -sub CheckImageConstraints($$$) +sub CheckNodeConstraints($$$) { my ($self, $iscloudlab, $pmsg) = @_; my $cloudwww = "www.utah.cloudlab.us"; @@ -775,12 +775,36 @@ sub CheckImageConstraints($$$) } foreach my $ref (GeniXML::FindNodes("n:node", $rspec)->get_nodelist()) { my $client_id = GetVirtualId($ref); + my $virtualization_type = GeniXML::GetVirtualizationSubtype($ref); + + if (defined($virtualization_type) && $iscloudlab && + $virtualization_type eq "emulab-xen") { + $$pmsg = "Node '$client_id' is a XEN VM, which is ". + "not supported on the Cloudlab cluster"; + return -1; + } my $diskref = GeniXML::GetDiskImage($ref); next if (!defined($diskref)); my $image_url = GeniXML::GetText("url", $diskref); + my $image_urn = GeniXML::GetText("name", $diskref); next - if (!defined($image_url)); + if (!(defined($image_url) || defined($image_urn))); + + if (defined($image_urn)) { + if ($iscloudlab && $image_urn !~ /ARM/) { + $$pmsg = "Node '$client_id' disk_image will not run ". + "on the Cloudlab cluster"; + return -1; + } + elsif (!$iscloudlab && $image_urn =~ /ARM/) { + $$pmsg = "Node '$client_id' disk_image will only run ". + "on the Cloudlab cluster"; + return -1; + } + } + next if + (!defined($image_url)); # Get the hostname for the image URL. my $uri = URI->new($image_url); diff --git a/apt/create_instance.in b/apt/create_instance.in index c353571814d46f7bbc7cc8db7c87bf28a5a4ad02..550244159133a56086e14a3cd6d102f351063874 100755 --- a/apt/create_instance.in +++ b/apt/create_instance.in @@ -311,7 +311,7 @@ if (APT_Profile::CheckDatasets($rspecstr, $profile_object->pid(), \$errmsg)) { my $iscloudlab = ($CMURN eq "urn:publicid:IDN+utah.cloudlab.us+authority+cm" ? 1 : 0); -if ($profile_object->CheckImageConstraints($iscloudlab, \$errmsg)) { +if ($profile_object->CheckNodeConstraints($iscloudlab, \$errmsg)) { UserError($errmsg); } @@ -522,6 +522,7 @@ print STDERR "Email: $user_email" . (!$localuser ? " (guest)" : "") . "\n"; print STDERR "Profile: " . $profile_object->name() . ":${version}\n"; print STDERR "Slice: $slice_urn\n"; print STDERR "Server: $SERVER_NAME\n"; +print STDERR "Cluster: $CMURN\n"; print STDERR "\n"; print STDERR "$rspecstr\n"; diff --git a/www/aptui/instance_defs.php b/www/aptui/instance_defs.php index 0744ca1d44efeddccf29e053bf83c170916f1b34..70190b7d96ec93c5c313d2e616b89599df05a9af 100644 --- a/www/aptui/instance_defs.php +++ b/www/aptui/instance_defs.php @@ -24,7 +24,7 @@ # $am_array = array('Utah APT' => - "urn:publicid:IDN+apt.emulab.net+authority+cm", + "urn:publicid:IDN+apt.emulab.net+authority+cm", 'Utah Cloudlab' => "urn:publicid:IDN+utah.cloudlab.us+authority+cm", 'Utah DDC' => @@ -32,6 +32,13 @@ $am_array = array('Utah APT' => 'Utah PG' => "urn:publicid:IDN+emulab.net+authority+cm"); +if ($ISCLOUD) { + $DEFAULT_AGGREGATE = "Utah Cloudlab"; +} +else { + $DEFAULT_AGGREGATE = "Utah APT"; +} + class Instance { var $instance; diff --git a/www/aptui/instantiate.ajax b/www/aptui/instantiate.ajax index 254a563f71198dd9e6baf38c712d708b6da2f65f..1a5f62fcf22df12bdfad78779aff8f111fbf3c4e 100644 --- a/www/aptui/instantiate.ajax +++ b/www/aptui/instantiate.ajax @@ -25,6 +25,7 @@ chdir(".."); include_once("webtask.php"); chdir("apt"); include_once("profile_defs.php"); +include_once("instance_defs.php"); # # Return info about specific profile. @@ -33,6 +34,7 @@ function Do_GetProfile() { global $this_user; global $ajax_args; + global $DEFAULT_AGGREGATE; if (!isset($ajax_args["uuid"])) { SPITAJAX_ERROR(1, "Missing profile uuid"); @@ -48,12 +50,19 @@ function Do_GetProfile() SPITAJAX_ERROR(1, "No such profile $uuid"); return; } + $amdefault = $DEFAULT_AGGREGATE; + # Temporary override until constraint system in place. + if ($profile->BestAggregate()) { + $amdefault = $profile->BestAggregate(); + } + # # Knowing the UUID means the user can instantiate it, # so no permission checks on the profile. # SPITAJAX_RESPONSE(array('rspec' => $profile->rspec(), - 'name' => $profile->name())); + 'name' => $profile->name(), + 'amdefault' => $amdefault)); } # Local Variables: # mode:php diff --git a/www/aptui/instantiate.php b/www/aptui/instantiate.php index a80c0d0f37e0b8aa0937ab5a603a2f89721bb8b1..f822625ac6534659c68c844408aa023bdbb84efc 100755 --- a/www/aptui/instantiate.php +++ b/www/aptui/instantiate.php @@ -469,12 +469,8 @@ if (!isset($create)) { $defaults["email"] = ""; $defaults["sshkey"] = ""; $defaults["profile"] = (isset($profile) ? $profile : $profile_default); - if ($ISCLOUD) { - $defaults["where"] = 'Utah APT'; - } - else { - $defaults["where"] = 'Utah APT'; - } + $defaults["where"] = $DEFAULT_AGGREGATE; + # # Look for current user or cookie that tells us who the user is. # diff --git a/www/aptui/js/instantiate.js b/www/aptui/js/instantiate.js index 8762ea04623732cc66d07ab78368ea5d86c501cf..15c0cb62598f98694012f4616e6c5b3bdeb2a5c0 100644 --- a/www/aptui/js/instantiate.js +++ b/www/aptui/js/instantiate.js @@ -8,6 +8,7 @@ function (_, sup, aboutaptString, aboutcloudString) 'use strict'; var ajaxurl; + var amdefault; function initialize() { @@ -29,7 +30,7 @@ function (_, sup, aboutaptString, aboutcloudString) $('#verify_modal').modal('show'); } $('#quickvm_topomodal').on('shown.bs.modal', function() { - ShowProfileList($('.current')) + ShowProfileSelection($('.current')) }); $('button#reset-form').click(function (event) { @@ -42,12 +43,11 @@ function (_, sup, aboutaptString, aboutcloudString) }); $('li.profile-item').click(function (event) { event.preventDefault(); - ShowProfileList(event.target); + ShowProfileSelection(event.target); }); $('button#showtopo_select').click(function (event) { event.preventDefault(); - UpdateProfileSelection($('.selected')); - ShowProfileList($('.selected')); + ChangeProfileSelection($('.selected')); $('#quickvm_topomodal').modal('hide'); }); $('#instantiate_submit').click(function (event) { @@ -55,52 +55,72 @@ function (_, sup, aboutaptString, aboutcloudString) return true; }); var startProfile = $('#profile_name li[value = ' + window.PROFILE + ']') - UpdateProfileSelection(startProfile); - ShowProfileList(startProfile, true); + ChangeProfileSelection(startProfile); _.delay(function () {$('.dropdown-toggle').dropdown();}, 500); } function resetForm($form) { $form.find('input:text, input:password, select, textarea').val(''); } - - function UpdateProfileSelection(selectedElement) - { - var profile_name = $(selectedElement).text(); - var profile_value = $(selectedElement).attr('value'); - $('#selected_profile').attr('value', profile_value); - $('#selected_profile_text').html("" + profile_name); - if (!$(selectedElement).hasClass('current')) { + function ShowProfileSelection(selectedElement) { + if (!$(selectedElement).hasClass('selected')) { $('#profile_name li').each(function() { - $(this).removeClass('current'); + $(this).removeClass('selected'); }); - $(selectedElement).addClass('current'); + $(selectedElement).addClass('selected'); } + + var continuation = function(rspec, description, name, amdefault) { + $('#showtopo_title').html("