Commit 7c5abedc authored by Russ Fish's avatar Russ Fish

Don't check osid/imageid mapping if no partition OS's specified.

parent 0654df90
...@@ -368,35 +368,36 @@ for (my $i = 1; $i <= 4; $i++) { ...@@ -368,35 +368,36 @@ for (my $i = 1; $i <= 4; $i++) {
$osidclause .= "osid='$foo'"; $osidclause .= "osid='$foo'";
} }
} }
if (defined($osidclause)) {
DBQueryFatal("lock tables images write, os_info write, osidtoimageid write");
my $imageid = $image->imageid();
my $query_result =
DBQueryFatal("select osidtoimageid.*,images.pid,images.imagename ".
" from osidtoimageid ".
"left join images on ".
" images.imageid=osidtoimageid.imageid ".
"where ($osidclause) and ($typeclause) and ".
" images.imageid!='$imageid'");
DBQueryFatal("unlock tables");
if ($query_result->numrows) {
my $msg =
"There are other image descriptors that specify the same OS".
"descriptors for the same node types. There must be a unique".
"mapping of OS descriptor to Image descriptor for each node type!".
"Perhaps you need to delete one of the images below, or create a".
"new OS descriptor to use in this new Image descriptor. \n\n";
my $fmt = "%-10s %-15s %-15s %s\n";
$msg .= sprintf($fmt, "Image", "OSID", "Type", "ImageID");
$msg .= sprintf($fmt, "=====", "====", "====", "=======");
while (my ($imageid, $osid, $type, $imagename) =
$query_result->fetchrow_array()) {
$msg .= sprintf($fmt, $imageid, $osid, $type, $imagename);
}
DBQueryFatal("lock tables images write, os_info write, osidtoimageid write"); UserError("Conflict: Please check the other Image descriptors".
my $imageid = $image->imageid(); " and make the necessary changes!\n $msg");
my $query_result =
DBQueryFatal("select osidtoimageid.*,images.pid,images.imagename ".
" from osidtoimageid ".
"left join images on ".
" images.imageid=osidtoimageid.imageid ".
"where ($osidclause) and ($typeclause) and ".
" images.imageid!='$imageid'");
DBQueryFatal("unlock tables");
if ($query_result->numrows) {
my $msg =
"There are other image descriptors that specify the same OS".
"descriptors for the same node types. There must be a unique".
"mapping of OS descriptor to Image descriptor for each node type!".
"Perhaps you need to delete one of the images below, or create a".
"new OS descriptor to use in this new Image descriptor. \n\n";
my $fmt = "%-10s %-15s %-15s %s\n";
$msg .= sprintf($fmt, "Image", "OSID", "Type", "ImageID");
$msg .= sprintf($fmt, "=====", "====", "====", "=======");
while (my ($imageid, $osid, $type, $imagename) =
$query_result->fetchrow_array()) {
$msg .= sprintf($fmt, $imageid, $osid, $type, $imagename);
} }
UserError("Conflict: Please check the other Image descriptors".
" and make the necessary changes!\n $msg");
} }
exit(0) exit(0)
......
...@@ -423,18 +423,18 @@ for ($i = 1; $i <= 4; $i++) { ...@@ -423,18 +423,18 @@ for ($i = 1; $i <= 4; $i++) {
$osid_array[] = $defaults[$foo]; $osid_array[] = $defaults[$foo];
} }
} }
if (isset($osidclause)) {
DBQueryFatal("lock tables images write, os_info write, osidtoimageid write"); DBQueryFatal("lock tables images write, os_info write, osidtoimageid write");
$query_result = $query_result =
DBQueryFatal("select osidtoimageid.*,images.pid,images.imagename ". DBQueryFatal("select osidtoimageid.*,images.pid,images.imagename ".
" from osidtoimageid ". " from osidtoimageid ".
"left join images on ". "left join images on ".
" images.imageid=osidtoimageid.imageid ". " images.imageid=osidtoimageid.imageid ".
"where ($osidclause) and ($typeclause) and ". "where ($osidclause) and ($typeclause) and ".
" images.imageid!='$imageid'"); " images.imageid!='$imageid'");
DBQueryFatal("unlock tables"); DBQueryFatal("unlock tables");
if (mysql_num_rows($query_result)) { if (mysql_num_rows($query_result)) {
echo "<center> echo "<center>
There are other image descriptors that specify the There are other image descriptors that specify the
same OS descriptors for the same node types.<br> same OS descriptors for the same node types.<br>
...@@ -470,6 +470,7 @@ if (mysql_num_rows($query_result)) { ...@@ -470,6 +470,7 @@ if (mysql_num_rows($query_result)) {
USERERROR("Please check the other Image descriptors and make the ". USERERROR("Please check the other Image descriptors and make the ".
"necessary changes!", 1); "necessary changes!", 1);
}
} }
# Send to the backend for more checking, and eventually, to update the DB. # Send to the backend for more checking, and eventually, to update the DB.
......
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