Red Hat Bugzilla – Bug 595323
Can't change dhcp settings of network without stopping network.
Last modified: 2015-03-16 11:18:57 EDT
Description of problem:
Doesn't appear to be a way of changing/augmenting the dhcp section of a network without stopping and restarting the network (and thereby interrupting network connectivity for all currently running VMs).
Version-Release number of selected component (if applicable): all
Add additional 'host' elements to dhcp section within network, or extend the range. It should then be possible to 'restart' the dhcp system without interrupting the network for existing clients.
This is probably a design issue and suggests that the close coupling of the dhcp service with the network probably needs looking at.
The virNetworkUpdate API allows changing the dhcp hosts now:
Author: Laine Stump <firstname.lastname@example.org>
AuthorDate: 2012-09-19 07:38:43 -0400
Commit: Laine Stump <email@example.com>
CommitDate: 2012-09-20 22:20:22 -0400
virsh: new net-update command
This command uses the new virNetworkUpdate() API to modify an existing
network definition, and optionally have those modifications take
effect immediately without restarting the network.
An example usage:
virsh net-update mynet add-last ip-dhcp-host \
"<host mac='00:11:22:33:44:55' ip='192.168.122.45'/>" \
If you like, you can instead put the xml into a file, and call like
virsh net-update mynet add ip-dhcp-host /tmp/myxml.xml
virsh will autodetect whether the argument is itself an xml element,
or if it's a file, by looking at the first character - the first
character of an xml element is always "<", and the first character of
a file is almost always *not* "<" (in the rare case that it is, the
user could specify "./<filename...").
A --parent-index option is also available (to give the index within a
list of parent objects, e.g. the index of the parent <ip> element when
updating ip-dhcp-host elements), but is optional and at least for now
will probably be used rarely.
--live, --config, and --current options - if you specify --live, only
the live state of the network will be updated. If you also specify
--config, then the persistent configuration will also be updated;
these two commands can be given separately, or both together. If you
don't specify either (you can optionally specify "--current" for the
same effect), then the "current" config will be updated (i.e. if the
network is active, then only its live config is affected, but if the
network is inactive, only the persistent config is affected).
git describe: v0.10.2-rc1-38-gfe78728 contains: v0.10.2-rc2~3
And the dhcp range as well:
Author: Laine Stump <firstname.lastname@example.org>
AuthorDate: 2012-09-20 22:25:40 -0400
Commit: Daniel Veillard <email@example.com>
CommitDate: 2012-09-21 11:54:16 +0800
network: backend for virNetworkUpdate of dhcp range
The dhcp range element is contained in the <dhcp> element of one of a
network's <ip> elements. There can be multiple <range>
elements. Because there are only two attributes (start and end), and
those are exactly what you would use to identify a particular range,
it doesn't really make sense to modify an existing element, so
VIR_NETWORK_UPDATE_COMMAND_MODIFY isn't supported for this section,
only ADD_FIRST, ADD_LAST, and DELETE.
Since virsh already has support for understanding all the defined
sections, this new backend is automatically supported by virsh. You
would use it like this:
virsh net-update mynet add ip-dhcp-range \
"<range start='18.104.22.168' end='22.214.171.124'/>" --live --config
The bridge driver also already supports all sections, so it's doing
the correct thing in this case as well - since the dhcp range is
placed on the dnsmasq commandline, the bridge driver recreates the
dnsmasq commandline, and re-runs dnsmasq whenever a range is
added/deleted (and AFFECT_LIVE is specified in the flags).
git describe: v0.10.2-rc1-39-g1100f61 contains: v0.10.2-rc2~2