[libvirt] [PATCH] util: fix error messages in virNetlinkEventServiceStart
by Laine Stump
Some of the error messages in this function should have been
virReportSystemError (since they have an errno they want to log), but
were mistakenly written as netlinkError, which expects a libvirt error
code instead. The result was that when one of the errors was
encountered, "No error message provided" would be printed instead of
something meaningful (see
https://bugzilla.redhat.com/show_bug.cgi?id=816465 for an example).
---
src/util/virnetlink.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index 7017275..b2e9d51 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -238,8 +238,8 @@ virNetlinkEventCallback(int watch,
if (length == 0)
return;
if (length < 0) {
- netlinkError(errno,
- "%s", _("nl_recv returned with error"));
+ virReportSystemError(errno,
+ "%s", _("nl_recv returned with error"));
return;
}
@@ -349,28 +349,28 @@ virNetlinkEventServiceStart(void)
srv->netlinknh = nl_handle_alloc();
if (!srv->netlinknh) {
- netlinkError(errno,
- "%s", _("cannot allocate nlhandle for virNetlinkEvent server"));
+ virReportSystemError(errno,
+ "%s", _("cannot allocate nlhandle for virNetlinkEvent server"));
goto error_locked;
}
if (nl_connect(srv->netlinknh, NETLINK_ROUTE) < 0) {
- netlinkError(errno,
- "%s", _("cannot connect to netlink socket"));
+ virReportSystemError(errno,
+ "%s", _("cannot connect to netlink socket"));
goto error_server;
}
fd = nl_socket_get_fd(srv->netlinknh);
if (fd < 0) {
- netlinkError(errno,
- "%s", _("cannot get netlink socket fd"));
+ virReportSystemError(errno,
+ "%s", _("cannot get netlink socket fd"));
goto error_server;
}
if (nl_socket_set_nonblocking(srv->netlinknh)) {
- netlinkError(errno, "%s",
- _("cannot set netlink socket nonblocking"));
+ virReportSystemError(errno, "%s",
+ _("cannot set netlink socket nonblocking"));
goto error_server;
}
--
1.7.10
12 years, 7 months
[libvirt] building error
by Wen Congyang
When I build libvirt, I meet the following error message
sometimes:
make[4]: Entering directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.11/docs'
GEN libvirt-api.xml
GEN libvirt-qemu-api.xml
GEN html/index.html
./libvirt-api.xml:2450: parser error : AttValue: ' expected
<function name='virConnectDomainEventDeregister' file='libvi
^
./libvirt-api.xml:2450: parser error : attributes construct error
<function name='virConnectDomainEventDeregister' file='libvi
^
./libvirt-api.xml:2450: parser error : Couldn't find end of Start Tag function line 2450
<function name='virConnectDomainEventDeregister' file='libvi
^
./libvirt-api.xml:2450: parser error : Premature end of data in tag symbols line 1129
<function name='virConnectDomainEventDeregister' file='libvi
^
./libvirt-api.xml:2450: parser error : Premature end of data in tag api line 2
<function name='virConnectDomainEventDeregister' file='libvi
^
unable to parse ./libvirt-api.xml
make[4]: *** [html/index.html] Error 6
make[4]: *** Waiting for unfinished jobs....
If I rebuild it without anything change, the building will success.
12 years, 7 months
[libvirt] [PATCH] blockjob: fix block-stream bandwidth race
by Eric Blake
With RHEL 6.2, virDomainBlockPull(dom, dev, bandwidth, 0) has a race
with non-zero bandwidth: there is a window between the block_stream
and block_job_set_speed monitor commands where an unlimited amount
of data was let through, defeating the point of a throttle.
This race was first identified in commit a9d3495e, and libvirt was
able to reduce the size of the window for that race. In the meantime,
the qemu developers decided to fix things properly; per this message:
https://lists.gnu.org/archive/html/qemu-devel/2012-04/msg03793.html
the fix will be in qemu 1.1, and changes block-job-set-speed to use
a different parameter name, as well as adding a new optional parameter
to block-stream, which eliminates the race altogether.
Since our documentation already mentioned that we can refuse a non-zero
bandwidth for some hypervisors, I think the best solution is to do
just that for RHEL 6.2 qemu, so that the race is obvious to the user.
Meanwhile the code must be fixed to honor actual qemu 1.1 naming.
* src/qemu/qemu_monitor.h (enum BLOCK_JOB_CMD): Drop unused value.
* src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Reject
bandwidth during pull with too-old qemu.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockJob): Support
difference between RHEL 6.2 and qemu 1.1 block pull.
* src/libvirt.c (virDomainBlockPull, virDomainBlockRebase):
Document this.
---
src/libvirt.c | 6 +++-
src/qemu/qemu_driver.c | 8 ++++--
src/qemu/qemu_monitor.h | 3 +-
src/qemu/qemu_monitor_json.c | 53 +++++++++++++++++++++++------------------
4 files changed, 40 insertions(+), 30 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index af42d3b..67f324a 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -18145,7 +18145,8 @@ error:
* The maximum bandwidth (in Mbps) that will be used to do the copy can be
* specified with the bandwidth parameter. If set to 0, libvirt will choose a
* suitable default. Some hypervisors do not support this feature and will
- * return an error if bandwidth is not 0.
+ * return an error if bandwidth is not 0; in this case, it might still be
+ * possible for a later call to virDomainBlockJobSetSpeed() to succeed.
*
* This is shorthand for virDomainBlockRebase() with a NULL base.
*
@@ -18263,7 +18264,8 @@ error:
* The maximum bandwidth (in Mbps) that will be used to do the copy can be
* specified with the bandwidth parameter. If set to 0, libvirt will choose a
* suitable default. Some hypervisors do not support this feature and will
- * return an error if bandwidth is not 0.
+ * return an error if bandwidth is not 0; in this case, it might still be
+ * possible for a later call to virDomainBlockJobSetSpeed() to succeed.
*
* When @base is NULL and @flags is 0, this is identical to
* virDomainBlockPull().
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c3555ca..d3aa34d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11654,6 +11654,11 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
_("partial block pull not supported with this "
"QEMU binary"));
goto cleanup;
+ } else if (mode == BLOCK_JOB_PULL && bandwidth) {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("setting bandwidth at start of block pull not "
+ "supported with this QEMU binary"));
+ goto cleanup;
}
device = qemuDiskPathToAlias(vm, path, &idx);
@@ -11676,9 +11681,6 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
* relying on qemu to do this. */
ret = qemuMonitorBlockJob(priv->mon, device, base, bandwidth, info, mode,
async);
- if (ret == 0 && mode == BLOCK_JOB_PULL && bandwidth)
- ret = qemuMonitorBlockJob(priv->mon, device, NULL, bandwidth, NULL,
- BLOCK_JOB_SPEED_INTERNAL, async);
qemuDomainObjExitMonitorWithDriver(driver, vm);
if (ret < 0)
goto endjob;
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index f3cdcdd..dc02964 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -530,8 +530,7 @@ typedef enum {
BLOCK_JOB_ABORT = 0,
BLOCK_JOB_INFO = 1,
BLOCK_JOB_SPEED = 2,
- BLOCK_JOB_SPEED_INTERNAL = 3,
- BLOCK_JOB_PULL = 4,
+ BLOCK_JOB_PULL = 3,
} BLOCK_JOB_CMD;
int qemuMonitorBlockJob(qemuMonitorPtr mon,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index eb58f13..de76609 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -3430,22 +3430,29 @@ qemuMonitorJSONBlockJob(qemuMonitorPtr mon,
unsigned long bandwidth,
virDomainBlockJobInfoPtr info,
int mode,
- bool async)
+ bool modern)
{
int ret = -1;
virJSONValuePtr cmd = NULL;
virJSONValuePtr reply = NULL;
const char *cmd_name = NULL;
- if (base && (mode != BLOCK_JOB_PULL || !async)) {
+ if (base && (mode != BLOCK_JOB_PULL || !modern)) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("only modern block pull supports base: %s"), base);
return -1;
}
+ if (bandwidth && mode == BLOCK_JOB_PULL && !modern) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("only modern block pull supports bandwidth: %lu"),
+ bandwidth);
+ return -1;
+ }
+ bandwidth *= 1024ULL * 1024ULL; /* Scale MiB to bytes */
switch ((BLOCK_JOB_CMD) mode) {
case BLOCK_JOB_ABORT:
- cmd_name = async ? "block-job-cancel" : "block_job_cancel";
+ cmd_name = modern ? "block-job-cancel" : "block_job_cancel";
cmd = qemuMonitorJSONMakeCommand(cmd_name, "s:device", device, NULL);
break;
case BLOCK_JOB_INFO:
@@ -3453,19 +3460,24 @@ qemuMonitorJSONBlockJob(qemuMonitorPtr mon,
cmd = qemuMonitorJSONMakeCommand(cmd_name, NULL);
break;
case BLOCK_JOB_SPEED:
- case BLOCK_JOB_SPEED_INTERNAL:
- cmd_name = async ? "block-job-set-speed" : "block_job_set_speed";
- cmd = qemuMonitorJSONMakeCommand(cmd_name, "s:device",
- device, "U:value",
- bandwidth * 1024ULL * 1024ULL,
- NULL);
+ cmd_name = modern ? "block-job-set-speed" : "block_job_set_speed";
+ cmd = qemuMonitorJSONMakeCommand(cmd_name, "s:device", device,
+ modern ? "U:speed" : "U:value",
+ bandwidth, NULL);
break;
case BLOCK_JOB_PULL:
- cmd_name = async ? "block-stream" : "block_stream";
- cmd = qemuMonitorJSONMakeCommand(cmd_name,
- "s:device", device,
- base ? "s:base" : NULL, base,
- NULL);
+ cmd_name = modern ? "block-stream" : "block_stream";
+ if (bandwidth)
+ cmd = qemuMonitorJSONMakeCommand(cmd_name,
+ "s:device", device,
+ "U:speed", bandwidth,
+ base ? "s:base" : NULL, base,
+ NULL);
+ else
+ cmd = qemuMonitorJSONMakeCommand(cmd_name,
+ "s:device", device,
+ base ? "s:base" : NULL, base,
+ NULL);
break;
}
@@ -3477,14 +3489,9 @@ qemuMonitorJSONBlockJob(qemuMonitorPtr mon,
if (ret == 0 && virJSONValueObjectHasKey(reply, "error")) {
ret = -1;
if (qemuMonitorJSONHasError(reply, "DeviceNotActive")) {
- /* If a job completes before we get a chance to set the
- * speed, we don't want to fail the original command. */
- if (mode == BLOCK_JOB_SPEED_INTERNAL)
- ret = 0;
- else
- qemuReportError(VIR_ERR_OPERATION_INVALID,
- _("No active operation on device: %s"),
- device);
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ _("No active operation on device: %s"),
+ device);
} else if (qemuMonitorJSONHasError(reply, "DeviceInUse")){
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("Device %s in use"), device);
@@ -3497,7 +3504,7 @@ qemuMonitorJSONBlockJob(qemuMonitorPtr mon,
_("Command '%s' is not found"), cmd_name);
} else {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unexpected error"));
+ _("Unexpected error"));
}
}
--
1.7.7.6
12 years, 7 months
[libvirt] SR-IOV VLANs
by Dax Kelson
How should libvirt deal with different SR-IOV VLAN scenarios?
Hardware with full SR-IOV and ACS support is increasingly available
and in production. I just took delivery of such a server this week. It
would be nice if the software can fully take advantage of the
hardware.
== Scenario A - Transparent VLAN ==
In the first scenario a /single/ VLAN can be tied to a a VF and the
tagging and stripping of the VLAN tag happens outside of the view of
the VM. Since the VLAN management happens outside the VM there isn't
any security concerns from a malicious VM.
Today this can configured with the ip command: ip link set <pf> vf
<vfN> vlan <vlanID>
But, unless I'm reading it wrong, libvirtd will blow away any
pre-configured transparent VLAN in qemuDomainHostdevNetConfigReplace
== Scenario B - VM VLAN tagging ==
In the second scenario, tagged frames are delivered to the VM and the
VM uses them like normal.
There are security considerations here. You don't want a malicious VM
to access arbitrary VLANs.
There should be a way to have a whitelist of allowed VLAN tags that
can be enforced per VF at lower layer than the VM. Unfortunately it
doesn't seem like hardware today supports this granularity. The Intel
x540 datasheet indicates that a VLAN filter can be programmed with up
to 8 VLANs, but I'm not sure if that is per VF or a global limit.
With Emulex hardware, running: "ip link set <pf> vf <vfN> vlan 4095"
allows the VM with the given VF to configure any VLAN.
Likewise, the Intel ixgbe driver has ixgbe_set_vlan_anti_spoofing (and
ixgbe_set_mac_anti_spoofing) on a per VF basis. It isn't clear to me
if IFLA_VF_SPOOFCHK toggles both or just the mac anti spoofing.
12 years, 7 months
[libvirt] [PATCH 0/4] Fix tunnelled migration
by Jiri Denemark
All bugs fixed by the following patches were spotted while testing
tunnelled migration. However, the first three of them may also be hit in
other scenarios.
Jiri Denemark (4):
qemu: Preserve original error during migration
rpc: Discard non-blocking calls only when necessary
qemu: Fix detection of failed migration
qemu: Avoid bogus error at the end of tunnelled migration
src/qemu/qemu_migration.c | 171 +++++++++++++++++++++++++++++++++++++--------
src/rpc/virnetclient.c | 21 +++---
2 files changed, 151 insertions(+), 41 deletions(-)
--
1.7.8.5
12 years, 7 months
[libvirt] [PATCHv3] keepalive: Add ability to disable keepalive messages
by Peter Krempa
The docs for virConnectSetKeepAlive() advertise that this function
should be able to disable keepalives on negative or zero interval time.
This patch removes the check that prohibited this and adds code to
disable keepalives on negative/zero interval.
* src/libvirt.c: virConnectSetKeepAlive(): - remove check for negative
values
* src/rpc/virnetclient.c
* src/rpc/virnetclient.h: - add virNetClientKeepAliveStop() to disable
keepalive messages
* src/remote/remote_driver.c: remoteSetKeepAlive(): -add ability to
disable keepalives
---
Diff to v2:
- fixed whitespace
- added a note that disabling client keepalives does actualy not influence
keepalives sent by the daemon
src/libvirt.c | 10 ++++------
src/probes.d | 2 +-
src/remote/remote_driver.c | 7 ++++++-
src/rpc/virkeepalive.c | 36 ++++++++++++++++++++++++++----------
src/rpc/virkeepalive.h | 1 +
src/rpc/virnetclient.c | 8 ++++++++
src/rpc/virnetclient.h | 2 ++
7 files changed, 48 insertions(+), 18 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index af42d3b..b01ebba 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -18433,6 +18433,10 @@ error:
* messages. Failure to do so may result in connections being closed
* unexpectedly.
*
+ * Note: This API function controls only keepalive messages sent by the client.
+ * If the server is configured to use keepalive you still need to run the event
+ * loop to respond to them, even if you disable keepalives by this function.
+ *
* Returns -1 on error, 0 on success, 1 when remote party doesn't support
* keepalive messages.
*/
@@ -18452,12 +18456,6 @@ int virConnectSetKeepAlive(virConnectPtr conn,
return -1;
}
- if (interval <= 0) {
- virLibConnError(VIR_ERR_INVALID_ARG,
- _("negative or zero interval make no sense"));
- goto error;
- }
-
if (conn->driver->setKeepAlive) {
ret = conn->driver->setKeepAlive(conn, interval, count);
if (ret < 0)
diff --git a/src/probes.d b/src/probes.d
index 9d70cc9..e56dc3e 100644
--- a/src/probes.d
+++ b/src/probes.d
@@ -78,7 +78,7 @@ provider libvirt {
probe rpc_keepalive_ref(void *ka, void *client, int refs);
probe rpc_keepalive_free(void *ka, void *client, int refs);
probe rpc_keepalive_start(void *ka, void *client, int interval, int count);
- probe rpc_keepalive_stop(void *ka, void *client);
+ probe rpc_keepalive_stop(void *ka, void *client, bool all);
probe rpc_keepalive_send(void *ka, void *client, int prog, int vers, int proc);
probe rpc_keepalive_received(void *ka, void *client, int prog, int vers, int proc);
probe rpc_keepalive_timeout(void *ka, void *client, int coundToDeath, int idle);
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index af46384..7863b73 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -4631,7 +4631,12 @@ remoteSetKeepAlive(virConnectPtr conn, int interval, unsigned int count)
goto cleanup;
}
- ret = virNetClientKeepAliveStart(priv->client, interval, count);
+ if (interval > 0) {
+ ret = virNetClientKeepAliveStart(priv->client, interval, count);
+ } else {
+ virNetClientKeepAliveStop(priv->client);
+ ret = 0;
+ }
cleanup:
remoteDriverUnlock(priv);
diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c
index 06b8e63..a5c2b1a 100644
--- a/src/rpc/virkeepalive.c
+++ b/src/rpc/virkeepalive.c
@@ -372,32 +372,48 @@ cleanup:
}
-void
-virKeepAliveStop(virKeepAlivePtr ka)
+static void
+virKeepAliveStopInternal(virKeepAlivePtr ka, bool all)
{
virKeepAliveLock(ka);
PROBE(RPC_KEEPALIVE_STOP,
- "ka=%p client=%p",
- ka, ka->client);
+ "ka=%p client=%p all=%d",
+ ka, ka->client, all);
if (ka->timer > 0) {
virEventRemoveTimeout(ka->timer);
ka->timer = -1;
}
- if (ka->responseTimer > 0) {
- virEventRemoveTimeout(ka->responseTimer);
- ka->responseTimer = -1;
- }
+ if (all) {
+ if (ka->responseTimer > 0) {
+ virEventRemoveTimeout(ka->responseTimer);
+ ka->responseTimer = -1;
+ }
- virNetMessageFree(ka->response);
- ka->response = NULL;
+ virNetMessageFree(ka->response);
+ ka->response = NULL;
+ }
virKeepAliveUnlock(ka);
}
+void
+virKeepAliveStop(virKeepAlivePtr ka)
+{
+ virKeepAliveStopInternal(ka, true);
+}
+
+
+void
+virKeepAliveStopSending(virKeepAlivePtr ka)
+{
+ virKeepAliveStopInternal(ka, false);
+}
+
+
bool
virKeepAliveCheckMessage(virKeepAlivePtr ka,
virNetMessagePtr msg)
diff --git a/src/rpc/virkeepalive.h b/src/rpc/virkeepalive.h
index f1654eb..af9e722 100644
--- a/src/rpc/virkeepalive.h
+++ b/src/rpc/virkeepalive.h
@@ -49,6 +49,7 @@ int virKeepAliveStart(virKeepAlivePtr ka,
int interval,
unsigned int count);
void virKeepAliveStop(virKeepAlivePtr ka);
+void virKeepAliveStopSending(virKeepAlivePtr ka);
bool virKeepAliveCheckMessage(virKeepAlivePtr ka,
virNetMessagePtr msg);
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 33b7701..d88288d 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -248,6 +248,14 @@ virNetClientKeepAliveStart(virNetClientPtr client,
return ret;
}
+void
+virNetClientKeepAliveStop(virNetClientPtr client)
+{
+ virNetClientLock(client);
+ virKeepAliveStopSending(client->keepalive);
+ virNetClientUnlock(client);
+}
+
static void
virNetClientKeepAliveDeadCB(void *opaque)
{
diff --git a/src/rpc/virnetclient.h b/src/rpc/virnetclient.h
index 7c30d2b..13b4f96 100644
--- a/src/rpc/virnetclient.h
+++ b/src/rpc/virnetclient.h
@@ -104,4 +104,6 @@ int virNetClientKeepAliveStart(virNetClientPtr client,
int interval,
unsigned int count);
+void virNetClientKeepAliveStop(virNetClientPtr client);
+
#endif /* __VIR_NET_CLIENT_H__ */
--
1.7.3.4
12 years, 7 months
[libvirt] [PATCH] build: fix bootstrap on RHEL
by Eric Blake
Commit 8fe455fd364cd7462e02170084c45a58ee302cc3 tried to work around
a regression introduced in upstream gnulib that requires gettext 0.18
or newer on all projects using bootstrap, by making libvirt require
gettext 0.18. But this fails on RHEL 6.2, which still ships gettext
0.17. Revert that change, and instead, import the latest round of
gnulib updates that fix that problem properly.
If you have already built in the window where libvirt required 0.18,
be aware that incremental updates may run into problems: this is
because 'autopoint --force' will not downgrade m4/po.m4 back to an
older version, but it must be downgraded back to 0.17 levels to work
with this patch. You may either manually remove that file then rerun
bootstrap, or it may prove easier to just clean up all non-git files
to start from a clean slate.
* bootstrap.conf: Revert minimum gettext back to 0.17.
* configure.ac: Likewise.
* .gnulib: Update to latest, for bootstrap fixes.
* bootstrap: Resync from gnulib.
---
Pushing under the build-breaker rule (and this took me a lot longer
than I wanted, but I'm happy with the solution).
* .gnulib f15a17d...bb2f564 (6):
> bootstrap: only force latest Makefile.in.in for gettext module
> doc: Mention reason for replacement on glibc/Linux systems.
> pwrite: Don't replace on all platforms.
> rint* tests: Avoid gcc warnings.
> users.txt: Update.
> Large File Support for native Windows platforms.
.gnulib | 2 +-
bootstrap | 12 ++++++++++--
bootstrap.conf | 2 +-
configure.ac | 2 +-
4 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/.gnulib b/.gnulib
index f15a17d..bb2f564 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit f15a17dc1f5d2b1fc8a423795c54b211552c0483
+Subproject commit bb2f5640d5379c5b4eec2d62341413bbab1aa308
diff --git a/bootstrap b/bootstrap
index 5aa73cc..6b45868 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
-scriptversion=2012-04-19.22; # UTC
+scriptversion=2012-04-25.17; # UTC
# Bootstrap this package from checked-out sources.
@@ -873,7 +873,15 @@ if test $with_gettext = yes; then
}
' po/Makevars.template >po/Makevars || exit 1
- cat $GNULIB_SRCDIR/build-aux/po/Makefile.in.in > po/Makefile.in.in || exit 1
+ # If the 'gettext' module is in use, grab the latest Makefile.in.in.
+ # If only the 'gettext-h' module is in use, assume autopoint already
+ # put the correct version of this file into place.
+ case $gnulib_modules in
+ *gettext-h*) ;;
+ *gettext*)
+ cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in || exit 1
+ ;;
+ esac
if test -d runtime-po; then
# Similarly for runtime-po/Makevars, but not quite the same.
diff --git a/bootstrap.conf b/bootstrap.conf
index 56911e0..c6620e5 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -195,7 +195,7 @@ buildreq="\
autoconf 2.59
automake 1.9.6
autopoint -
-gettext 0.18
+gettext 0.17
git 1.5.5
gzip -
libtool -
diff --git a/configure.ac b/configure.ac
index 5936d31..89fe818 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2300,7 +2300,7 @@ dnl compute the difference between save_CPPFLAGS and CPPFLAGS and append it
dnl to INCLUDES in order to preserve changes made by gettext but in a place
dnl that does not break the build
save_CPPFLAGS="$CPPFLAGS"
-AM_GNU_GETTEXT_VERSION([0.18])
+AM_GNU_GETTEXT_VERSION([0.17])
AM_GNU_GETTEXT([external])
GETTEXT_CPPFLAGS=
if test "x$save_CPPFLAGS" != "x$CPPFLAGS"; then
--
1.7.7.6
12 years, 7 months
[libvirt] More SR-IOV VF support needed (IFLA_VF_VLAN/IFLA_VF_SPOOFCHK)
by Dax Kelson
Hi guys,
I have some brand new hardware with a Intel X540-AT2 10Gbe NIC.
I see that 0.9.11 added <interface type='hostdev'> with the ability
define a MAC address to address the randomly generated MAC address
issue. Thank you!
I believe that additional functionality is needed in two areas, namely
support for transparent VLAN tagging and the ability to disable MAC
spoof checking within the NIC's embedded switch.
With transparent VLAN tagging (IFLA_VF_VLAN), the PF transparently
tags all traffic from the VF with a configured VLAN ID and strips the
VLAN tag from traffic going to the VM. The VM is not aware of the VLAN
tag.
Disabling of the MAC spoof check (IFLA_VF_SPOOFCHK) allows the VM to
be able to do NIC bonding of two VFs.
These two features correspond to the following commands:
ip link set em<X> vf <n> vlan <VLAN>
ip link set em<X> vf <n> spoofchk [on|off] (note, requires iproute2 v3.3.0)
As far as XML format, how about something like:
<devices>
<interface type='hostdev'>
<source>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07'
function='0x0'/>
</source>
<mac address='52:54:00:6d:90:02'>
<vlan id='241'>
<disablespoofchk/>
</interface>
</devices>
Comments?
Dax Kelson
Guru Labs
12 years, 7 months
[libvirt] [PATCHv2] keepalive: Add ability to disable keepalive messages
by Peter Krempa
The docs for virConnectSetKeepAlive() advertise that this function
should be able to disable keepalives on negative or zero interval time.
This patch removes the check that prohibited this and adds code to
disable keepalives on negative/zero interval.
* src/libvirt.c: virConnectSetKeepAlive(): - remove check for negative
values
* src/rpc/virnetclient.c
* src/rpc/virnetclient.h: - add virNetClientKeepAliveStop() to disable
keepalive messages
* src/remote/remote_driver.c: remoteSetKeepAlive(): -add ability to
disable keepalives
---
Diff to v1:
- added virKeepAliveStopSending() that does not unregister the timer needed
to handle server keepalives
- moved implementation of virKeepAliveStop() to virKeepAliveStopInternal()
- added usage of the new function on the apropriate place
- modified systemtap definitions to accomodate new argument
src/libvirt.c | 6 ------
src/probes.d | 2 +-
src/remote/remote_driver.c | 7 ++++++-
src/rpc/virkeepalive.c | 38 ++++++++++++++++++++++++++++----------
src/rpc/virkeepalive.h | 1 +
src/rpc/virnetclient.c | 8 ++++++++
src/rpc/virnetclient.h | 2 ++
7 files changed, 46 insertions(+), 18 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index af42d3b..3f043e1 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -18452,12 +18452,6 @@ int virConnectSetKeepAlive(virConnectPtr conn,
return -1;
}
- if (interval <= 0) {
- virLibConnError(VIR_ERR_INVALID_ARG,
- _("negative or zero interval make no sense"));
- goto error;
- }
-
if (conn->driver->setKeepAlive) {
ret = conn->driver->setKeepAlive(conn, interval, count);
if (ret < 0)
diff --git a/src/probes.d b/src/probes.d
index 9d70cc9..e56dc3e 100644
--- a/src/probes.d
+++ b/src/probes.d
@@ -78,7 +78,7 @@ provider libvirt {
probe rpc_keepalive_ref(void *ka, void *client, int refs);
probe rpc_keepalive_free(void *ka, void *client, int refs);
probe rpc_keepalive_start(void *ka, void *client, int interval, int count);
- probe rpc_keepalive_stop(void *ka, void *client);
+ probe rpc_keepalive_stop(void *ka, void *client, bool all);
probe rpc_keepalive_send(void *ka, void *client, int prog, int vers, int proc);
probe rpc_keepalive_received(void *ka, void *client, int prog, int vers, int proc);
probe rpc_keepalive_timeout(void *ka, void *client, int coundToDeath, int idle);
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index af46384..7863b73 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -4631,7 +4631,12 @@ remoteSetKeepAlive(virConnectPtr conn, int interval, unsigned int count)
goto cleanup;
}
- ret = virNetClientKeepAliveStart(priv->client, interval, count);
+ if (interval > 0) {
+ ret = virNetClientKeepAliveStart(priv->client, interval, count);
+ } else {
+ virNetClientKeepAliveStop(priv->client);
+ ret = 0;
+ }
cleanup:
remoteDriverUnlock(priv);
diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c
index 06b8e63..345c69d 100644
--- a/src/rpc/virkeepalive.c
+++ b/src/rpc/virkeepalive.c
@@ -372,32 +372,50 @@ cleanup:
}
-void
-virKeepAliveStop(virKeepAlivePtr ka)
+static void
+virKeepAliveStopInternal(virKeepAlivePtr ka, bool all)
{
virKeepAliveLock(ka);
PROBE(RPC_KEEPALIVE_STOP,
- "ka=%p client=%p",
- ka, ka->client);
+ "ka=%p client=%p all=%d",
+ ka, ka->client, all);
if (ka->timer > 0) {
virEventRemoveTimeout(ka->timer);
ka->timer = -1;
}
- if (ka->responseTimer > 0) {
- virEventRemoveTimeout(ka->responseTimer);
- ka->responseTimer = -1;
- }
+ if (all)
+ {
+
+ if (ka->responseTimer > 0) {
+ virEventRemoveTimeout(ka->responseTimer);
+ ka->responseTimer = -1;
+ }
- virNetMessageFree(ka->response);
- ka->response = NULL;
+ virNetMessageFree(ka->response);
+ ka->response = NULL;
+ }
virKeepAliveUnlock(ka);
}
+void
+virKeepAliveStop(virKeepAlivePtr ka)
+{
+ virKeepAliveStopInternal(ka, true);
+}
+
+
+void
+virKeepAliveStopSending(virKeepAlivePtr ka)
+{
+ virKeepAliveStopInternal(ka, false);
+}
+
+
bool
virKeepAliveCheckMessage(virKeepAlivePtr ka,
virNetMessagePtr msg)
diff --git a/src/rpc/virkeepalive.h b/src/rpc/virkeepalive.h
index f1654eb..af9e722 100644
--- a/src/rpc/virkeepalive.h
+++ b/src/rpc/virkeepalive.h
@@ -49,6 +49,7 @@ int virKeepAliveStart(virKeepAlivePtr ka,
int interval,
unsigned int count);
void virKeepAliveStop(virKeepAlivePtr ka);
+void virKeepAliveStopSending(virKeepAlivePtr ka);
bool virKeepAliveCheckMessage(virKeepAlivePtr ka,
virNetMessagePtr msg);
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 33b7701..d88288d 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -248,6 +248,14 @@ virNetClientKeepAliveStart(virNetClientPtr client,
return ret;
}
+void
+virNetClientKeepAliveStop(virNetClientPtr client)
+{
+ virNetClientLock(client);
+ virKeepAliveStopSending(client->keepalive);
+ virNetClientUnlock(client);
+}
+
static void
virNetClientKeepAliveDeadCB(void *opaque)
{
diff --git a/src/rpc/virnetclient.h b/src/rpc/virnetclient.h
index 7c30d2b..13b4f96 100644
--- a/src/rpc/virnetclient.h
+++ b/src/rpc/virnetclient.h
@@ -104,4 +104,6 @@ int virNetClientKeepAliveStart(virNetClientPtr client,
int interval,
unsigned int count);
+void virNetClientKeepAliveStop(virNetClientPtr client);
+
#endif /* __VIR_NET_CLIENT_H__ */
--
1.7.3.4
12 years, 7 months
[libvirt] [PATCH] virNetDevMacVLanVPortProfileRegisterCallback: Fix segfault
by Michal Privoznik
Currently, we are calling memcpy(virtPortProfile, ...) unconditionally.
Which means if virtPortProfile is NULL we SIGSEGV. Therefore, add check
to call memcpy() conditionally.
(gdb) bt
#0 virNetDevMacVLanVPortProfileRegisterCallback (ifname=0x7ffff3f1ee60 "macvtap0", macaddress=0x7fffe8096e34 "RT", linkdev=0x7fffe8098b90 "eth0",
vmuuid=0x7fffe8099558 "l\220*\237u`\326\213\325\227F\f-B\bD0g\t\350\377\177", virtPortProfile=0x0, vmOp=VIR_NETDEV_VPORT_PROFILE_OP_CREATE) at /usr/include/bits/string3.h:52
#1 0x00007ffff7782446 in virNetDevMacVLanCreateWithVPortProfile (tgifname=<optimized out>, macaddress=0x7fffe8096e34 "RT", linkdev=0x7fffe8098b90 "eth0", mode=<optimized out>, withTap=true, vnet_hdr=0,
vmuuid=0x7fffe8099558 "l\220*\237u`\326\213\325\227F\f-B\bD0g\t\350\377\177", virtPortProfile=0x0, res_ifname=0x7ffff3f1ef00, vmOp=VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
stateDir=0x7fffe800d900 "/var/run/libvirt/qemu", bandwidth=0x0) at util/virnetdevmacvlan.c:954
#2 0x00000000004738d4 in qemuPhysIfaceConnect ()
#3 0x000000000047e5f3 in qemuBuildCommandLine ()
#4 0x000000000049a404 in qemuProcessStart ()
#5 0x0000000000468ac9 in qemuDomainObjStart ()
#6 0x0000000000469112 in qemuDomainStartWithFlags ()
#7 0x00007ffff77ef0c6 in virDomainCreate (domain=0x768cb0) at libvirt.c:8162
#8 0x000000000043e158 in remoteDispatchDomainCreateHelper ()
#9 0x00007ffff783d835 in virNetServerProgramDispatchCall (msg=0x7fffe80cbe50, client=0x7699d0, server=0x7658a0, prog=0x770ab0) at rpc/virnetserverprogram.c:416
#10 virNetServerProgramDispatch (prog=0x770ab0, server=0x7658a0, client=0x7699d0, msg=0x7fffe80cbe50) at rpc/virnetserverprogram.c:289
#11 0x00007ffff7839961 in virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x7658a0) at rpc/virnetserver.c:161
#12 0x00007ffff776c1ce in virThreadPoolWorker (opaque=<optimized out>) at util/threadpool.c:144
#13 0x00007ffff776b876 in virThreadHelper (data=<optimized out>) at util/threads-pthread.c:161
#14 0x00007ffff74f0e2c in start_thread () from /lib64/libpthread.so.0
#15 0x00007ffff723766d in clone () from /lib64/libc.so.6
---
src/util/virnetdevmacvlan.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 879d846..c2fd6d0 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -769,9 +769,11 @@ virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
goto memory_error;
if ((calld->cr_ifname = strdup(ifname)) == NULL)
goto memory_error;
- if (VIR_ALLOC(calld->virtPortProfile) < 0)
- goto memory_error;
- memcpy(calld->virtPortProfile, virtPortProfile, sizeof(*virtPortProfile));
+ if (virtPortProfile) {
+ if (VIR_ALLOC(calld->virtPortProfile) < 0)
+ goto memory_error;
+ memcpy(calld->virtPortProfile, virtPortProfile, sizeof(*virtPortProfile));
+ }
if (VIR_ALLOC_N(calld->macaddress, VIR_MAC_BUFLEN) < 0)
goto memory_error;
memcpy(calld->macaddress, macaddress, VIR_MAC_BUFLEN);
--
1.7.8.5
12 years, 7 months