Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
6ea4eddd
Commit
6ea4eddd
authored
Jun 28, 2012
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept nextosid and def_parentosid.
Also allow pcvm for type.
parent
6258f834
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
11 deletions
+57
-11
backend/newimageid_ez.in
backend/newimageid_ez.in
+57
-11
No files found.
backend/newimageid_ez.in
View file @
6ea4eddd
...
...
@@ -163,6 +163,8 @@ my %xmlfields =
"
mbr_version
",
=>
["
mbr_version
",
$SLOT_OPTIONAL
],
"
reboot_waittime
",
=>
["
reboot_waittime
",
$SLOT_ADMINONLY
],
"
hash
",
=>
["
hash
",
$SLOT_ADMINONLY
],
"
nextosid
",
=>
["
nextosid
",
$SLOT_ADMINONLY
],
"
def_parentosid
",
=>
["
def_parentosid
",
$SLOT_ADMINONLY
],
);
#
...
...
@@ -279,13 +281,33 @@ foreach $key (keys(%{ $xmlparse->{'attribute'} })) {
if
(
!
$this_user
->
IsAdmin
());
}
# Now check that the value is legal.
if
(
!
TBcheck_dbslot
(
$value
,
"
images
",
$dbslot
,
TBDB_CHECKDBSLOT_ERROR
))
{
$errors
{
$key
}
=
TBFieldErrorString
();
next
;
#
# Special case nextosid so it can be in pid,osname format.
#
if
((
$dbslot
eq
"
nextosid
"
||
$dbslot
eq
"
def_parentosid
")
&&
$value
=~
/^.+,.+$/
)
{
my
(
$pid
,
$osname
)
=
(
$value
=~
/^(.*),(.*)$/
);
# Now check that the value is legal.
if
(
!
TBcheck_dbslot
(
$pid
,
"
projects
",
"
pid
",
TBDB_CHECKDBSLOT_ERROR
))
{
$errors
{
$key
}
=
TBFieldErrorString
();
next
;
}
if
(
!
TBcheck_dbslot
(
$osname
,
"
os_info
",
"
osname
",
TBDB_CHECKDBSLOT_ERROR
))
{
$errors
{
$key
}
=
TBFieldErrorString
();
next
;
}
}
else
{
# Now check that the value is legal.
if
(
!
TBcheck_dbslot
(
$value
,
"
images
",
$dbslot
,
TBDB_CHECKDBSLOT_ERROR
))
{
$errors
{
$key
}
=
TBFieldErrorString
();
next
;
}
}
$newimageid_args
{
$key
}
=
$value
;
}
UserError
()
...
...
@@ -408,6 +430,27 @@ if ($global && $shared) {
UserError
("
Global: Image declared both shared and global
");
}
# Nextosid check. Must exist. admin check done above.
if
(
exists
(
$newimageid_args
{"
nextosid
"}))
{
my
$nextos
=
OSinfo
->
Lookup
(
$newimageid_args
{"
nextosid
"});
if
(
!
defined
(
$nextos
))
{
UserError
("
Nextosid: Does not exist
");
}
# Might be in pid,osname format.
$newimageid_args
{"
nextosid
"}
=
$nextos
->
osid
();
}
# Ditto def_parentosid
if
(
exists
(
$newimageid_args
{"
def_parentosid
"}))
{
my
$nextos
=
OSinfo
->
Lookup
(
$newimageid_args
{"
def_parentosid
"});
if
(
!
defined
(
$nextos
))
{
UserError
("
def_parentosid: Does not exist
");
}
# Might be in pid,osname format.
$newimageid_args
{"
def_parentosid
"}
=
$nextos
->
osid
();
}
#
# The path must not contain illegal chars and it must be more than
# the original /proj/$pid we gave the user. We allow admins to specify
...
...
@@ -500,12 +543,15 @@ foreach $key (@mtype_keys) {
my
$type
=
$key
;
$type
=~
s/^mtype_//
;
my
$match
=
grep
(
/^${type}$/
,
keys
(
%mtypes_array
));
if
(
$match
==
0
)
{
$errors
{
$key
}
=
"
Illegal node type.
"
# Treat pcvm special for now.
if
(
$type
eq
"
pcvm
"
||
grep
(
/^${type}$/
,
keys
(
%mtypes_array
)))
{
$node_types_selected
++
if
(
$value
eq
"
1
");
}
els
if
(
$value
eq
"
1
")
{
$
node_types_selected
++
;
els
e
{
$
errors
{
$key
}
=
"
Illegal node type.
"
}
}
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment