Commit a5ee67dc authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Image alias support for the constraint system. As per discussion at the

meeting, we use the image aliases to create an equivalence class for the
hardware types the image alias refers to. For example, UBUNTU16-64-STD
is an x86 image in the image server. It is also an image alias (at the
Moonshot cluster) that points to the x86 image and the ARM image. So
that means UBUNTU16-64-STD runs on x86 types and moonshot types.
parent ac65d3bc
......@@ -175,34 +175,42 @@ function Do_GetImageInfo()
#
$urn = preg_replace('/:\d+$/', "", $urn);
$safe_urn = addslashes($urn);
again:
if (is_null($version)) {
if ($proj == "emulab-ops") {
list ($a,$b,$c) = Instance::ParseURN($urn);
$safe_urn = addslashes("urn:publicid:IDN+%+image+${c}");
$innerclause = "urn like '$safe_urn'";
$safe_urn = addslashes("urn:publicid:IDN+%+image+${id}");
$innerclause = "innerclause.urn like '$safe_urn'";
}
else {
$innerclause = "urn='$safe_urn'";
$innerclause = "innerclause.urn='$safe_urn'";
}
$query_result =
DBQueryFatal("select i.*,v.* from image_versions as v ".
" inner join ".
" (select urn,max(version) as version ".
" from image_versions ".
" where $innerclause ".
" group by urn) as ij ".
" on v.urn=ij.urn and v.version=ij.version ".
"left join images as i on i.urn=v.urn",
$dblink);
$query_result = DBQueryFatal(
"(select i.*,v.* from image_versions as v ".
" inner join ".
" (select iv.urn,max(version) as version ".
" from image_aliases as innerclause ".
" left join image_versions as iv on ".
" iv.urn=innerclause.target_urn ".
" where $innerclause ".
" group by iv.urn) as ij ".
" on v.urn=ij.urn and v.version=ij.version ".
" left join images as i on i.urn=v.urn) ".
"union ".
"(select i.*,v.* from image_versions as v ".
" inner join ".
" (select urn,max(version) as version ".
" from image_versions as innerclause ".
" where $innerclause ".
" group by urn) as ij ".
" on v.urn=ij.urn and v.version=ij.version ".
" left join images as i on i.urn=v.urn)", $dblink);
}
else {
$query_result =
DBQueryFatal("select i.*,v.* from image_versions as v ".
"left join images as i on ".
" i.image_uuid=v.image_uuid ".
"where v.urn='$safe_urn' and v.version='$version'",
"left join images as i on ".
" i.image_uuid=v.image_uuid ".
"where v.urn='$safe_urn' and ".
" v.version='$version'",
$dblink);
}
}
......
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