[libvirt] "static" ip address

Hi, I'm using KVM with the wonderful help of libvir (virsh), on a to-be-production-ready server of mine. I would like to be able to choose on a way or another the ip of each of my VM. As far as I can understand, the only way to get an IP (from a vm point of view) if the dhcp it. But I have no garantee vm1 will always get x.x.x.1 Ip adress... Is there a solution please ? (googling this list did'nt answer :() Thanx

Hey,
I'm using KVM with the wonderful help of libvir (virsh), on a to-be-production-ready server of mine.
I would like to be able to choose on a way or another the ip of each of my VM. As far as I can understand, the only way to get an IP (from a vm point of view) if the dhcp it. But I have no garantee vm1 will always get x.x.x.1 Ip adress...
I suppose you are speaking about the NAt-Solution. Have a look at some bridge-Solution: http://libvirt.org/formatnetwork.html#examplesRoute - fabian

On Sat, Aug 2, 2008 at 11:22 PM, Fabian Deutsch <fabian.deutsch@gmx.de>wrote:
Hey,
I'm using KVM with the wonderful help of libvir (virsh), on a to-be-production-ready server of mine.
I would like to be able to choose on a way or another the ip of each of my VM. As far as I can understand, the only way to get an IP (from a vm point of view) if the dhcp it. But I have no garantee vm1 will always get x.x.x.1 Ip adress...
I suppose you are speaking about the NAt-Solution.
Yes. Sorry. My server has 1 public IP address. Host will host an Apache proxying http services hosted by VMs. VMs will have private IP addresses (192.168.0.x). I can not have any other public IP addresses, so bridging is not a solution (AFAICU) Nat seems good choice in my case, I think.
Have a look at some bridge-Solution: http://libvirt.org/formatnetwork.html#examplesRoute
Ok. You are proposing me to use : <network> <name>local</name> <bridge name="virbr1" /> <forward mode="route" dev="eth1"/> <ip address="192.168.122.1" netmask="255.255.255.0"> <dhcp> <range start="192.168.122.2" end="192.168.122.254" /> </dhcp> </ip> </network> I understand this defines a network, where IP address of host in VM-World is 192.168.122.1, and DHCP distributes IP addresses to VMs. Nat is disabled ? I just don't understand how I can specify that VM1 (with its mac address), should have .1 IP address. Natting will be automagic ? I must admit I don't really know how to use routing system, I presume :( Thanx for your help,
<http://libvirt.org/formatnetwork.html#examplesRoute>
- fabian
Olivier.

lør, 02 08 2008 kl. 23:13 +0200, skrev Olivier Deckmyn:
I would like to be able to choose on a way or another the ip of each of my VM. As far as I can understand, the only way to get an IP (from a vm point of view) if the dhcp it. But I have no garantee vm1 will always get x.x.x.1 Ip adress...
This has been discussed previously, see https://www.redhat.com/archives/libvir-list/2008-April/msg00327.html -- Mads Chr. Olesen <shiyee@shiyee.dk> shiyee.dk

Thx. This patch isn't integrated into libvirt yet ? right ? On Sun, Aug 3, 2008 at 7:04 PM, Mads Chr. Olesen <shiyee@shiyee.dk> wrote:
lør, 02 08 2008 kl. 23:13 +0200, skrev Olivier Deckmyn:
I would like to be able to choose on a way or another the ip of each of my VM. As far as I can understand, the only way to get an IP (from a vm point of view) if the dhcp it. But I have no garantee vm1 will always get x.x.x.1 Ip adress...
This has been discussed previously, see https://www.redhat.com/archives/libvir-list/2008-April/msg00327.html
-- Mads Chr. Olesen <shiyee@shiyee.dk> shiyee.dk
-- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

Patch on qemu_conf.c doesn't apply to 0.4.4 released version. Any reason why this feature wasn't commited ? Thnx On Mon, Aug 4, 2008 at 8:15 AM, Olivier Deckmyn <olivier@deckmyn.org> wrote:
Thx. This patch isn't integrated into libvirt yet ? right ?
On Sun, Aug 3, 2008 at 7:04 PM, Mads Chr. Olesen <shiyee@shiyee.dk> wrote:
lør, 02 08 2008 kl. 23:13 +0200, skrev Olivier Deckmyn:
I would like to be able to choose on a way or another the ip of each of my VM. As far as I can understand, the only way to get an IP (from a vm point of view) if the dhcp it. But I have no garantee vm1 will always get x.x.x.1 Ip adress...
This has been discussed previously, see https://www.redhat.com/archives/libvir-list/2008-April/msg00327.html
-- Mads Chr. Olesen <shiyee@shiyee.dk> shiyee.dk
-- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Mon, Aug 4, 2008 at 9:12 AM, <shiyee@shiyee.dk> wrote:
Patch on qemu_conf.c doesn't apply to 0.4.4 released version.
Any reason why this feature wasn't commited ?
Just that I didn't have the time to follow it through properly, and then settled for just using static IP assignments.
Reading this ML since only a few hours, it appears that it would save quite a lot of people :) Cheers, Olivier.
-- Mads Chr. Olesen shiyee@shiyee.dk

