[libvirt] [PATCH] docs: Fix installation of internals/*.html
by Cole Robinson
We were just installing them in the top level html directory, which
broke navigation and overwrote other pages.
https://bugzilla.redhat.com/show_bug.cgi?id=837825
---
docs/Makefile.am | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 91c3d33..4fea3a0 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -71,8 +71,14 @@ gif = \
architecture.gif \
node.gif
-dot_html_in = $(notdir $(wildcard $(srcdir)/*.html.in)) todo.html.in hvsupport.html.in \
- $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/internals/*.html.in))
+
+internals_html_in = \
+ $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/internals/*.html.in))
+internals_html = $(internals_html_in:%.html.in=%.html)
+
+dot_html_in = $(notdir $(wildcard $(srcdir)/*.html.in)) \
+ todo.html.in \
+ hvsupport.html.in
dot_html = $(dot_html_in:%.html.in=%.html)
dot_php_in = $(notdir $(wildcard $(srcdir)/*.php.in))
@@ -112,6 +118,7 @@ EXTRA_DIST= \
$(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \
$(xml) $(qemu_xml) $(fig) $(png) $(css) \
$(patches) $(dot_php_in) $(dot_php_code_in) $(dot_php)\
+ $(internals_html_in) $(internals_html) \
sitemap.html.in \
todo.pl hvsupport.pl todo.cfg-example
@@ -119,6 +126,7 @@ MAINTAINERCLEANFILES = \
$(addprefix $(srcdir)/,$(dot_html)) \
$(addprefix $(srcdir)/,$(apihtml)) \
$(addprefix $(srcdir)/,$(devhelphtml)) \
+ $(addprefix $(srcdir)/,$(internals_html)) \
$(addprefix $(srcdir)/,$(dot_php))
all-am: web
@@ -126,7 +134,8 @@ all-am: web
api: $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml
qemu_api: $(srcdir)/libvirt-qemu-api.xml $(srcdir)/libvirt-qemu-refs.xml
-web: $(dot_html) html/index.html devhelp/index.html $(dot_php)
+web: $(dot_html) $(internals_html) html/index.html devhelp/index.html \
+ $(dot_php)
todo.html.in: todo.pl
if [ -f todo.cfg ]; then \
@@ -256,6 +265,9 @@ install-data-local:
$(INSTALL) -m 0644 $(srcdir)/$$h $(DESTDIR)$(HTML_DIR)/html; done
for p in $(apipng); do \
$(INSTALL) -m 0644 $(srcdir)/$$p $(DESTDIR)$(HTML_DIR)/html; done
+ $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/internals
+ for f in $(internals_html); do \
+ $(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR)/internals; done
$(mkinstalldirs) $(DESTDIR)$(DEVHELP_DIR)
for file in $(devhelphtml) $(devhelppng) $(devhelpcss); do \
$(INSTALL) -m 0644 $(srcdir)/$${file} $(DESTDIR)$(DEVHELP_DIR) ; \
--
1.7.11.7
12 years, 1 month
[libvirt] [PATCH] spec: Fix multilib issue with systemtap tapsets
by Cole Robinson
If building on a 64bit host, rename the affected tapsets to <name>-64.stp.
This is similar to what the python package does in fedora.
https://bugzilla.redhat.com/show_bug.cgi?id=831425
---
libvirt.spec.in | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index b3b280b..ac70465 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1384,6 +1384,15 @@ mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-%{version} \
sed -i -e "s|$RPM_BUILD_ROOT||g" $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/libvirt-guests
%endif
+%if %{with_dtrace}
+%ifarch %{power64} s390x x86_64 ia64 alpha sparc64
+mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_probes.stp \
+ $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_probes-64.stp
+mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp \
+ $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes-64.stp
+%endif
+%endif
+
%clean
rm -fr %{buildroot}
@@ -1835,8 +1844,8 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd
%{_libdir}/lib*.so.*
%if %{with_dtrace}
-%{_datadir}/systemtap/tapset/libvirt_probes.stp
-%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp
+%{_datadir}/systemtap/tapset/libvirt_probes*.stp
+%{_datadir}/systemtap/tapset/libvirt_qemu_probes*.stp
%{_datadir}/systemtap/tapset/libvirt_functions.stp
%endif
--
1.7.11.7
12 years, 1 month
[libvirt] [PATCH] qemu: Don't use -enable-nesting with qemu 1.2.0+
by Cole Robinson
Since the option doesn't exist. Fixes booting with
cpu mode='host-model' and qemu 1.2.0
---
src/qemu/qemu_capabilities.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index c9a4ab7..d691d51 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2162,7 +2162,6 @@ qemuCapsInitQMPBasic(qemuCapsPtr caps)
qemuCapsSet(caps, QEMU_CAPS_NODEFCONFIG);
qemuCapsSet(caps, QEMU_CAPS_BOOT_MENU);
qemuCapsSet(caps, QEMU_CAPS_FSDEV);
- qemuCapsSet(caps, QEMU_CAPS_NESTING);
qemuCapsSet(caps, QEMU_CAPS_NAME_PROCESS);
qemuCapsSet(caps, QEMU_CAPS_DRIVE_READONLY);
qemuCapsSet(caps, QEMU_CAPS_SMBIOS_TYPE);
--
1.7.11.7
12 years, 1 month
[libvirt] [PATCH] put dnsmasq parameters into a file instead of the command line
by Gene Czarcinski
This patch changes the way parameters are passed to dnsmasq. They are
put into a conf-file instead of being on the dnsmasq command line.
This patch includes the --interface patch and has updated the related
tests for the new data format, etc. **NOTE**
The command line now contains --conf-file=<filename> and a new
parameter --conf-dir=<directoryname> has been added.
The new file and directory are put in the same directory as the
leases file.
---
src/network/bridge_driver.c | 245 ++++++++++++---------
src/network/bridge_driver.h | 8 +-
tests/networkxml2argvdata/isolated-network.argv | 25 ++-
.../networkxml2argvdata/nat-network-dns-hosts.argv | 15 +-
.../nat-network-dns-srv-record-minimal.argv | 36 +--
.../nat-network-dns-srv-record.argv | 36 +--
.../nat-network-dns-txt-record.argv | 30 ++-
tests/networkxml2argvdata/nat-network.argv | 28 ++-
tests/networkxml2argvdata/netboot-network.argv | 29 ++-
.../networkxml2argvdata/netboot-proxy-network.argv | 26 ++-
tests/networkxml2argvdata/routed-network.argv | 13 +-
tests/networkxml2argvtest.c | 44 +---
12 files changed, 296 insertions(+), 239 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 8837843..137e480 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -65,7 +65,6 @@
#include "virnetdevtap.h"
#include "virnetdevvportprofile.h"
#include "virdbus.h"
-#include "virfile.h"
#define NETWORK_PID_DIR LOCALSTATEDIR "/run/libvirt/network"
#define NETWORK_STATE_DIR LOCALSTATEDIR "/lib/libvirt/network"
@@ -136,6 +135,16 @@ networkDnsmasqLeaseFileNameFunc networkDnsmasqLeaseFileName =
networkDnsmasqLeaseFileNameDefault;
static char *
+networkDnsmasqConfigFileName(const char *netname)
+{
+ char *conffile;
+
+ ignore_value(virAsprintf(&conffile, DNSMASQ_STATE_DIR "/%s.conf",
+ netname));
+ return conffile;
+}
+
+static char *
networkRadvdPidfileBasename(const char *netname)
{
/* this is simple but we want to be sure it's consistently done */
@@ -559,23 +568,25 @@ networkBuildDnsmasqHostsfile(dnsmasqContext *dctx,
return 0;
}
-
+ /* build the dnsmasq conf file contents */
static int
-networkBuildDnsmasqArgv(virNetworkObjPtr network,
+networkDnsmasqConfContents(virNetworkObjPtr network,
virNetworkIpDefPtr ipdef,
const char *pidfile,
- virCommandPtr cmd,
+ char **configstr,
dnsmasqContext *dctx)
{
- int r, ret = -1;
+ virBuffer configbuf = VIR_BUFFER_INITIALIZER;;
+ int r, ret = -1, ii;
int nbleases = 0;
- int ii;
char *record = NULL;
char *recordPort = NULL;
char *recordWeight = NULL;
char *recordPriority = NULL;
virNetworkIpDefPtr tmpipdef;
+ *configstr = NULL;
+
/*
* NB, be careful about syntax for dnsmasq options in long format.
*
@@ -595,28 +606,22 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
* very explicit on this.
*/
- /*
- * Needed to ensure dnsmasq uses same algorithm for processing
- * multiple namedriver entries in /etc/resolv.conf as GLibC.
- */
- virCommandAddArgList(cmd, "--strict-order", "--bind-interfaces", NULL);
-
+ /* create dnsmasq config file appropriate for this network */
+ virBufferAsprintf(&configbuf, "# dnsmasq conf file created by libvirt\n"
+ "strict-order\n"
+ "bind-interfaces\n"
+ "except-interface=lo\n"
+ "domain-needed\n"
+ "local=/%s/\n",
+ network->def->domain ? network->def->domain : "");
if (network->def->domain)
- virCommandAddArgPair(cmd, "--domain", network->def->domain);
- /* need to specify local even if no domain specified */
- virCommandAddArgFormat(cmd, "--local=/%s/",
- network->def->domain ? network->def->domain : "");
- virCommandAddArg(cmd, "--domain-needed");
+ virBufferAsprintf(&configbuf,
+ "domain=%s\n"
+ "expand-hosts\n",
+ network->def->domain);
if (pidfile)
- virCommandAddArgPair(cmd, "--pid-file", pidfile);
-
- /* *no* conf file */
- virCommandAddArg(cmd, "--conf-file=");
-
- virCommandAddArgList(cmd,
- "--except-interface", "lo",
- NULL);
+ virBufferAsprintf(&configbuf, "pid-file=%s\n", pidfile);
/* If this is an isolated network, set the default route option
* (3) to be empty to avoid setting a default route that's
@@ -626,16 +631,21 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
* to build a connection to the outside).
*/
if (network->def->forwardType == VIR_NETWORK_FORWARD_NONE) {
- virCommandAddArgList(cmd, "--dhcp-option=3",
- "--no-resolv", NULL);
+ virBufferAsprintf(&configbuf, "dhcp-option=3\n"
+ "no-resolv\n");
}
+ /*
+ * Needed to ensure dnsmasq uses same algorithm for processing
+ * multiple namedriver entries in /etc/resolv.conf as GLibC.
+ */
+
if (network->def->dns != NULL) {
virNetworkDNSDefPtr dns = network->def->dns;
int i;
for (i = 0; i < dns->ntxtrecords; i++) {
- virCommandAddArgFormat(cmd, "--txt-record=%s,%s",
+ virBufferAsprintf(&configbuf, "txt-record=%s,%s\n",
dns->txtrecords[i].name,
dns->txtrecords[i].value);
}
@@ -673,7 +683,7 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
goto cleanup;
}
- virCommandAddArgPair(cmd, "--srv-host", record);
+ virBufferAsprintf(&configbuf, "srv-host=%s\n", record);
VIR_FREE(record);
VIR_FREE(recordPort);
VIR_FREE(recordWeight);
@@ -682,21 +692,20 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
}
}
- /*
- * --interface does not actually work with dnsmasq < 2.47,
- * due to DAD for ipv6 addresses on the interface.
- *
- * virCommandAddArgList(cmd, "--interface", ipdef->bridge, NULL);
- *
- * So listen on all defined IPv[46] addresses
+ /* This must be defined so that the kernel knows which dnsmasq to route
+ * packets to when more than one instance if running
*/
+ if (network->def->bridge != NULL)
+ virBufferAsprintf(&configbuf, "interface=%s\n", network->def->bridge);
+
for (ii = 0;
(tmpipdef = virNetworkDefGetIpByIndex(network->def, AF_UNSPEC, ii));
- ii++) {
+ ii++)
+ {
char *ipaddr = virSocketAddrFormat(&tmpipdef->address);
if (!ipaddr)
goto cleanup;
- virCommandAddArgList(cmd, "--listen-address", ipaddr, NULL);
+ virBufferAsprintf(&configbuf, "listen-address=%s\n", ipaddr);
VIR_FREE(ipaddr);
}
@@ -710,8 +719,8 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
VIR_FREE(saddr);
goto cleanup;
}
- virCommandAddArg(cmd, "--dhcp-range");
- virCommandAddArgFormat(cmd, "%s,%s", saddr, eaddr);
+ virBufferAsprintf(&configbuf, "dhcp-range=%s,%s\n",
+ saddr, eaddr);
VIR_FREE(saddr);
VIR_FREE(eaddr);
nbleases += virSocketAddrGetRange(&ipdef->ranges[r].start,
@@ -727,8 +736,7 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
char *bridgeaddr = virSocketAddrFormat(&ipdef->address);
if (!bridgeaddr)
goto cleanup;
- virCommandAddArg(cmd, "--dhcp-range");
- virCommandAddArgFormat(cmd, "%s,static", bridgeaddr);
+ virBufferAsprintf(&configbuf, "dhcp-range=%s,static\n", bridgeaddr);
VIR_FREE(bridgeaddr);
}
@@ -736,17 +744,13 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
char *leasefile = networkDnsmasqLeaseFileName(network->def->name);
if (!leasefile)
goto cleanup;
- virCommandAddArgFormat(cmd, "--dhcp-leasefile=%s", leasefile);
+ virBufferAsprintf(&configbuf, "dhcp-leasefile=%s\n", leasefile);
VIR_FREE(leasefile);
- virCommandAddArgFormat(cmd, "--dhcp-lease-max=%d", nbleases);
+ virBufferAsprintf(&configbuf, "dhcp-lease-max=%d\n", nbleases);
}
if (ipdef->nranges || ipdef->nhosts)
- virCommandAddArg(cmd, "--dhcp-no-override");
-
- /* add domain to any non-qualified hostnames in /etc/hosts or addn-hosts */
- if (network->def->domain)
- virCommandAddArg(cmd, "--expand-hosts");
+ virBufferAsprintf(&configbuf, "dhcp-no-override\n");
if (networkBuildDnsmasqHostsfile(dctx, ipdef, network->def->dns) < 0)
goto cleanup;
@@ -756,38 +760,42 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
* file to allow for runtime additions.
*/
if (ipdef->nranges || ipdef->nhosts)
- virCommandAddArgPair(cmd, "--dhcp-hostsfile",
+ virBufferAsprintf(&configbuf, "dhcp-hostsfile=%s\n",
dctx->hostsfile->path);
/* Likewise, always create this file and put it on the commandline, to allow for
* for runtime additions.
*/
- virCommandAddArgPair(cmd, "--addn-hosts",
+ virBufferAsprintf(&configbuf, "addn-hosts=%s\n",
dctx->addnhostsfile->path);
if (ipdef->tftproot) {
- virCommandAddArgList(cmd, "--enable-tftp",
- "--tftp-root", ipdef->tftproot,
- NULL);
+ virBufferAsprintf(&configbuf, "enable-tftp\n");
+ virBufferAsprintf(&configbuf, "tftp-root=%s\n", ipdef->tftproot);
}
if (ipdef->bootfile) {
- virCommandAddArg(cmd, "--dhcp-boot");
if (VIR_SOCKET_ADDR_VALID(&ipdef->bootserver)) {
char *bootserver = virSocketAddrFormat(&ipdef->bootserver);
if (!bootserver)
goto cleanup;
- virCommandAddArgFormat(cmd, "%s%s%s",
+ virBufferAsprintf(&configbuf, "dhcp-boot=%s%s%s\n",
ipdef->bootfile, ",,", bootserver);
VIR_FREE(bootserver);
} else {
- virCommandAddArg(cmd, ipdef->bootfile);
+ virBufferAsprintf(&configbuf, "dhcp-boot=%s\n", ipdef->bootfile);
}
}
}
+ if (!(*configstr = virBufferContentAndReset(&configbuf))) {
+ virReportOOMError();
+ goto cleanup;
+ }
ret = 0;
+
cleanup:
+ virBufferFreeAndReset(&configbuf);
VIR_FREE(record);
VIR_FREE(recordPort);
VIR_FREE(recordWeight);
@@ -795,13 +803,18 @@ cleanup:
return ret;
}
+ /* build the dnsmasq command line */
int
networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network, virCommandPtr *cmdout,
- char *pidfile, dnsmasqContext *dctx)
+ char *pidfile, dnsmasqContext *dctx,
+ char *configdir,
+ int testOnly, char **testConfigStr)
{
virCommandPtr cmd = NULL;
int ret = -1, ii;
virNetworkIpDefPtr ipdef;
+ char *configfile = NULL;
+ char *configstr = NULL;
network->dnsmasqPid = -1;
@@ -825,15 +838,41 @@ networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network, virCommandPtr *cmdou
if (!virNetworkDefGetIpByIndex(network->def, AF_UNSPEC, 0))
return 0;
- cmd = virCommandNew(DNSMASQ);
- if (networkBuildDnsmasqArgv(network, ipdef, pidfile, cmd, dctx) < 0) {
+ if (networkDnsmasqConfContents(network, ipdef, pidfile, &configstr, dctx) < 0)
+ goto cleanup;
+ if (!configstr)
+ goto cleanup;
+
+ if (testOnly) {
+ *testConfigStr = configstr;
+ return 0;
+ }
+
+ /* construct the filename */
+ if (!(configfile = networkDnsmasqConfigFileName(network->def->name))) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ /* Write the file */
+ if (virFileWriteStr(configfile, configstr, 0600) < 0) {
+ virReportSystemError(errno,
+ _("couldn't write dnsmasq config file '%s'"),
+ configfile);
goto cleanup;
}
+ VIR_INFO("dnsmasq conf file %s written", configfile);
+
+ cmd = virCommandNew(DNSMASQ);
+ virCommandAddArgFormat(cmd, "--conf-file=%s", configfile);
+ virCommandAddArgFormat(cmd, "--conf-dir=%s", configdir);
if (cmdout)
*cmdout = cmd;
ret = 0;
cleanup:
+ VIR_FREE(configstr);
+ VIR_FREE(configfile);
if (ret < 0)
virCommandFree(cmd);
return ret;
@@ -844,9 +883,12 @@ networkStartDhcpDaemon(virNetworkObjPtr network)
{
virCommandPtr cmd = NULL;
char *pidfile = NULL;
+ char *testconfigstr = NULL;
+ char *configdir = NULL;
int ret = -1;
dnsmasqContext *dctx = NULL;
+ VIR_INFO("starting dhcp daemon (dnsmasq)");
if (!virNetworkDefGetIpByIndex(network->def, AF_UNSPEC, 0)) {
/* no IPv6 addresses, so we don't need to run radvd */
ret = 0;
@@ -882,7 +924,18 @@ networkStartDhcpDaemon(virNetworkObjPtr network)
if (dctx == NULL)
goto cleanup;
- ret = networkBuildDhcpDaemonCommandLine(network, &cmd, pidfile, dctx);
+ ignore_value(virAsprintf(&configdir, DNSMASQ_STATE_DIR "/%s.d",
+ network->def->name));
+ if (virFileMakePath(configdir) < 0) {
+ virReportSystemError(errno,
+ _("cannot create directory %s"),
+ configdir);
+ goto cleanup;
+ }
+
+
+ ret = networkBuildDhcpDaemonCommandLine(network, &cmd, pidfile, dctx,
+ configdir, 0, &testconfigstr);
if (ret < 0)
goto cleanup;
@@ -911,6 +964,7 @@ networkStartDhcpDaemon(virNetworkObjPtr network)
ret = 0;
cleanup:
VIR_FREE(pidfile);
+ VIR_FREE(configdir);
virCommandFree(cmd);
dnsmasqContextFree(dctx);
return ret;
@@ -988,22 +1042,19 @@ networkRestartDhcpDaemon(virNetworkObjPtr network)
static int
networkRadvdConfContents(virNetworkObjPtr network, char **configstr)
{
- virBuffer configbuf = VIR_BUFFER_INITIALIZER;
+ virBuffer configbuf = VIR_BUFFER_INITIALIZER;;
int ret = -1, ii;
virNetworkIpDefPtr ipdef;
bool v6present = false;
*configstr = NULL;
- /* create radvd config file appropriate for this network;
- * IgnoreIfMissing allows radvd to start even when the bridge is down
- */
+ /* create radvd config file appropriate for this network */
virBufferAsprintf(&configbuf, "interface %s\n"
"{\n"
" AdvSendAdvert on;\n"
" AdvManagedFlag off;\n"
" AdvOtherConfigFlag off;\n"
- " IgnoreIfMissing on;\n"
"\n",
network->def->bridge);
@@ -2072,7 +2123,6 @@ networkStartNetworkVirtual(struct network_driver *driver,
virErrorPtr save_err = NULL;
virNetworkIpDefPtr ipdef;
char *macTapIfName = NULL;
- int tapfd = -1;
/* Check to see if any network IP collides with an existing route */
if (networkCheckRouteCollision(network) < 0)
@@ -2094,13 +2144,10 @@ networkStartNetworkVirtual(struct network_driver *driver,
virReportOOMError();
goto err0;
}
- /* Keep tun fd open and interface up to allow for IPv6 DAD to happen */
if (virNetDevTapCreateInBridgePort(network->def->bridge,
&macTapIfName, &network->def->mac,
- NULL, &tapfd, NULL, NULL,
- VIR_NETDEV_TAP_CREATE_USE_MAC_FOR_BRIDGE |
- VIR_NETDEV_TAP_CREATE_IFUP |
- VIR_NETDEV_TAP_CREATE_PERSIST) < 0) {
+ NULL, NULL, NULL, NULL,
+ VIR_NETDEV_TAP_CREATE_USE_MAC_FOR_BRIDGE) < 0) {
VIR_FREE(macTapIfName);
goto err0;
}
@@ -2164,15 +2211,6 @@ networkStartNetworkVirtual(struct network_driver *driver,
if (v6present && networkStartRadvd(network) < 0)
goto err4;
- /* DAD has happened (dnsmasq waits for it), dnsmasq is now bound to the
- * bridge's IPv6 address, so we can now set the dummy tun down.
- */
- if (tapfd >= 0) {
- if (virNetDevSetOnline(macTapIfName, false) < 0)
- goto err4;
- VIR_FORCE_CLOSE(tapfd);
- }
-
if (virNetDevBandwidthSet(network->def->bridge, network->def->bandwidth) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot set bandwidth limits on %s"),
@@ -2211,7 +2249,6 @@ networkStartNetworkVirtual(struct network_driver *driver,
save_err = virSaveLastError();
if (macTapIfName) {
- VIR_FORCE_CLOSE(tapfd);
ignore_value(virNetDevTapDelete(macTapIfName));
VIR_FREE(macTapIfName);
}
@@ -2334,10 +2371,8 @@ networkStartNetwork(struct network_driver *driver,
break;
}
- if (ret < 0) {
- virNetworkObjUnsetDefTransient(network);
+ if (ret < 0)
return ret;
- }
/* Persist the live configuration now that anything autogenerated
* is setup.
@@ -2397,7 +2432,13 @@ static int networkShutdownNetwork(struct network_driver *driver,
}
network->active = 0;
- virNetworkObjUnsetDefTransient(network);
+
+ if (network->newDef) {
+ virNetworkDefFree(network->def);
+ network->def = network->newDef;
+ network->newDef = NULL;
+ }
+
return ret;
}
@@ -2618,7 +2659,6 @@ networkValidate(virNetworkDefPtr def)
{
int ii;
bool vlanUsed, vlanAllowed;
- const char *defaultPortGroup = NULL;
/* The only type of networks that currently support transparent
* vlan configuration are those using hostdev sr-iov devices from
@@ -2639,17 +2679,6 @@ networkValidate(virNetworkDefPtr def)
== VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)) {
vlanAllowed = true;
}
- if (def->portGroups[ii].isDefault) {
- if (defaultPortGroup) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("network '%s' has multiple default "
- "<portgroup> elements (%s and %s), "
- "but only one default is allowed"),
- def->name, defaultPortGroup,
- def->portGroups[ii].name);
- }
- defaultPortGroup = def->portGroups[ii].name;
- }
}
if (vlanUsed && !vlanAllowed) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -2841,6 +2870,14 @@ static int networkUndefine(virNetworkPtr net) {
}
}
+ {
+ char *configfile = networkDnsmasqConfigFileName(network->def->name);
+ if (!configfile)
+ goto cleanup;
+ unlink(configfile);
+ VIR_FREE(configfile);
+ }
+
if (dhcp_present) {
char *leasefile;
dnsmasqContext *dctx = dnsmasqContextNew(network->def->name, DNSMASQ_STATE_DIR);
@@ -2933,8 +2970,8 @@ networkUpdate(virNetworkPtr net,
* is active, else change CONFIG
*/
isActive = virNetworkObjIsActive(network);
- if ((flags & (VIR_NETWORK_UPDATE_AFFECT_LIVE |
- VIR_NETWORK_UPDATE_AFFECT_CONFIG)) ==
+ if ((flags & (VIR_NETWORK_UPDATE_AFFECT_LIVE
+ | VIR_NETWORK_UPDATE_AFFECT_CONFIG)) ==
VIR_NETWORK_UPDATE_AFFECT_CURRENT) {
if (isActive)
flags |= VIR_NETWORK_UPDATE_AFFECT_LIVE;
@@ -3870,8 +3907,8 @@ networkNotifyActualDevice(virDomainNetDefPtr iface)
for (ii = 0; ii < netdef->nForwardIfs; ii++) {
if (netdef->forwardIfs[ii].type
== VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI &&
- virDevicePCIAddressEqual(&hostdev->source.subsys.u.pci,
- &netdef->forwardIfs[ii].device.pci)) {
+ (virDevicePCIAddressEqual(hostdev->source.subsys.u.pci,
+ netdef->forwardIfs[ii].device.pci) == 0)) {
dev = &netdef->forwardIfs[ii];
break;
}
@@ -4022,8 +4059,8 @@ networkReleaseActualDevice(virDomainNetDefPtr iface)
for (ii = 0; ii < netdef->nForwardIfs; ii++) {
if (netdef->forwardIfs[ii].type
== VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI &&
- virDevicePCIAddressEqual(&hostdev->source.subsys.u.pci,
- &netdef->forwardIfs[ii].device.pci)) {
+ (virDevicePCIAddressEqual(hostdev->source.subsys.u.pci,
+ netdef->forwardIfs[ii].device.pci) == 0)) {
dev = &netdef->forwardIfs[ii];
break;
}
diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver.h
index 0fae275..608c622 100644
--- a/src/network/bridge_driver.h
+++ b/src/network/bridge_driver.h
@@ -48,15 +48,17 @@ int networkGetNetworkAddress(const char *netname, char **netaddr)
int networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network,
virCommandPtr *cmdout, char *pidfile,
- dnsmasqContext *dctx)
- ;
+ dnsmasqContext *dctx,
+ char *configdir,
+ int testOnly, char **testConfigStr);
# else
/* Define no-op replacements that don't drag in any link dependencies. */
# define networkAllocateActualDevice(iface) 0
# define networkNotifyActualDevice(iface) 0
# define networkReleaseActualDevice(iface) 0
# define networkGetNetworkAddress(netname, netaddr) (-2)
-# define networkBuildDhcpDaemonCommandLine(network, cmdout, pidfile, dctx) 0
+# define networkBuildDhcpDaemonCommandLine(network, cmdout, pidfile, \
+ dctx, configdir, testOnly, testConfigStr) 0
# endif
typedef char *(*networkDnsmasqLeaseFileNameFunc)(const char *netname);
diff --git a/tests/networkxml2argvdata/isolated-network.argv b/tests/networkxml2argvdata/isolated-network.argv
index 13e77b2..abcde93 100644
--- a/tests/networkxml2argvdata/isolated-network.argv
+++ b/tests/networkxml2argvdata/isolated-network.argv
@@ -1,9 +1,16 @@
-@DNSMASQ@ --strict-order --bind-interfaces \
---local=// --domain-needed --conf-file= \
---except-interface lo --dhcp-option=3 --no-resolv \
---listen-address 192.168.152.1 \
---dhcp-range 192.168.152.2,192.168.152.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/private.leases --dhcp-lease-max=253 \
---dhcp-no-override \
---dhcp-hostsfile=/var/lib/libvirt/dnsmasq/private.hostsfile \
---addn-hosts=/var/lib/libvirt/dnsmasq/private.addnhosts\
+# dnsmasq conf file created by libvirt
+strict-order
+bind-interfaces
+except-interface=lo
+domain-needed
+local=//
+dhcp-option=3
+no-resolv
+interface=virbr2
+listen-address=192.168.152.1
+dhcp-range=192.168.152.2,192.168.152.254
+dhcp-leasefile=/var/lib/libvirt/dnsmasq/private.leases
+dhcp-lease-max=253
+dhcp-no-override
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/private.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/private.addnhosts
diff --git a/tests/networkxml2argvdata/nat-network-dns-hosts.argv b/tests/networkxml2argvdata/nat-network-dns-hosts.argv
index 03a0676..7dce6f9 100644
--- a/tests/networkxml2argvdata/nat-network-dns-hosts.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-hosts.argv
@@ -1,4 +1,11 @@
-@DNSMASQ@ --strict-order --bind-interfaces --domain=example.com \
---local=/example.com/ --domain-needed \
---conf-file= --except-interface lo --listen-address 192.168.122.1 \
---expand-hosts --addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts\
+# dnsmasq conf file created by libvirt
+strict-order
+bind-interfaces
+except-interface=lo
+domain-needed
+local=/example.com/
+domain=example.com
+expand-hosts
+interface=virbr0
+listen-address=192.168.122.1
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv b/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv
index 210a60c..d87d438 100644
--- a/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv
@@ -1,17 +1,19 @@
-@DNSMASQ@ \
---strict-order \
---bind-interfaces \
---local=// --domain-needed --conf-file= \
---except-interface lo \
---srv-host=name.tcp.,,,, \
---listen-address 192.168.122.1 \
---listen-address 192.168.123.1 \
---listen-address 2001:db8:ac10:fe01::1 \
---listen-address 2001:db8:ac10:fd01::1 \
---listen-address 10.24.10.1 \
---dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases \
---dhcp-lease-max=253 \
---dhcp-no-override \
---dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile \
---addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts\
+# dnsmasq conf file created by libvirt
+strict-order
+bind-interfaces
+except-interface=lo
+domain-needed
+local=//
+srv-host=name.tcp.,,,,
+interface=virbr0
+listen-address=192.168.122.1
+listen-address=192.168.123.1
+listen-address=2001:db8:ac10:fe01::1
+listen-address=2001:db8:ac10:fd01::1
+listen-address=10.24.10.1
+dhcp-range=192.168.122.2,192.168.122.254
+dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
+dhcp-lease-max=253
+dhcp-no-override
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2argvdata/nat-network-dns-srv-record.argv b/tests/networkxml2argvdata/nat-network-dns-srv-record.argv
index 833d3cd..53882fe 100644
--- a/tests/networkxml2argvdata/nat-network-dns-srv-record.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-srv-record.argv
@@ -1,17 +1,19 @@
-@DNSMASQ@ \
---strict-order \
---bind-interfaces \
---local=// --domain-needed --conf-file= \
---except-interface lo \
---srv-host=name.tcp.test-domain-name,.,1024,10,10 \
---listen-address 192.168.122.1 \
---listen-address 192.168.123.1 \
---listen-address 2001:db8:ac10:fe01::1 \
---listen-address 2001:db8:ac10:fd01::1 \
---listen-address 10.24.10.1 \
---dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases \
---dhcp-lease-max=253 \
---dhcp-no-override \
---dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile \
---addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts\
+# dnsmasq conf file created by libvirt
+strict-order
+bind-interfaces
+except-interface=lo
+domain-needed
+local=//
+srv-host=name.tcp.test-domain-name,.,1024,10,10
+interface=virbr0
+listen-address=192.168.122.1
+listen-address=192.168.123.1
+listen-address=2001:db8:ac10:fe01::1
+listen-address=2001:db8:ac10:fd01::1
+listen-address=10.24.10.1
+dhcp-range=192.168.122.2,192.168.122.254
+dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
+dhcp-lease-max=253
+dhcp-no-override
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2argvdata/nat-network-dns-txt-record.argv b/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
index 3481507..cc3ed28 100644
--- a/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
@@ -1,11 +1,19 @@
-@DNSMASQ@ --strict-order --bind-interfaces \
---local=// --domain-needed --conf-file= \
---except-interface lo '--txt-record=example,example value' \
---listen-address 192.168.122.1 --listen-address 192.168.123.1 \
---listen-address 2001:db8:ac10:fe01::1 \
---listen-address 2001:db8:ac10:fd01::1 --listen-address 10.24.10.1 \
---dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases \
---dhcp-lease-max=253 --dhcp-no-override \
---dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile \
---addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts\
+# dnsmasq conf file created by libvirt
+strict-order
+bind-interfaces
+except-interface=lo
+domain-needed
+local=//
+txt-record=example,example value
+interface=virbr0
+listen-address=192.168.122.1
+listen-address=192.168.123.1
+listen-address=2001:db8:ac10:fe01::1
+listen-address=2001:db8:ac10:fd01::1
+listen-address=10.24.10.1
+dhcp-range=192.168.122.2,192.168.122.254
+dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
+dhcp-lease-max=253
+dhcp-no-override
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2argvdata/nat-network.argv b/tests/networkxml2argvdata/nat-network.argv
index 37fd2fc..431fffb 100644
--- a/tests/networkxml2argvdata/nat-network.argv
+++ b/tests/networkxml2argvdata/nat-network.argv
@@ -1,10 +1,18 @@
-@DNSMASQ@ --strict-order --bind-interfaces \
---local=// --domain-needed --conf-file= \
---except-interface lo --listen-address 192.168.122.1 \
---listen-address 192.168.123.1 --listen-address 2001:db8:ac10:fe01::1 \
---listen-address 2001:db8:ac10:fd01::1 --listen-address 10.24.10.1 \
---dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases \
---dhcp-lease-max=253 --dhcp-no-override \
---dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile \
---addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts\
+# dnsmasq conf file created by libvirt
+strict-order
+bind-interfaces
+except-interface=lo
+domain-needed
+local=//
+interface=virbr0
+listen-address=192.168.122.1
+listen-address=192.168.123.1
+listen-address=2001:db8:ac10:fe01::1
+listen-address=2001:db8:ac10:fd01::1
+listen-address=10.24.10.1
+dhcp-range=192.168.122.2,192.168.122.254
+dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
+dhcp-lease-max=253
+dhcp-no-override
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2argvdata/netboot-network.argv b/tests/networkxml2argvdata/netboot-network.argv
index 5408eb7..8405095 100644
--- a/tests/networkxml2argvdata/netboot-network.argv
+++ b/tests/networkxml2argvdata/netboot-network.argv
@@ -1,10 +1,19 @@
-@DNSMASQ@ --strict-order --bind-interfaces --domain=example.com \
---local=/example.com/ --domain-needed --conf-file= \
---except-interface lo --listen-address 192.168.122.1 \
---dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/netboot.leases \
---dhcp-lease-max=253 --dhcp-no-override --expand-hosts \
---dhcp-hostsfile=/var/lib/libvirt/dnsmasq/netboot.hostsfile \
---addn-hosts=/var/lib/libvirt/dnsmasq/netboot.addnhosts \
---enable-tftp \
---tftp-root /var/lib/tftproot --dhcp-boot pxeboot.img\
+# dnsmasq conf file created by libvirt
+strict-order
+bind-interfaces
+except-interface=lo
+domain-needed
+local=/example.com/
+domain=example.com
+expand-hosts
+interface=virbr1
+listen-address=192.168.122.1
+dhcp-range=192.168.122.2,192.168.122.254
+dhcp-leasefile=/var/lib/libvirt/dnsmasq/netboot.leases
+dhcp-lease-max=253
+dhcp-no-override
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/netboot.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/netboot.addnhosts
+enable-tftp
+tftp-root=/var/lib/tftproot
+dhcp-boot=pxeboot.img
diff --git a/tests/networkxml2argvdata/netboot-proxy-network.argv b/tests/networkxml2argvdata/netboot-proxy-network.argv
index 21e01e3..d7c8966 100644
--- a/tests/networkxml2argvdata/netboot-proxy-network.argv
+++ b/tests/networkxml2argvdata/netboot-proxy-network.argv
@@ -1,9 +1,17 @@
-@DNSMASQ@ --strict-order --bind-interfaces --domain=example.com \
---local=/example.com/ --domain-needed --conf-file= \
---except-interface lo --listen-address 192.168.122.1 \
---dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/netboot.leases \
---dhcp-lease-max=253 --dhcp-no-override --expand-hosts \
---dhcp-hostsfile=/var/lib/libvirt/dnsmasq/netboot.hostsfile \
---addn-hosts=/var/lib/libvirt/dnsmasq/netboot.addnhosts \
---dhcp-boot pxeboot.img,,10.20.30.40\
+# dnsmasq conf file created by libvirt
+strict-order
+bind-interfaces
+except-interface=lo
+domain-needed
+local=/example.com/
+domain=example.com
+expand-hosts
+interface=virbr1
+listen-address=192.168.122.1
+dhcp-range=192.168.122.2,192.168.122.254
+dhcp-leasefile=/var/lib/libvirt/dnsmasq/netboot.leases
+dhcp-lease-max=253
+dhcp-no-override
+dhcp-hostsfile=/var/lib/libvirt/dnsmasq/netboot.hostsfile
+addn-hosts=/var/lib/libvirt/dnsmasq/netboot.addnhosts
+dhcp-boot=pxeboot.img,,10.20.30.40
diff --git a/tests/networkxml2argvdata/routed-network.argv b/tests/networkxml2argvdata/routed-network.argv
index 9fedb2b..771240f 100644
--- a/tests/networkxml2argvdata/routed-network.argv
+++ b/tests/networkxml2argvdata/routed-network.argv
@@ -1,4 +1,9 @@
-@DNSMASQ@ --strict-order --bind-interfaces \
---local=// --domain-needed --conf-file= \
---except-interface lo --listen-address 192.168.122.1 \
---addn-hosts=/var/lib/libvirt/dnsmasq/local.addnhosts\
+# dnsmasq conf file created by libvirt
+strict-order
+bind-interfaces
+except-interface=lo
+domain-needed
+local=//
+interface=virbr1
+listen-address=192.168.122.1
+addn-hosts=/var/lib/libvirt/dnsmasq/local.addnhosts
diff --git a/tests/networkxml2argvtest.c b/tests/networkxml2argvtest.c
index 87519e4..275b190 100644
--- a/tests/networkxml2argvtest.c
+++ b/tests/networkxml2argvtest.c
@@ -15,37 +15,6 @@
#include "memory.h"
#include "network/bridge_driver.h"
-/* Replace all occurrences of @token in @buf by @replacement and adjust size of
- * @buf accordingly. Returns 0 on success and -1 on out-of-memory errors. */
-static int replaceTokens(char **buf, const char *token, const char *replacement) {
- size_t token_start, token_end;
- size_t buf_len, rest_len;
- const size_t token_len = strlen(token);
- const size_t replacement_len = strlen(replacement);
- const int diff = replacement_len - token_len;
-
- buf_len = rest_len = strlen(*buf) + 1;
- token_end = 0;
- for (;;) {
- char *match = strstr(*buf + token_end, token);
- if (match == NULL)
- break;
- token_start = match - *buf;
- rest_len -= token_start + token_len - token_end;
- token_end = token_start + token_len;
- buf_len += diff;
- if (diff > 0)
- if (VIR_REALLOC_N(*buf, buf_len) < 0)
- return -1;
- if (diff != 0)
- memmove(*buf + token_end + diff, *buf + token_end, rest_len);
- memcpy(*buf + token_start, replacement, replacement_len);
- token_end += diff;
- }
- /* if diff < 0, we could shrink the buffer here... */
- return 0;
-}
-
static int testCompareXMLToArgvFiles(const char *inxml, const char *outargv) {
char *inXmlData = NULL;
char *outArgvData = NULL;
@@ -55,6 +24,7 @@ static int testCompareXMLToArgvFiles(const char *inxml, const char *outargv) {
virNetworkObjPtr obj = NULL;
virCommandPtr cmd = NULL;
char *pidfile = NULL;
+ char *configdir = NULL;
dnsmasqContext *dctx = NULL;
if (virtTestLoadFile(inxml, &inXmlData) < 0)
@@ -62,10 +32,6 @@ static int testCompareXMLToArgvFiles(const char *inxml, const char *outargv) {
if (virtTestLoadFile(outargv, &outArgvData) < 0)
goto fail;
-
- if (replaceTokens(&outArgvData, "@DNSMASQ@", DNSMASQ))
- goto fail;
-
if (!(dev = virNetworkDefParseString(inXmlData)))
goto fail;
@@ -78,12 +44,9 @@ static int testCompareXMLToArgvFiles(const char *inxml, const char *outargv) {
if (dctx == NULL)
goto fail;
- if (networkBuildDhcpDaemonCommandLine(obj, &cmd, pidfile, dctx) < 0)
- goto fail;
-
- if (!(actual = virCommandToString(cmd)))
+ if (networkBuildDhcpDaemonCommandLine(obj, &cmd, pidfile,
+ dctx, configdir, 1, &actual) < 0)
goto fail;
-
if (STRNEQ(outArgvData, actual)) {
virtTestDifference(stderr, outArgvData, actual);
goto fail;
@@ -147,7 +110,6 @@ mymain(void)
if (virtTestRun("Network XML-2-Argv " name, \
1, testCompareXMLToArgvHelper, (name)) < 0) \
ret = -1
-
DO_TEST("isolated-network");
DO_TEST("routed-network");
DO_TEST("nat-network");
--
1.7.11.7
12 years, 1 month
[libvirt] [PATCH] qemu: Fix the unused parameter which causes the build failure
by Osier Yang
---
Pushed under build-breaker rule.
---
src/qemu/qemu_process.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index eef1ddb..969e3ce 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1999,7 +1999,7 @@ qemuProcessSetLinkStates(virDomainObjPtr vm)
/* Set CPU affinities for vcpus if vcpupin xml provided. */
static int
-qemuProcessSetVcpuAffinites(virConnectPtr conn,
+qemuProcessSetVcpuAffinites(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -2032,7 +2032,7 @@ cleanup:
/* Set CPU affinities for emulator threads. */
static int
-qemuProcessSetEmulatorAffinites(virConnectPtr conn,
+qemuProcessSetEmulatorAffinites(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainObjPtr vm)
{
virBitmapPtr cpumask;
--
1.7.7.6
12 years, 1 month
[libvirt] [PATCHv8 00/11] blockjob: storage migration via block-copy
by Eric Blake
v7 of these patches is here:
https://www.redhat.com/archives/libvir-list/2012-September/msg01122.html
Since then, I have rebased the series on top of my block-commit work,
which changed (and simplified) several patches. Also, upstream qemu
is closer to taking Paolo's patches that actually add the 'drive-mirror'
monitor command, although it still isn't official there; so I'm still
a bit reluctant to push patches 3-11 into libvirt.git until qemu.git
actually gains support for block copy. Patches 1 and 2 are new, and
can be applied now if they get a good review.
I've done some light testing with the qemu-kvm-rhev of RHEV 3.0, so
I'm fairly confident that my rebase work is correct.
Also available at:
http://repo.or.cz/w/libvirt/ericb.git/shortlog/refs/heads/blockjob
git fetch git://repo.or.cz/libvirt/ericb.git blockjob
Eric Blake (11):
storage: let format probing work on root-squash NFS
blockjob: sanity check when creating snapshot
blockjob: add qemu capabilities related to block jobs
blockjob: react to active block copy
blockjob: return appropriate event and info
blockjob: support pivot operation on cancel
blockjob: make drive-reopen safer
blockjob: implement block copy for qemu
blockjob: allow for existing files in block-copy
blockjob: allow mirroring under SELinux and cgroup
blockjob: relabel entire existing chain
include/libvirt/libvirt.h.in | 1 +
src/conf/domain_conf.c | 12 ++
src/conf/domain_conf.h | 1 +
src/libvirt.c | 7 +-
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 6 +
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_driver.c | 431 ++++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_hotplug.c | 7 +
src/qemu/qemu_monitor.c | 52 +++++
src/qemu/qemu_monitor.h | 14 ++
src/qemu/qemu_monitor_json.c | 96 ++++++++-
src/qemu/qemu_monitor_json.h | 21 +-
src/qemu/qemu_process.c | 3 +
src/storage/storage_backend_fs.c | 2 +-
src/util/storage_file.c | 4 +-
src/util/storage_file.h | 2 +-
17 files changed, 646 insertions(+), 16 deletions(-)
--
1.7.11.7
12 years, 1 month
[libvirt] how libvirt communicate with qemu?
by yue
i am reading source code, begin with tracing simple command line ,like virsh list and forth.
please look at my qurestions
1.how libvirt communicate with qemu?
call qemu'lib or open special device/socket?
2. i do not find the implement of function qemuAgentOpen---->qemuAgentInitialize().
i also search qemu-kvm source
3. qemuListAllDomains is the function which corespond to virsh-list. please explain this function .
virDomainList(conn, driver->domains.objs, domains, flags);
i) it seems driver->domains.objs have gotten all dmains. so when and where driver->domains.objs is assigned.
ii)and what is conn,and its definition?
thanks.
12 years, 1 month
[libvirt] [PATCH RFC] helper of copy-storage-* features
by liguang
help to create disk images copy-storage-* required,
try to do non-shared migration without bothering to
create disk images at target by hand.
consider this situation:
1. non-shared migration
virsh migrate --copy-storage-all ...
2. migration fails
3. create disk images required
qemu-img create ...
4 migration run smoothly
so, try do remove step 2, 3, 4
this kind of use had been discussed before,
http://www.redhat.com/archives/libvir-list/2011-December/msg00451.html
maybe there're some flaws:
- It did not handle more about complete situations
suggested by Daniel P. Berrange,
https://www.redhat.com/archives/libvir-list/2012-October/msg00407.html
but may try to take care of them later.
so, now only normal disk image files be handled.
- for creation of disk images, size was setting as 0xffffffff boldly,
hope it can consolidate qemu, haven't constructed a comfortable
idea to solve it.
Signed-off-by: liguang <lig.fnst(a)cn.fujitsu.com>
---
src/qemu/qemu_migration.c | 87 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 85 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index db69a0a..5c3ad9f 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -49,6 +49,7 @@
#include "storage_file.h"
#include "viruri.h"
#include "hooks.h"
+#include "dirname.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
@@ -70,6 +71,7 @@ enum qemuMigrationCookieFlags {
QEMU_MIGRATION_COOKIE_FLAG_GRAPHICS,
QEMU_MIGRATION_COOKIE_FLAG_LOCKSTATE,
QEMU_MIGRATION_COOKIE_FLAG_PERSISTENT,
+ QEMU_MIGRATION_COOKIE_FLAG_COPYSTORAGE,
QEMU_MIGRATION_COOKIE_FLAG_LAST
};
@@ -77,12 +79,13 @@ enum qemuMigrationCookieFlags {
VIR_ENUM_DECL(qemuMigrationCookieFlag);
VIR_ENUM_IMPL(qemuMigrationCookieFlag,
QEMU_MIGRATION_COOKIE_FLAG_LAST,
- "graphics", "lockstate", "persistent");
+ "graphics", "lockstate", "persistent", "copystorage");
enum qemuMigrationCookieFeatures {
QEMU_MIGRATION_COOKIE_GRAPHICS = (1 << QEMU_MIGRATION_COOKIE_FLAG_GRAPHICS),
QEMU_MIGRATION_COOKIE_LOCKSTATE = (1 << QEMU_MIGRATION_COOKIE_FLAG_LOCKSTATE),
QEMU_MIGRATION_COOKIE_PERSISTENT = (1 << QEMU_MIGRATION_COOKIE_FLAG_PERSISTENT),
+ QEMU_MIGRATION_COOKIE_COPYSTORAGE = (1 << QEMU_MIGRATION_COOKIE_FLAG_COPYSTORAGE),
};
typedef struct _qemuMigrationCookieGraphics qemuMigrationCookieGraphics;
@@ -439,6 +442,9 @@ qemuMigrationCookieXMLFormat(struct qemud_driver *driver,
virBufferAdjustIndent(buf, -2);
}
+ if (mig->flags & QEMU_MIGRATION_COOKIE_COPYSTORAGE)
+ virBufferAsprintf(buf, " <copystorage/>\n");
+
virBufferAddLit(buf, "</qemu-migration>\n");
return 0;
}
@@ -662,6 +668,11 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig,
VIR_FREE(nodes);
}
+ if ((flags & QEMU_MIGRATION_COOKIE_COPYSTORAGE)) {
+ if (virXPathBoolean("count(./copystorage) > 0", ctxt))
+ mig->flags |= QEMU_MIGRATION_COOKIE_COPYSTORAGE;
+ }
+
return 0;
error:
@@ -721,6 +732,9 @@ qemuMigrationBakeCookie(qemuMigrationCookiePtr mig,
qemuMigrationCookieAddPersistent(mig, dom) < 0)
return -1;
+ if (flags & QEMU_MIGRATION_COOKIE_COPYSTORAGE)
+ mig->flags |= QEMU_MIGRATION_COOKIE_COPYSTORAGE;
+
if (!(*cookieout = qemuMigrationCookieXMLFormatStr(driver, mig)))
return -1;
@@ -1168,6 +1182,14 @@ char *qemuMigrationBegin(struct qemud_driver *driver,
QEMU_MIGRATION_COOKIE_LOCKSTATE) < 0)
goto cleanup;
+ if (flags & (VIR_MIGRATE_NON_SHARED_DISK |
+ VIR_MIGRATE_NON_SHARED_INC)) {
+ if (qemuMigrationBakeCookie(mig, driver, vm,
+ cookieout, cookieoutlen,
+ QEMU_MIGRATION_COOKIE_COPYSTORAGE) < 0)
+ goto cleanup;
+ }
+
if (xmlin) {
if (!(def = virDomainDefParseString(driver->caps, xmlin,
QEMU_EXPECTED_VIRT_TYPES,
@@ -1215,6 +1237,54 @@ qemuMigrationPrepareCleanup(struct qemud_driver *driver,
qemuDomainObjDiscardAsyncJob(driver, vm);
}
+static int qemuMigrationHandleDiskFiles(virDomainDefPtr def, int pin)
+{
+ char *tmp_dir = NULL, *outbuf = NULL;
+ char *size = _("0xffffffff");
+ virCommandPtr cmd = NULL;
+ int i, ret = -1;
+
+ if (!def->ndisks)
+ return 0;
+ for (i = 0; i < def->ndisks; i++) {
+ if (STRNEQ(def->disks[i]->driverName, "qemu"))
+ continue;
+ if (def->disks[i]->src == NULL)
+ continue;
+ if (def->disks[i]->driverType == NULL)
+ goto cleanup;
+ if (virFileExists(def->disks[i]->src) && pin)
+ continue;
+ if (!pin && !virFileExists(def->disks[i]->src))
+ continue;
+ if ((tmp_dir = mdir_name(def->disks[i]->src)) == NULL)
+ continue;
+ if (!virFileExists(tmp_dir))
+ if (virFileMakePath(tmp_dir) < 0)
+ continue;
+ if (pin) {
+ cmd = virCommandNewArgList("qemu-img", "create", "-f",
+ def->disks[i]->driverType, def->disks[i]->src,
+ size, NULL);
+ virCommandSetOutputBuffer(cmd, &outbuf);
+ } else
+ cmd = virCommandNewArgList("rm", "-f", def->disks[i]->src, NULL);
+
+ if (virCommandRun(cmd, NULL) < 0) {
+ goto cleanup;
+ virReportSystemError(errno, "%s",
+ _("unable create disk images by qemu-img"));
+ }
+ }
+
+ ret = 0;
+
+cleanup:
+ virCommandFree(cmd);
+ VIR_FREE(tmp_dir);
+ return ret;
+}
+
static int
qemuMigrationPrepareAny(struct qemud_driver *driver,
virConnectPtr dconn,
@@ -1308,6 +1378,15 @@ qemuMigrationPrepareAny(struct qemud_driver *driver,
/* virDomainAssignDef already set the error */
goto cleanup;
}
+
+ if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen,
+ QEMU_MIGRATION_COOKIE_COPYSTORAGE)))
+ goto cleanup;
+
+ if (mig->flags & QEMU_MIGRATION_COOKIE_COPYSTORAGE)
+ if (qemuMigrationHandleDiskFiles(def, 1) < 0)
+ goto cleanup;
+
def = NULL;
priv = vm->privateData;
priv->origname = origname;
@@ -2929,7 +3008,7 @@ qemuMigrationFinish(struct qemud_driver *driver,
int newVM = 1;
qemuMigrationCookiePtr mig = NULL;
virErrorPtr orig_err = NULL;
- int cookie_flags = 0;
+ int cookie_flags = 0, migration_status = 0;
qemuDomainObjPrivatePtr priv = vm->privateData;
VIR_DEBUG("driver=%p, dconn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
@@ -3088,7 +3167,11 @@ qemuMigrationFinish(struct qemud_driver *driver,
if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen, 0) < 0)
VIR_WARN("Unable to encode migration cookie");
+ migration_status = 1;
+
endjob:
+ if (!migration_status)
+ qemuMigrationHandleDiskFiles(vm->def, 0);
if (qemuMigrationJobFinish(driver, vm) == 0) {
vm = NULL;
} else if (!vm->persistent && !virDomainObjIsActive(vm)) {
--
1.7.2.5
12 years, 1 month
[libvirt] [PATCH 0/2] qemu: Check if qemu is VNC capable
by Doug Goldstein
This is the initial series where I'll be exposing the graphical support that
QEMU has via capabilities but I'm breaking it up to get in as much as possible
based on my available time.
This initial set adds checks to see that your QEMU binary has VNC support
instead of assuming that it does. A large Gentoo user apparently just uses
SPICE and as a result we now provide the ability to install QEMU without VNC.
While this is not a recommended configuration its certainly valid and libvirt
should not assume it exists.
Doug Goldstein (2):
test: Don't assume VNC is always available
qemu: Don't blindly assume VNC is supported
src/qemu/qemu_capabilities.c | 5 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 6 +++
tests/qemuhelptest.c | 48 +++++++++++++-------
tests/qemuxml2argvdata/qemuxml2argv-bios.args | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-bios.xml | 4 --
.../qemuxml2argv-disk-copy_on_read.args | 6 +-
.../qemuxml2argv-disk-copy_on_read.xml | 5 --
.../qemuxml2argv-disk-ioeventfd.args | 6 +-
.../qemuxml2argv-disk-ioeventfd.xml | 5 --
tests/qemuxml2argvdata/qemuxml2argv-event_idx.args | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml | 8 ---
.../qemuxml2argvdata/qemuxml2argv-virtio-lun.args | 6 +-
tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml | 8 ---
tests/qemuxml2argvtest.c | 10 ++--
15 files changed, 64 insertions(+), 66 deletions(-)
--
1.7.8.6
12 years, 1 month
[libvirt] [PATCH v2] virsh: Fix segfault of snapshot-list
by Osier Yang
'snaps' is used after free()'ed.
---
tools/virsh-snapshot.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 6dd8bf2..fc6c5b3 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -866,7 +866,7 @@ vshSnapshotListCollect(vshControl *ctl, virDomainPtr dom,
goto cleanup;
}
if (from) {
- snaps[snaplist->nsnaps++] = from;
+ snaplist->snaps[snaplist->nsnaps++].snap = from;
virDomainSnapshotRef(from);
}
}
--
1.7.7.6
12 years, 1 month