Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Created attachment 501033[details]
libvirtd.log
Description of problem:
When restarting libvirtd just after creating a domain - the new libvirtd process wont know about the created domain.
in this case another identical domain can be created (split-brain, data-corruption).
Version-Release number of selected component (if applicable):
libvirt-0.9.1-1.el6.x86_64
How reproducible:
100%
Steps to Reproduce:
1. virsh create /tmp/david.vm & service libvirtd restart
Actual results:
]# virsh -r list
Id Name State
----------------------------------
# pgrep qemu
31716
Expected results:
domain should be tracked after restart
Additional info:
libvirtd log attached.
There are two issues here... First one is that we call virDomainSaveStatus very late in the startup process so we can even end up with a completely running qemu (with CPUs running as well) but restarted libvirtd won't still knew about it. The second is that we do store domain PID files but we don't seem to do anything useful with them; we just delete it if it's there.
Patch sent upstream: https://www.redhat.com/archives/libvir-list/2011-July/msg00739.html
I used gdb for testing :-) You can use the following script as emulator instead of /usr/libexec/qemu-kvm:
#! /bin/bash
if echo "$*" | grep -q monitor; then
sleep 10
fi
exec /usr/libexec/qemu-kvm "$@"
This will delay qemu start by 10 seconds so that you can watch libvirtd debug logs and kill libvirtd once you see "Waiting for monitor to show up". Then wait until the sleep finishes and qemu process starts and start libvirtd again, the new process should disappear.
Pushed upstream as v0.9.3-136-g5169e5e:
commit 5169e5ea38126bd2686c04d36b396f9e73a32dab
Author: Jiri Denemark <jdenemar>
Date: Tue Jul 12 11:45:16 2011 +0200
qemu: Save domain status ASAP after creating qemu process
When creating new qemu process we saved domain status XML only after the
process was fully setup and running. In case libvirtd was killed before
the whole process finished, once libvirtd started again it didn't know
anything about the new process and we end up with an orphaned qemu
process. Let's save the domain status XML as soon as we know the PID so
that libvirtd can kill the process on restart.
It's hard to reproduce the bug.
Adjust the sleep time many times like the follows:
#virsh create /tmp/rhel.xml & usleep 400000; service libvirtd restart
couldn't reproduce it.
According to Comment 6, it always reports the following errors when I kill the libvirtd during sleep.
error: Failed to create domain from /tmp/rhel.xml
error: End of file while reading data: Input/output error
(In reply to comment #10)
> Hi, dnaori
>
> Could you help to check if it's okay for you with the latest version of libvirt
> ?
>
> Thanks
Can you follow up on this and make sure that David has tested it?
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
http://rhn.redhat.com/errata/RHBA-2011-1513.html
Created attachment 501033 [details] libvirtd.log Description of problem: When restarting libvirtd just after creating a domain - the new libvirtd process wont know about the created domain. in this case another identical domain can be created (split-brain, data-corruption). Version-Release number of selected component (if applicable): libvirt-0.9.1-1.el6.x86_64 How reproducible: 100% Steps to Reproduce: 1. virsh create /tmp/david.vm & service libvirtd restart Actual results: ]# virsh -r list Id Name State ---------------------------------- # pgrep qemu 31716 Expected results: domain should be tracked after restart Additional info: libvirtd log attached.