diff options
author | Matthew Booth <mbooth@redhat.com> | 2010-08-26 12:11:59 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2010-08-26 15:04:35 +0100 |
commit | c0b38fbb27c8771916386f47361833722d54518f (patch) | |
tree | e83ccd7f008bfca4b15ef0483f4a2d06d11ce2f2 /appliance | |
parent | a45302cb8a0ee3b4ffd0656b24a06ebdf7b50f38 (diff) | |
download | libguestfs-c0b38fbb27c8771916386f47361833722d54518f.tar.gz libguestfs-c0b38fbb27c8771916386f47361833722d54518f.tar.xz libguestfs-c0b38fbb27c8771916386f47361833722d54518f.zip |
Call sync after guestfsd exits
Core files are not reliably written to disk if guestfsd dumps core. This patch
makes libguestfs do the same appliance cleanup for guestfsd and virt-rescue,
which seems to fix the matter.
It also removes a redundant sleep and additional sync when exiting virt-rescue.
Diffstat (limited to 'appliance')
-rwxr-xr-x | appliance/init | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/appliance/init b/appliance/init index 6aeea0c3..90da1cb5 100755 --- a/appliance/init +++ b/appliance/init @@ -88,27 +88,30 @@ if grep -sq guestfs_verbose=1 /proc/cmdline; then fi if ! grep -sq guestfs_rescue=1 /proc/cmdline; then - exec guestfsd -f + # The host will kill qemu abruptly if guestfsd shuts down normally + guestfsd -f + + # Otherwise we try to clean up gracefully. For example, this ensures that a + # core dump generated by the guest daemon will be written to disk. +else + # Use appliance in rescue mode, also used by the virt-rescue command. + eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline) + PS1='><rescue> ' + export TERM PS1 + echo + echo "------------------------------------------------------------" + echo + echo "Welcome to virt-rescue, the libguestfs rescue shell." + echo + echo "Note: The contents of / are the rescue appliance." + echo "You have to mount the guest's partitions under /sysroot" + echo "before you can examine them." + echo + bash -i + echo + echo "virt-rescue: Syncing the disk now before exiting ..." + echo "(Don't worry if you see a 'Kernel panic' message below)" + echo fi -# Use appliance in rescue mode, also used by the virt-rescue command. -eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline) -PS1='><rescue> ' -export TERM PS1 -echo -echo "------------------------------------------------------------" -echo -echo "Welcome to virt-rescue, the libguestfs rescue shell." -echo -echo "Note: The contents of / are the rescue appliance." -echo "You have to mount the guest's partitions under /sysroot" -echo "before you can examine them." -echo -bash -i -echo -echo "virt-rescue: Syncing the disk now before exiting ..." -echo "(Don't worry if you see a 'Kernel panic' message below)" -echo -sync -sleep 1 sync |