Le 4 août 08 à 12:46, "Olivier Deckmyn" <olivier@deckmyn.org> a écrit :
On Mon, Aug 4, 2008 at 9:12 AM, <shiyee@shiyee.dk> wrote:
Patch on qemu_conf.c doesn't apply to 0.4.4 released version.
Any reason why this feature wasn't commited ?
Just that I didn't have the time to follow it through properly, and then settled for just using static IP assignments.
Could someone please commit this patch ? (if l knew how to do it - i would do it myself :() Thx
Reading this ML since only a few hours, it appears that it would save quite a lot of people :)
Cheers,
Olivier.
-- Mads Chr. Olesen shiyee@shiyee.dk

On Sun, Aug 3, 2008 at 7:04 PM, Mads Chr. Olesen <shiyee@shiyee.dk> wrote:
lør, 02 08 2008 kl. 23:13 +0200, skrev Olivier Deckmyn:
I would like to be able to choose on a way or another the ip of each of my VM. As far as I can understand, the only way to get an IP (from a vm point of view) if the dhcp it. But I have no garantee vm1 will always get x.x.x.1 Ip adress...
This has been discussed previously, see https://www.redhat.com/archives/libvir-list/2008-April/msg00327.html
Could someone please commit this patch, allowing libvirt to handle dnsmasq?
-- Mads Chr. Olesen <shiyee@shiyee.dk> shiyee.dk
-- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Fri, Aug 08, 2008 at 09:32:06PM +0200, Olivier Deckmyn wrote:
On Sun, Aug 3, 2008 at 7:04 PM, Mads Chr. Olesen <shiyee@shiyee.dk> wrote:
lør, 02 08 2008 kl. 23:13 +0200, skrev Olivier Deckmyn:
I would like to be able to choose on a way or another the ip of each of my VM. As far as I can understand, the only way to get an IP (from a vm point of view) if the dhcp it. But I have no garantee vm1 will always get x.x.x.1 Ip adress...
This has been discussed previously, see https://www.redhat.com/archives/libvir-list/2008-April/msg00327.html
Could someone please commit this patch, allowing libvirt to handle dnsmasq?
Small reality check for you: - did you try to apply it ? doesn't work: that code has completely changed - did you see the "I haven't had the time to clean it up properly" in the original message ? - libvirt *do* use dnsmasq That said I'm working on a new version of the patch which would be adequate I hope for inclusion, but complaints like this are counter productive and suggestion to blindly apply patches without making sure they work and that the code is in sane state are just improper, sorry ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Tue, Aug 12, 2008 at 5:17 PM, Daniel Veillard <veillard@redhat.com>wrote:
On Fri, Aug 08, 2008 at 09:32:06PM +0200, Olivier Deckmyn wrote:
On Sun, Aug 3, 2008 at 7:04 PM, Mads Chr. Olesen <shiyee@shiyee.dk> wrote:
lør, 02 08 2008 kl. 23:13 +0200, skrev Olivier Deckmyn:
I would like to be able to choose on a way or another the ip of each of my VM. As far as I can understand, the only way to get an IP (from a vm point of view) if the dhcp it. But I have no garantee vm1 will always get x.x.x.1 Ip adress...
This has been discussed previously, see https://www.redhat.com/archives/libvir-list/2008-April/msg00327.html
Could someone please commit this patch, allowing libvirt to handle dnsmasq?
Many thanx for replying to my mail.
Small reality check for you: - did you try to apply it ? doesn't work: that code has completely changed
Yes I did try. But I'm not fluent at all with C (I speak Python), and could'nt apply most part of patches, even by hand.
- did you see the "I haven't had the time to clean it up properly" in the original message ?
Yes I did. "clean" seems, from my lazy chair, a simple operation. Sorry if I made a mistake on this. I know pretty well open-source communities, and I know it's not easy (read : boring) to have an external guy claiming for a feature. I wish I could help more :(
- libvirt *do* use dnsmasq
Yes, and it's the nice news :)
That said I'm working on a new version of the patch which would be adequate
Thanx a lot.
I hope for inclusion, but complaints like this are counter productive and suggestion to blindly apply patches without making sure they work and that the code is in sane state are just improper, sorry !
If I'm the one supposed to complain, I'm really you felt that :( I never thought my reply would be counter-productive. I'm really willing to help :( Once again, if I can do anything to help, I will. Thanx. Olivier.
Daniel
-- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Tue, Aug 12, 2008 at 06:49:59PM +0200, Olivier Deckmyn wrote:
On Tue, Aug 12, 2008 at 5:17 PM, Daniel Veillard <veillard@redhat.com>wrote:
That said I'm working on a new version of the patch which would be adequate
[...] Once again, if I can do anything to help, I will.
Then please try the following patch, tell me if it works for you, I didn't really tried it yet and parallel testing would help. The things to test are: - no crash - the network definition is correctly parsed - virsh network define and dump still work - and IP as provided by dnsmasq as suggested in case of mismatches try to grab the full command line used by libvirtd for dnsmasq and report it in parallel of the XML file used, thanks in advance, Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Tue, Aug 12, 2008 at 03:39:28PM -0400, Daniel Veillard wrote:
On Tue, Aug 12, 2008 at 06:49:59PM +0200, Olivier Deckmyn wrote:
On Tue, Aug 12, 2008 at 5:17 PM, Daniel Veillard <veillard@redhat.com>wrote:
That said I'm working on a new version of the patch which would be adequate
[...] Once again, if I can do anything to help, I will.
Then please try the following patch, tell me if it works for you, I didn't really tried it yet and parallel testing would help. The things to test are: - no crash - the network definition is correctly parsed - virsh network define and dump still work - and IP as provided by dnsmasq as suggested in case of mismatches try to grab the full command line used by libvirtd for dnsmasq and report it in parallel of the XML file used,
okay first bug, I changed the format from <statichost mac="00:16:3E:XX:XX:XX" host="XXX" ip="192.168.122.2" /> to <host mac="00:16:3E:XX:XX:XX" host="XXX" ip="192.168.122.2" /> but made a typo and it parses as <hosts ...> Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Tue, Aug 12, 2008 at 03:39:28PM -0400, Daniel Veillard wrote:
On Tue, Aug 12, 2008 at 06:49:59PM +0200, Olivier Deckmyn wrote:
On Tue, Aug 12, 2008 at 5:17 PM, Daniel Veillard <veillard@redhat.com>wrote:
That said I'm working on a new version of the patch which would be adequate
[...] Once again, if I can do anything to help, I will.
Then please try the following patch, tell me if it works for you, I didn't really tried it yet and parallel testing would help. The things to test are: - no crash - the network definition is correctly parsed - virsh network define and dump still work - and IP as provided by dnsmasq as suggested in case of mismatches try to grab the full command line used by libvirtd for dnsmasq and report it in parallel of the XML file used,
New patch with just a pair of minor fixes which seems to work just fine for me. The syntax is nearly the old one, just use host instead of statichost: <ip address="192.168.122.1" netmask="255.255.255.0"> <dhcp> <range start="192.168.122.4" end="192.168.122.254" /> <host mac="00:16:3E:XX:XX:XX" host="XXX" ip="192.168.122.2" /> <host host="YYY" ip="192.168.122.3" /> </dhcp> </ip> I tried net-edit, net-xmldump, the dnsmasq arguments seems to be properly set, please report, thanks Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Tue, Aug 12, 2008 at 05:24:01PM -0400, Daniel Veillard wrote:
On Tue, Aug 12, 2008 at 03:39:28PM -0400, Daniel Veillard wrote:
On Tue, Aug 12, 2008 at 06:49:59PM +0200, Olivier Deckmyn wrote:
On Tue, Aug 12, 2008 at 5:17 PM, Daniel Veillard <veillard@redhat.com>wrote:
That said I'm working on a new version of the patch which would be adequate
[...] Once again, if I can do anything to help, I will.
Then please try the following patch, tell me if it works for you, I didn't really tried it yet and parallel testing would help. The things to test are: - no crash - the network definition is correctly parsed - virsh network define and dump still work - and IP as provided by dnsmasq as suggested in case of mismatches try to grab the full command line used by libvirtd for dnsmasq and report it in parallel of the XML file used,
New patch with just a pair of minor fixes which seems to work just fine for me. The syntax is nearly the old one, just use host instead of statichost:
<ip address="192.168.122.1" netmask="255.255.255.0"> <dhcp> <range start="192.168.122.4" end="192.168.122.254" /> <host mac="00:16:3E:XX:XX:XX" host="XXX"
Seems a little odd to have 'host' as the element name and attribute name at once. Perhaps the atribute should just be name='XXXX' ?
@@ -1103,6 +1103,8 @@ 2 + /* --listen-address 10.0.0.1 */ 1 + /* --dhcp-leasefile=path */ (2 * network->def->nranges) + /* --dhcp-range 10.0.0.2,10.0.0.254 */ + /* --dhcp-host 01:23:45:67:89:0a,hostname,10.0.0.3 */ + (2 * network->def->nhosts) +
Using the --dhcp-host option means we can't easily update on the fly, but this patch doesn't support on the fly updates anyway, so not a huge deal. In the future we can switch to --dhcp-host-file instead. ACK to including this. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Fri, Aug 15, 2008 at 10:43:15AM +0100, Daniel P. Berrange wrote:
On Tue, Aug 12, 2008 at 05:24:01PM -0400, Daniel Veillard wrote:
New patch with just a pair of minor fixes which seems to work just fine for me. The syntax is nearly the old one, just use host instead of statichost:
<ip address="192.168.122.1" netmask="255.255.255.0"> <dhcp> <range start="192.168.122.4" end="192.168.122.254" /> <host mac="00:16:3E:XX:XX:XX" host="XXX"
Seems a little odd to have 'host' as the element name and attribute name at once. Perhaps the atribute should just be name='XXXX' ?
Agreed, I noticed that but it's not a serious problem, still using name feels cleaner I will change that before commiting !
@@ -1103,6 +1103,8 @@ 2 + /* --listen-address 10.0.0.1 */ 1 + /* --dhcp-leasefile=path */ (2 * network->def->nranges) + /* --dhcp-range 10.0.0.2,10.0.0.254 */ + /* --dhcp-host 01:23:45:67:89:0a,hostname,10.0.0.3 */ + (2 * network->def->nhosts) +
Using the --dhcp-host option means we can't easily update on the fly, but this patch doesn't support on the fly updates anyway, so not a huge deal. In the future we can switch to --dhcp-host-file instead.
ACK to including this.
okay, will push later today, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

Hi, Back from a not-so-funny moment :( I'm impressed by the work done once I was away ! Thanx ! I've tried to test it : - uninstalled debian package libvirt-bin (running ubuntu server 8.04 LTS) - checked-out CVS version - ./autobuild.sh --with-xen=no - make - sudo make install Running virsh tells it's impossible to connect to hypervisor. Even if I force -c qemu:/// If I try to run /usr/local/sbin/libvirtd, I get a : odeckmyn@everest:/usr/local/bin$ sudo /usr/local/sbin/libvirtd /usr/local/sbin/libvirtd: symbol lookup error: /usr/local/sbin/libvirtd: undefined symbol: __virAlloc Did I do something wrong or is CVS version unstable today ? May be I should wait for the .deb version ? Thanx, Olivier. On Tue, Aug 19, 2008 at 12:08 PM, Daniel Veillard <veillard@redhat.com>wrote:
On Fri, Aug 15, 2008 at 10:43:15AM +0100, Daniel P. Berrange wrote:
On Tue, Aug 12, 2008 at 05:24:01PM -0400, Daniel Veillard wrote:
New patch with just a pair of minor fixes which seems to work just fine for me. The syntax is nearly the old one, just use host instead of statichost:
<ip address="192.168.122.1" netmask="255.255.255.0"> <dhcp> <range start="192.168.122.4" end="192.168.122.254" /> <host mac="00:16:3E:XX:XX:XX" host="XXX"
Seems a little odd to have 'host' as the element name and attribute name at once. Perhaps the atribute should just be name='XXXX' ?
Agreed, I noticed that but it's not a serious problem, still using name feels cleaner I will change that before commiting !
@@ -1103,6 +1103,8 @@ 2 + /* --listen-address 10.0.0.1 */ 1 + /* --dhcp-leasefile=path */ (2 * network->def->nranges) + /* --dhcp-range 10.0.0.2, 10.0.0.254 */ + /* --dhcp-host 01:23:45:67:89:0a,hostname,10.0.0.3 */ + (2 * network->def->nhosts) +
Using the --dhcp-host option means we can't easily update on the fly, but this patch doesn't support on the fly updates anyway, so not a huge deal. In the future we can switch to --dhcp-host-file instead.
ACK to including this.
okay, will push later today,
thanks !
Daniel
-- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Mon, Aug 25, 2008 at 07:17:04PM +0200, Olivier Deckmyn wrote:
Hi, Back from a not-so-funny moment :(
I'm impressed by the work done once I was away ! Thanx !
I've tried to test it :
- uninstalled debian package libvirt-bin (running ubuntu server 8.04 LTS)
no idea what libvirt-bin includes or not
- checked-out CVS version - ./autobuild.sh --with-xen=no
I would assume --prefix=/usr is needed there
- make - sudo make install
With rpm I would rather try to make a local updated package and then update the version on the system. No idea if that's doable or how with Debian/Ubuntu Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

Olivier Deckmyn wrote:
Hi,
Back from a not-so-funny moment :(
I'm impressed by the work done once I was away ! Thanx !
I've tried to test it :
- uninstalled debian package libvirt-bin (running ubuntu server 8.04 LTS) - checked-out CVS version - ./autobuild.sh --with-xen=no - make - sudo make install
Running virsh tells it's impossible to connect to hypervisor. Even if I force -c qemu:/// If I try to run /usr/local/sbin/libvirtd, I get a :
odeckmyn@everest:/usr/local/bin$ sudo /usr/local/sbin/libvirtd /usr/local/sbin/libvirtd: symbol lookup error: /usr/local/sbin/libvirtd: undefined symbol: __virAlloc
My guess would be that you have the libvirt library installed in two places. Probably you have your distro's libvirt installed, which means it is picking that up as the shared library first and never looking in /usr/local for your "updated" libvirt shared library. My advice would be to remove your distros version of libvirt, and then try again. Chris Lalancette

On Fri, Aug 15, 2008 at 10:43:15AM +0100, Daniel P. Berrange wrote:
On Tue, Aug 12, 2008 at 05:24:01PM -0400, Daniel Veillard wrote:
New patch with just a pair of minor fixes which seems to work just fine for me. The syntax is nearly the old one, just use host instead of statichost:
<ip address="192.168.122.1" netmask="255.255.255.0"> <dhcp> <range start="192.168.122.4" end="192.168.122.254" /> <host mac="00:16:3E:XX:XX:XX" host="XXX"
Seems a little odd to have 'host' as the element name and attribute name at once. Perhaps the atribute should just be name='XXXX' ?
Okidoc, so I commited the patch but changed the attribute to name instead of host, nicer and makes more sense, thanks, Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
participants (7)
-
Chris Lalancette
-
Daniel P. Berrange
-
Daniel Veillard
-
Fabian Deutsch
-
Mads Chr. Olesen
-
Olivier Deckmyn
-
shiyee@shiyee.dk