[openstack-dev] [nova][libvirt] - 'nova reboot' causes console-log truncated

Surojit Pathak suro.patz at gmail.com
Tue Dec 23 00:36:02 UTC 2014

On 11/14/14 2:02 AM, Daniel P. Berrange wrote:
> On Thu, Nov 13, 2014 at 01:55:06PM -0800, Surojit Pathak wrote:
>> Hi all,
>> [Issue observed]
>> If we issue 'nova reboot <server>', we get to have the console output of the
>> latest bootup of the server only. The console output of the previous boot
>> for the same server vanishes due to truncation[1]. If we do reboot from
>> within the VM instance [ #sudo reboot ], or reboot the instance with 'virsh
>> reboot <instance>' the behavior is not the same, where the console.log keeps
>> increasing, with the new output being appended.
>> This loss of history makes some debugging scenario difficult due to lack of
>> information being available.
>> Please point me to any solution/blueprint for this issue, if already
>> planned. Otherwise, please comment on my analysis and proposals as solution,
>> below -
>> [Analysis]
>> Nova's libvirt driver on compute node tries to do a graceful restart of the
>> server instance, by attempting a soft_reboot first. If soft_reboot fails, it
>> attempts a hard_reboot. As part of soft_reboot, it brings down the instance
>> by calling shutdown(), and then calls createWithFlags() to bring this up.
>> Because of this, qemu-kvm process for the instance gets terminated and new
>> process is launched. In QEMU, the chardev file is opened with O_TRUNC, and
>> thus we lose the previous content of the console.log file.
>> On the other-hand, during 'virsh reboot <instance>', the same qemu-kvm
>> process continues, and libvirt actually does a qemuDomainSetFakeReboot().
>> Thus the same file continues capturing the new console output as a
>> continuation into the same file.
> Nova and libvirt have support for issuing a graceful reboot via the QEMU
> guest agent. So if you make sure that is installed, and tell Nova to use
> it, then Nova won't have to stop & recreate the QEMU process and thus
> won't have the problem of overwriting the logs.
Hi Daniel,
Having GA to do graceful restart is nice option. But if it were to just 
preserve the same console file, even 'virsh reboot' achieves the 
purpose. As I explained in my original analysis, Nova seems to have not 
taken the path, as it does not want to have a false positive, where the 
GA does not respond or 'virDomain.reboot' fails later and the domain is 
not really restarted. [ CC-ed vish, author of nova 

IMHO, QEMU should preserve the console-log file for a given domain, if 
it exists, by not opening with O_TRUNC option, instead opening with 
O_APPEND. I would like to draw a comparison of a real computer to which 
we might be connected over serial console, and the box gets powered down 
and up with external button press, and we do not lose the console 
history, if connected. And that's what is the experience console-log 
intends to provide. If you think, this is agreeable, please let me know, 
I will send the patch to qemu-devel at .


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20141222/f1f39eb1/attachment.html>

More information about the OpenStack-dev mailing list