Commit 0fba2706 authored by Leigh Stoller's avatar Leigh Stoller

Add a sitevar to restrict newimageid_ez -a option, to the list of node

types in the images/default_typelist sitevar.
parent 30b002b1
......@@ -397,7 +397,18 @@ my $types_querystring;
if ($allpc) {
$types_querystring = "select nt.type,nt.class from node_types as nt ".
"left join node_type_attributes as a on a.type=nt.type ".
"where a.attrkey='imageable' and a.attrvalue!='0'";
"where a.attrkey='imageable' and a.attrvalue!='0' ";
#
# Restrict by sitevar, but still do query to avoid mistakes.
#
my $default_typelist = TBGetSiteVar("images/default_typelist");
if (defined($default_typelist) && $default_typelist != "") {
$types_querystring .=
"and (".
join(" or ", map("nt.type='$_'", split(",", $default_typelist))) .
") ";
}
}
else {
$types_querystring = "select distinct n.type,nt.class from nodes as n ".
......
......@@ -156,6 +156,7 @@ INSERT INTO sitevariables VALUES ('cloudlab/message',NULL,'','Message to display
INSERT INTO sitevariables VALUES ('aptui/autoextend_maximum',NULL,'7','Maximum number of days requested that will automaticaly be granted; zero means only admins can extend an experiment.',0);
INSERT INTO sitevariables VALUES ('aptui/autoextend_maxage',NULL,'14','Maximum age (in days) of an experiment before all extension requests require admin approval.',0);
INSERT INTO sitevariables VALUES ('node/nfs_transport',NULL,'udp','Transport protocol to be used by NFS mounts on clients. One of: udp, tcp, or osdefault, where osdefault means use the client OS default setting.',0);
INSERT INTO sitevariables VALUES ('images/default_typelist',NULL,'','List of types to associate with an imported image when it is not appropriate to associate all existing types.',0);
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
......
#
# Site variables.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
my $var = "images/default_typelist";
if (!TBSiteVarExists($var)) {
my $desc = "List of types to associate with an imported image when ".
"it is not appropriate to associate all existing types.";
my $defval = "";
DBQueryFatal("INSERT INTO sitevariables VALUES ".
"('$var',NULL,'$defval','$desc',0)");
}
return 0;
}
1;
# Local Variables:
# mode:perl
# End:
......@@ -398,7 +398,6 @@ sub CreateImage($$$$$)
if (defined($parent)) {
$xmlparse->{'attribute'}->{"mtype_pcvm"} = {};
$xmlparse->{'attribute'}->{"mtype_pcvm"}->{'value'} = 1;
$alltypes = "";
}
else {
delete($xmlparse->{'attribute'}->{"def_parentosid"});
......
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