Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
1f0cdf67
Commit
1f0cdf67
authored
Dec 05, 2014
by
Leigh B Stoller
Browse files
Dataset fixes.
parent
3059271b
Changes
7
Hide whitespace changes
Inline
Side-by-side
apt/manage_dataset.in
View file @
1f0cdf67
...
...
@@ -145,7 +145,8 @@ sub DoCreate()
{
my
$usage
=
sub
{
print
STDERR
"
Usage: manage_dataset create
"
.
"
[-t type] [-f fstype] [-e expiration] -s size pid/name
\n
";
"
[-t type] [-f fstype] [-e expiration] [-p privacy]
"
.
"
-s size pid/name
\n
";
exit
(
-
1
);
};
my
$aggregate_urn
=
"
urn:publicid:IDN+apt.emulab.net+authority+cm
";
...
...
@@ -153,11 +154,12 @@ sub DoCreate()
my
$errmsg
;
my
$pid
;
my
$expires
;
my
$privacy
=
"
private
";
my
$size
;
my
$type
=
"
stdataset
";
my
$fstype
;
my
$optlist
=
"
ds:t:e:f:w:
";
my
$optlist
=
"
ds:t:e:f:w:
p:
";
my
%options
=
();
if
(
!
getopts
(
$optlist
,
\
%options
))
{
&$usage
();
...
...
@@ -175,6 +177,11 @@ sub DoCreate()
&$usage
()
if
(
$fstype
!~
/^(ext2|ext3|ext4|ufs|ufs2)$/
);
}
if
(
defined
(
$options
{"
p
"}))
{
$privacy
=
$options
{"
p
"};
&$usage
()
if
(
$privacy
!~
/^(private|shared|public)$/
);
}
if
(
defined
(
$options
{"
s
"}))
{
if
(
$options
{"
s
"}
=~
/^(\d+)$/
)
{
$size
=
$
1
;
...
...
@@ -236,6 +243,12 @@ sub DoCreate()
if
(
defined
(
$fstype
));
$blob
->
{"
expires
"}
=
TBDateStringLocal
(
$expires
)
if
(
defined
(
$expires
));
if
(
$privacy
eq
"
shared
")
{
$blob
->
{'
shared
'}
=
1
;
}
elsif
(
$privacy
eq
"
public
")
{
$blob
->
{'
public
'}
=
1
;
}
my
$dataset
=
APT_Dataset
->
Create
(
$blob
);
if
(
!
defined
(
$dataset
))
{
...
...
www/aptui/dataset.ajax
View file @
1f0cdf67
...
...
@@ -118,13 +118,13 @@ function Do_CreateDataSet()
$command
.
=
" -s "
.
$formfields
[
"dataset_size"
];
}
# Permission bits.
if
(
$formfields
[
"dataset_who"
]
!=
"public"
||
$formfields
[
"dataset_who"
]
!=
"shared"
||
if
(
$formfields
[
"dataset_who"
]
!=
"public"
&&
$formfields
[
"dataset_who"
]
!=
"shared"
&&
$formfields
[
"dataset_who"
]
!=
"private"
)
{
$errors
[
"dataset_who"
]
=
"Illegal value"
;
}
else
{
$command
.
=
" -
f
"
.
$formfields
[
"dataset_
fstype
"
];
$command
.
=
" -
p
"
.
$formfields
[
"dataset_
who
"
];
}
if
(
count
(
$errors
))
{
SPITAJAX_ERROR
(
2
,
$errors
);
...
...
www/aptui/dataset_defs.php
View file @
1f0cdf67
...
...
@@ -103,6 +103,8 @@ class Dataset
function
size
()
{
return
$this
->
field
(
"size"
);
}
function
locked
()
{
return
$this
->
field
(
"locked"
);
}
function
locker_pid
()
{
return
$this
->
field
(
"locker_pid"
);
}
function
ispublic
()
{
return
$this
->
field
(
"public"
);
}
function
shared
()
{
return
$this
->
field
(
"shared"
);
}
function
islocal
()
{
return
0
;
}
#
...
...
@@ -121,6 +123,18 @@ class Dataset
return
0
;
}
#
# Return a privacy string (public,shared,private).
#
function
PrivacyString
()
{
if
(
$this
->
shared
())
return
"shared"
;
elseif
(
$this
->
ispublic
())
return
"public"
;
else
return
"private"
;
}
#
# Form a URN for the dataset.
#
...
...
www/aptui/show-dataset.php
View file @
1f0cdf67
...
...
@@ -91,6 +91,7 @@ $fields["dataset_lastused"] = ($dataset->last_used() ?
$fields
[
"dataset_uuid"
]
=
$uuid
;
$fields
[
"dataset_idx"
]
=
$dataset
->
idx
();
$fields
[
"dataset_urn"
]
=
$dataset
->
URN
();
$fields
[
"dataset_who"
]
=
$dataset
->
PrivacyString
();
#
# The state is a bit of a problem, since local leases do not have
...
...
www/aptui/template/create-dataset.html
View file @
1f0cdf67
...
...
@@ -110,7 +110,7 @@
<div
class=
'format-me'
data-key=
'dataset_who'
>
<div
class=
'radio'
>
<label>
<input
type=
'radio'
name=
'
formfields[
dataset_who
]
'
<input
type=
'radio'
name=
'dataset_who'
id=
'dataset_who_public'
<%
if
(formfields.dataset_who =
=
"
public
")
{
%
>
checked
<
%
}
%
>
...
...
@@ -120,7 +120,7 @@
</div>
<div
class=
'radio'
>
<label>
<input
type=
'radio'
name=
'
formfields[
dataset_who
]
'
<input
type=
'radio'
name=
'dataset_who'
id=
'dataset_who_registered'
<%
if
(formfields.dataset_who =
=
"
shared
")
{
%
>
checked
<
%
}
%
>
...
...
@@ -130,7 +130,7 @@
</div>
<div
class=
'radio'
>
<label>
<input
type=
'radio'
name=
'
formfields[
dataset_who
]
'
<input
type=
'radio'
name=
'dataset_who'
id=
'dataset_who_private'
<%
if
(formfields.dataset_who =
=
"
private
")
{
%
>
checked
<
%
}
%
>
...
...
www/aptui/template/show-dataset.html
View file @
1f0cdf67
...
...
@@ -59,6 +59,10 @@
<td>
State
</td>
<td><
%
-
formfields.dataset_state
%
></td>
</tr>
<tr>
<td>
Privacy
</td>
<td><
%
-
formfields.dataset_who
%
></td>
</tr>
<tr>
<td>
URN
</td>
<td><
%
-
formfields.dataset_urn
%
></td>
...
...
www/lease_defs.php
View file @
1f0cdf67
...
...
@@ -150,6 +150,14 @@ class Lease
}
return
0
;
}
#
# Return a privacy string (public,shared,private).
#
function
PrivacyString
()
{
return
"private"
;
}
#
# Form a URN for the dataset.
#
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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