Skip to content
GitLab
Menu
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
b760cf70
Commit
b760cf70
authored
Sep 04, 2012
by
Leigh B Stoller
Browse files
Changes to creating a snapshot of a VM container.
parent
2df707a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
protogeni/lib/GeniCMV2.pm.in
View file @
b760cf70
...
...
@@ -51,6 +51,7 @@ my $BOSSNODE = "@BOSSNODE@";
my
$
OURDOMAIN
=
"@OURDOMAIN@"
;
my
$
PGENIDOMAIN
=
"@PROTOGENI_DOMAIN@"
;
my
$
ELABINELAB
=
"@ELABINELAB@"
;
my
$
TBBASE
=
"@TBBASE@"
;
my
$
CREATEEXPT
=
"$TB/bin/batchexp"
;
my
$
ENDEXPT
=
"$TB/bin/endexp"
;
my
$
NALLOC
=
"$TB/bin/nalloc"
;
...
...
@@ -2281,6 +2282,10 @@ sub CreateImage($)
return
$
credential
if
(
GeniResponse
::
IsResponse
($
credential
));
my
$
user
=
GeniCM
::
CreateUserFromCertificate
($
credential
);
return
$
user
if
(
GeniResponse
::
IsResponse
($
user
));
my
($
slice
,
$
aggregate
)
=
Credential2SliceAggregate
($
credential
);
return
$
slice
if
(
defined
($
slice
)
&&
GeniResponse
::
IsResponse
($
slice
));
...
...
@@ -2333,8 +2338,16 @@ sub CreateImage($)
if
($
slice
->
Lock
()
!= 0) {
return
GeniResponse
->
BusyResponse
();
}
my
$
opt
=
($
wholedisk
?
"-e"
:
""
);
my
$
opt
=
""
;
$
opt
.=
" -e"
if
($
wholedisk
);
#
#
Let
user
override
global
setting
.
#
if
(
exists
($
argref
->{
'global'
}))
{
$
opt
.=
" -g "
.
($
argref
->{
'global'
}
?
"1"
:
"0"
);
}
my
$
output
=
GeniUtil
::
ExecQuiet
(
"$CLONEIMAGE $opt -s $imagename $node_id"
);
#
Not
a
typical
op
,
so
always
print
debugging
info
;
...
...
@@ -2358,6 +2371,7 @@ sub CreateImage($)
#
my
$
image_urn
=
GeniHRN
::
Generate
($
OURDOMAIN
,
"image"
,
$
pid
.
"//"
.
$
imagename
);
my
$
image_url
=
"$TBBASE/image_metadata.php?uuid="
.
$
image
->
uuid
();
#
#
We
used
the
-
s
(
nosnapshot
)
option
above
,
to
get
the
descriptor
...
...
@@ -2369,7 +2383,8 @@ sub CreateImage($)
if
($
mypid
)
{
#
Let
the
child
get
going
.
sleep
(
1
);
return
GeniResponse
->
Create
(
GENIRESPONSE_SUCCESS
,
$
image_urn
,
$
output
);
return
GeniResponse
->
Create
(
GENIRESPONSE_SUCCESS
,
[$
image_urn
,
$
image_url
]);
}
#
This
switches
the
file
that
we
are
writing
to
.
libaudit
::
AuditFork
();
...
...
@@ -2384,8 +2399,18 @@ sub CreateImage($)
if
($?)
{
print
STDERR
"Failed to take the snapshot of $node_id
\n
"
;
$
slice
->
UnLock
();
if
($
user
->
email
())
{
libtestbed
::
SENDMAIL
($
user
->
email
(),
"Failed to clone image"
,
"$output
\n
"
);
}
return
-
1
;
}
if
($
user
->
email
())
{
libtestbed
::
SENDMAIL
($
user
->
email
(),
"Finished cloning image"
,
"$output
\n
"
);
}
$
slice
->
UnLock
();
return
0
;
}
...
...
Write
Preview
Supports
Markdown
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