Move code for --boot feature to END block.
Fixes missing SSH fingerprint display if --boot was used. (Closes: #679183) Remove a redundant unsetting of $MOUNT_POINT. Guard a potentially second call to the not idempotent unMountImage().
This commit is contained in:
parent
1dbb1f191f
commit
446e157b80
@ -1087,73 +1087,6 @@ setupRootPassword() if ( $CONFIG{ 'passwd' } or $CONFIG{ 'genpass' } or $CONFIG{
|
||||
logprint("All done\n");
|
||||
|
||||
|
||||
#
|
||||
# If we're supposed to start the new instance do so - note here we
|
||||
# have to unmount the image first.
|
||||
#
|
||||
if ( $CONFIG{ 'boot' } )
|
||||
{
|
||||
|
||||
#
|
||||
# Unmount the image and any subsequent mounts.
|
||||
#
|
||||
unMountImage($MOUNT_POINT);
|
||||
|
||||
#
|
||||
# Mark us as unmounted.
|
||||
#
|
||||
$MOUNT_POINT = undef;
|
||||
|
||||
#
|
||||
# If there is an /etc/xen/auto directory then link
|
||||
# in the domain so that it will automatically restart, if it isn't
|
||||
# already present.
|
||||
#
|
||||
# (Will be present if this is overwriting a previous image, for example.)
|
||||
#
|
||||
if ( -d "/etc/xen/auto" )
|
||||
{
|
||||
my $cfg =
|
||||
$CONFIG{ 'output' } . "/" . $CONFIG{ 'hostname' } .
|
||||
$CONFIG{ 'extension' };
|
||||
|
||||
if ( !-e $cfg )
|
||||
{
|
||||
logprint("Creating auto-start symlink to: $cfg\n");
|
||||
|
||||
my $link = "ln -s $cfg /etc/xen/auto/";
|
||||
runCommand($link);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
# Start the image
|
||||
#
|
||||
$CONFIG{ 'pid' } = fork();
|
||||
if ( $CONFIG{ 'pid' } )
|
||||
{
|
||||
|
||||
# Parent.
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
# Config file.
|
||||
my $cfg =
|
||||
$CONFIG{ 'output' } . "/" . $CONFIG{ 'hostname' } .
|
||||
$CONFIG{ 'extension' };
|
||||
|
||||
# Child.
|
||||
system("$CONFIG{'xm'} create $cfg >/dev/null 2>/dev/null");
|
||||
|
||||
logprint("Started new Xen guest: $CONFIG{'hostname'} [$cfg]\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Finished.
|
||||
#
|
||||
@ -4394,6 +4327,59 @@ sub END
|
||||
unMountImage($MOUNT_POINT);
|
||||
}
|
||||
|
||||
#
|
||||
# If we're supposed to start the new instance do so - note here we
|
||||
# have to unmount the image first.
|
||||
#
|
||||
if ( $CONFIG{ 'boot' } and !$FAIL )
|
||||
{
|
||||
|
||||
#
|
||||
# Unmount the image and any subsequent mounts.
|
||||
#
|
||||
if ( defined($MOUNT_POINT) ) {
|
||||
unMountImage($MOUNT_POINT);
|
||||
}
|
||||
|
||||
#
|
||||
# If there is an /etc/xen/auto directory then link in the
|
||||
# domain so that it will automatically restart, if it isn't
|
||||
# already present.
|
||||
#
|
||||
# (Will be present if this is overwriting a previous image,
|
||||
# for example.)
|
||||
#
|
||||
if ( -d "/etc/xen/auto" )
|
||||
{
|
||||
my $cfg =
|
||||
$CONFIG{ 'output' } . "/" . $CONFIG{ 'hostname' } .
|
||||
$CONFIG{ 'extension' };
|
||||
|
||||
if ( !-e $cfg )
|
||||
{
|
||||
logprint("Creating auto-start symlink to: $cfg\n");
|
||||
|
||||
my $link = "ln -s $cfg /etc/xen/auto/";
|
||||
runCommand($link);
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
#
|
||||
# Start the image
|
||||
#
|
||||
|
||||
# Config file.
|
||||
my $cfg =
|
||||
$CONFIG{ 'output' } . "/" . $CONFIG{ 'hostname' } .
|
||||
$CONFIG{ 'extension' };
|
||||
|
||||
# Child.
|
||||
system("$CONFIG{'xm'} create $cfg >/dev/null 2>/dev/null");
|
||||
|
||||
logprint("Started new Xen guest: $CONFIG{'hostname'} [$cfg]\n");
|
||||
}
|
||||
|
||||
#
|
||||
# Here we print out the status message when finishing.
|
||||
#
|
||||
|
||||
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -3,6 +3,8 @@ xen-tools (4.3.1+dev-1) UNRELEASED; urgency=low
|
||||
* New upstream release
|
||||
- Fix symbolic link hooks/centos-6/15-setup-arch (Closes: #690299)
|
||||
- Execute END block not on --version/--help/--manual (Closes: #684346)
|
||||
- Move code for --boot feature to END block. Fixes missing SSH
|
||||
fingerprint display if --boot was used. (Closes: #679183)
|
||||
- Use local parameter instead of global variable in unMountImage.
|
||||
|
||||
-- Axel Beckert <abe@debian.org> Tue, 13 Nov 2012 18:05:05 +0100
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user