Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
912ce9be
Commit
912ce9be
authored
Sep 17, 2014
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Oops, left out part of the console support in last commit.
parent
8d546de8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
2 deletions
+48
-2
apt/manage_instance.in
apt/manage_instance.in
+48
-2
No files found.
apt/manage_instance.in
View file @
912ce9be
...
...
@@ -37,12 +37,14 @@ sub usage()
{
print
("
Usage: manage_instance -s instance [imagename]
\n
");
print
("
Usage: manage_instance -r instance
\n
");
print
("
Usage: manage_instance -c instance node
\n
");
exit
(
-
1
);
}
my
$optlist
=
"
dsrt:
";
my
$optlist
=
"
dsrt:
c
";
my
$debug
=
0
;
my
$delete
=
0
;
my
$snapshot
=
0
;
my
$doconsole
=
0
;
my
$webtask
;
my
$webtask_id
;
my
$webtask_delete
;
...
...
@@ -83,6 +85,7 @@ use WebTask;
# Protos
sub
fatal
($);
sub
DoSnapshot
();
sub
DoConsole
();
#
# Parse command arguments. Once we return from getopts, all that should be
...
...
@@ -95,6 +98,9 @@ if (! getopts($optlist, \%options)) {
if
(
defined
(
$options
{"
s
"}))
{
$snapshot
=
1
;
}
if
(
defined
(
$options
{"
c
"}))
{
$doconsole
=
1
;
}
if
(
defined
(
$options
{"
r
"}))
{
$delete
=
1
;
}
...
...
@@ -122,6 +128,9 @@ if (!defined($instance)) {
if
(
$snapshot
)
{
DoSnapshot
();
}
elsif
(
$doconsole
)
{
DoConsole
()
}
exit
(
0
);
#
...
...
@@ -276,7 +285,44 @@ sub DoSnapshot()
if
(
$webtask_delete
);
exit
(
0
);
}
exit
(
0
);
#
# Ask the console URL for a node in an instance.
#
sub
DoConsole
()
{
usage
if
(
!
@ARGV
);
my
$node_id
=
shift
(
@ARGV
);
#
# Sanity check to make sure the node is really in the rspec, since
# we need its sliver urn to ask for the console url.
#
my
$sliver_urn
;
my
$manifest
=
GeniXML::
Parse
(
$instance
->
manifest
());
if
(
!
defined
(
$manifest
))
{
fatal
("
Could not parse manifest
");
}
my
@nodes
=
GeniXML::
FindNodes
("
n:node
",
$manifest
)
->
get_nodelist
();
foreach
my
$node
(
@nodes
)
{
my
$client_id
=
GeniXML::
GetVirtualId
(
$node
);
if
(
$node_id
eq
$client_id
)
{
$sliver_urn
=
GeniXML::
GetSliverId
(
$node
);
}
}
if
(
!
defined
(
$sliver_urn
))
{
fatal
("
Could not find node '
$node_id
' in manifest
");
}
my
$command
=
"
$QUICKVM
-c
$uuid
$sliver_urn
";
my
$output
=
emutil::
ExecQuiet
(
$command
);
if
(
$?
)
{
print
STDERR
$output
;
fatal
("
Failed to get console URL
");
}
print
$output
;
exit
(
0
);
}
sub
fatal
($)
{
...
...
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