[libvirt] static address assignment via dnsmasq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want my VMs to be assigned static addresses by hostname. I would
prefer to set up a generic way to configure dnsmasq, since I don't think
this is the last thing I'll want to change about address assignment. 

I saw this patch from "Mads Chr. Olesen"

  https://www.redhat.com/archives/libvir-list/2008-April/msg00327.html

But it seems like a lot of work to give access to only one dnsmasq
option.

I'm working on a patch that enables a dnsmasq.d directory where you can
(optionally) put individual configuration files. I have not fully tested
it yet, so please don't consider this an official submission.

I also don't feel that I have spent enough time with the code to
understand the 'philosphy' if you will, the guiding attitudes. Is the
all-XML approach better according the libvirt developer community
standards? If so, why?

Thanks. Untested patch follows. Please let me know if I'm on the right
path and if not, why.

--Kurt

diff -u /root/libvirt-0.4.4-virgin/src/qemu_driver.c ./qemu_driver.c
--- /root/libvirt-0.4.4-virgin/src/qemu_driver.c        2008-06-12
07:52:53.000000000 -0700
+++ ./qemu_driver.c     2008-07-13 11:31:26.000000000 -0700
@@ -1048,6 +1048,7 @@
         1 + /* --bind-interfaces */
         2 + /* --pid-file "" */
         2 + /* --conf-file "" */
+        2 + /* --conf-dir DNSMASQCONF_DIR */
         /*2 + *//* --interface virbr0 */
         2 + /* --except-interface lo */
         2 + /* --listen-address 10.0.0.1 */
@@ -1081,6 +1082,9 @@
     APPEND_ARG(*argv, i++, "--conf-file");
     APPEND_ARG(*argv, i++, "");

+    APPEND_ARG(*argv, i++, "--conf-dir");
+    APPEND_ARG(*argv, i++, DNSMASQCONF_DIR);
+
     /*
      * XXX does not actually work, due to some kind of
      * race condition setting up ipv6 addresses on the
diff -u /root/libvirt-0.4.4-virgin/src/qemu_driver.h ./qemu_driver.h
--- /root/libvirt-0.4.4-virgin/src/qemu_driver.h        2008-04-23
07:19:02.000000000 -0700
+++ ./qemu_driver.h     2008-07-13 11:26:47.000000000 -0700
@@ -33,6 +33,8 @@

 int qemudRegister(void);

+#define DNSMASQCONF_DIR SYSCONF_DIR "/dnsmasq.d"
+
 #endif /* WITH_QEMU */

 #endif /* QEMUD_DRIVER_H */


-- 
----------------------------------------------------------------------
     Merlot Research Group, Inc               kls[at]merlot.com
    "Quality is free, but only to those who are willing to pay 
     heavily for it." (Lister, DeMarco: "Peopleware")

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]