Bug 729207 - /var/lib/libvirt/dnsmasq/default.hostsfile lags behind changes
Summary: /var/lib/libvirt/dnsmasq/default.hostsfile lags behind changes
Status: CLOSED DUPLICATE of bug 727982
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.1
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Laine Stump
QA Contact: Virtualization Bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2011-08-09 03:49 UTC by Laine Stump
Modified: 2011-08-09 06:05 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 713728
Last Closed: 2011-08-09 06:05:44 UTC

Attachments (Terms of Use)

Description Laine Stump 2011-08-09 03:49:44 UTC
+++ This bug was initially created as a clone of Bug #713728 +++

Description of problem:
When editing a network in virsh ('net-edit default', 'net-destroy/start default') to e.g. add a new MAC/IP static address combo, /var/lib/libvirt/dnsmasq/default.hostsfile seems to lag one "version" behind, i.e. carries combos only from the previous edit. To make the current ones effective, changing an unrelated one (e.g. change a hex digit from upper to lowercase) then destroying/restarting the network helps (the unrelated change is only effective on the next change though).

I haven't found this issue in RH/Fedora Bugzilla, but googling gave me an open ticket on Launchpad for Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/584910

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. 'net-edit default', then add a new static DHCP mapping to the default network (e.g. <host mac='FF:FF:EE:EE:DD:DD' ip='' />)
2. 'net-destroy default'
3. 'net-start default'
4. 'grep FF:FF:EE:EE:DD:DD /var/lib/libvirt/dnsmasq/default.hostsfile'
Actual results:

Expected results:

BTW, I noticed that destroying/starting the network makes it unusable on running guests without rebooting them (they don't ping, restarting the network service in the guest or equivalent doesn't help). Is that expected/intentional or are there ways to add a new static MAC/IP address combo without having to reboot other running guests?

--- Additional comment from nphilipp@redhat.com on 2011-08-03 09:13:50 EDT ---


--- Additional comment from crobinso@redhat.com on 2011-08-03 10:23:30 EDT ---

Laine, any thoughts?

--- Additional comment from laine@redhat.com on 2011-08-03 16:34:58 EDT ---

The problem is that when an active network is re-defined, the new data is stored in network->newDef, but the code that builds the new hosts files uses network->def (the old version of the config). If the network is inactive at the time it's redefined, then the new data is stored directly into network->def, and it takes effect immediately.

I just posted a patch upstream to fix the problem:


Comment 1 Laine Stump 2011-08-09 04:02:38 UTC
commit 3aa84653d1c457b1c12efd4b8449e31525042254
Author: Laine Stump <laine@laine.org>
Date:   Wed Aug 3 15:33:24 2011 -0400

    network: eliminate lag in updating dnsmasq hosts files

    This addresses https://bugzilla.redhat.com/show_bug.cgi?id=713728

    When "defining" a new network (or one that exists but isn't currently
    active) the new definition is stored in network->def, but for a
    network that already exists and is active, the new definition is
    stored in network->newDef, and then moved over to network->def as soon
    as the network is destroyed.

    However, the code that writes the dhcp and dns hosts files used by
    dnsmasq was always using network->def for its information, even when
    the new data was actually in network->newDef, so the hosts files
    always lagged one edit behind the definition.

    This patch changes the code to keep the pointer to the new definition
    after it's been assigned into the network, and use it directly
    (regardless of whether it's stored in network->newDef or network->def)
    to construct the hosts files.

This same patch has also been posted to rhvirt-patches for inclusion in


Comment 2 Daniel Veillard 2011-08-09 06:05:44 UTC

*** This bug has been marked as a duplicate of bug 727982 ***

Note You need to log in before you can comment on or make changes to this bug.