[libvirt] [PATCH v2 0/2] Libvirt Wireshark dissector
by Yuto KAWAMURA(kawamuray)
From: "Yuto KAWAMURA(kawamuray)" <kawamuray.dadada(a)gmail.com>
Introduce Wireshark dissector plugin which adds support to Wireshark
for dissecting libvirt RPC protocol.
This feature was presented by Michal Privoznik year before last[1].
But it did only support dissecting packet headers.
This time I enhanced that dissector to support dissecting packet
payload. Furthermore, I provide code generator of dissector. So you
can get fresh build of dissector from libvirt RPC specification file
at any version you like.
[1] http://www.redhat.com/archives/libvir-list/2011-October/msg00301.html
Yuto KAWAMURA(kawamuray) (2):
Introduce Libvirt Wireshark dissector
Add sample output of Wireshark dissector
Makefile.am | 3 +-
cfg.mk | 6 +-
configure.ac | 72 +-
tools/wireshark/Makefile.am | 29 +
tools/wireshark/README.md | 31 +
tools/wireshark/samples/libvirt-sample.pdml | 206 ++++++
tools/wireshark/src/.gitignore | 4 +
tools/wireshark/src/Makefile.am | 42 ++
tools/wireshark/src/moduleinfo.h | 37 +
tools/wireshark/src/packet-libvirt.c | 513 ++++++++++++++
tools/wireshark/src/packet-libvirt.h | 128 ++++
tools/wireshark/util/genxdrstub.pl | 1010 +++++++++++++++++++++++++++
tools/wireshark/util/make-dissector-reg | 199 ++++++
13 files changed, 2275 insertions(+), 5 deletions(-)
create mode 100644 tools/wireshark/Makefile.am
create mode 100644 tools/wireshark/README.md
create mode 100644 tools/wireshark/samples/libvirt-sample.pdml
create mode 100644 tools/wireshark/src/.gitignore
create mode 100644 tools/wireshark/src/Makefile.am
create mode 100644 tools/wireshark/src/moduleinfo.h
create mode 100644 tools/wireshark/src/packet-libvirt.c
create mode 100644 tools/wireshark/src/packet-libvirt.h
create mode 100755 tools/wireshark/util/genxdrstub.pl
create mode 100755 tools/wireshark/util/make-dissector-reg
--
1.8.1.5
11 years, 2 months
[libvirt] qemu, numa: non-contiguous cpusets
by Borislav Petkov
Btw,
while I got your attention, on a not-really related topic: how do we
feel about adding support for specifying a non-contiguous set of cpus
for a numa node in qemu with the -numa option? I.e., like this, for
example:
x86_64-softmmu/qemu-system-x86_64 -smp 8 -numa node,nodeid=0,cpus=0\;2\;4-5 -numa node,nodeid=1,cpus=1\;3\;6-7
The ';' needs to be escaped from the shell but I'm open for better
suggestions.
Here's a diff:
---
diff --git a/vl.c b/vl.c
index 4e709d5c1c20..82a6c8451fb0 100644
--- a/vl.c
+++ b/vl.c
@@ -1261,9 +1261,27 @@ char *get_boot_devices_list(size_t *size)
return list;
}
+static int __numa_set_cpus(unsigned long *map, int start, int end)
+{
+ if (end >= MAX_CPUMASK_BITS) {
+ end = MAX_CPUMASK_BITS - 1;
+ fprintf(stderr,
+ "qemu: NUMA: A max of %d VCPUs are supported\n",
+ MAX_CPUMASK_BITS);
+ return -EINVAL;
+ }
+
+ if (end < start) {
+ return -EINVAL;
+ }
+
+ bitmap_set(map, start, end-start+1);
+ return 0;
+}
+
static void numa_node_parse_cpus(int nodenr, const char *cpus)
{
- char *endptr;
+ char *endptr, *ptr = (char *)cpus;
unsigned long long value, endvalue;
/* Empty CPU range strings will be considered valid, they will simply
@@ -1273,7 +1291,8 @@ static void numa_node_parse_cpus(int nodenr, const char *cpus)
return;
}
- if (parse_uint(cpus, &value, &endptr, 10) < 0) {
+fromthetop:
+ if (parse_uint(ptr, &value, &endptr, 10) < 0) {
goto error;
}
if (*endptr == '-') {
@@ -1282,22 +1301,22 @@ static void numa_node_parse_cpus(int nodenr, const char *cpus)
}
} else if (*endptr == '\0') {
endvalue = value;
- } else {
- goto error;
- }
+ } else if (*endptr == ';') {
+ if (__numa_set_cpus(node_cpumask[nodenr], value, value) < 0) {
+ goto error;
+ }
+ endptr++;
+ if (*endptr == '\0')
+ return;
- if (endvalue >= MAX_CPUMASK_BITS) {
- endvalue = MAX_CPUMASK_BITS - 1;
- fprintf(stderr,
- "qemu: NUMA: A max of %d VCPUs are supported\n",
- MAX_CPUMASK_BITS);
- }
+ ptr = endptr;
- if (endvalue < value) {
+ goto fromthetop;
+ } else {
goto error;
}
- bitmap_set(node_cpumask[nodenr], value, endvalue-value+1);
+ __numa_set_cpus(node_cpumask[nodenr], value, endvalue);
return;
error:
--
Thanks.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
11 years, 2 months
[libvirt] [PATCH] qemu: process: Silence coverity warning when rewinding log file
by Peter Krempa
The change in ef29de14c37d14abc546e90555a0093797facfdd that introduced
better error logging from qemu introduced a warning from coverity about
unused return value from lseek. Silence this warning and fix typo in the
corresponding error message.
Reported by: John Ferlan
---
src/qemu/qemu_process.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d7be731..7a30a5e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1845,10 +1845,10 @@ cleanup:
}
len = strlen(buf);
- /* best effor seek - we need to reset to the original position, so that
+ /* best effort seek - we need to reset to the original position, so that
* a possible read of the fd in the monitor code doesn't influence this
* error delivery option */
- lseek(logfd, pos, SEEK_SET);
+ ignore_value(lseek(logfd, pos, SEEK_SET));
qemuProcessReadLog(logfd, buf + len, buf_size - len - 1, 0, true);
virReportError(VIR_ERR_INTERNAL_ERROR,
_("process exited while connecting to monitor: %s"),
--
1.8.3.2
11 years, 2 months
[libvirt] [PATCH v2] genprotocol.pl: Fix code on FreeBSD too
by Michal Privoznik
On some systems (linux, cygwin and gnukfreebsd) rpcgen generates files
which when compiling produces this warning:
remote/remote_protocol.c: In function 'xdr_remote_node_get_cpu_stats_ret':
remote/remote_protocol.c:530: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Hence, on those systems we need to post-process the files by the
rpc/genprotocol.pl perl script. At the beginning of the script the OS is
detected via $^O perl variable. From my latest build on FreeBSD I see we
need to fix the code there too. On FreeBSD the variable contains
'freebsd' string:
http://perldoc.perl.org/perlport.html#PLATFORMS
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/rpc/genprotocol.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl
index 4f8b6c4..6e6d6d4 100755
--- a/src/rpc/genprotocol.pl
+++ b/src/rpc/genprotocol.pl
@@ -43,7 +43,7 @@ open RPCGEN, "-|", $rpcgen, $mode, $xdrdef
open TARGET, ">$target"
or die "cannot create $target: $!";
-my $fixup = $^O eq "linux" || $^O eq "cygwin" || $^O eq "gnukfreebsd";
+my $fixup = $^O eq "linux" || $^O eq "cygwin" || $^O eq "gnukfreebsd" || $^O eq "freebsd";
if ($mode eq "-c") {
print TARGET "#include <config.h>\n";
--
1.8.1.5
11 years, 2 months
[libvirt] [PATCH] genprotocol.pl: Fix code on FreeBSD too
by Michal Privoznik
On some systems (linux, cygwin and freebsd) rpcgen generates files which
when compiling produces this warning:
remote/remote_protocol.c: In function 'xdr_remote_node_get_cpu_stats_ret':
remote/remote_protocol.c:530: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Hence, on those systems we need to post-process the files by
the rpc/genprotocol.pl perl script. At the beginning of the script the
OS is detected via $^O perl variable. On FreeBSD it contains 'freebsd'
string and not 'gnukfreebsd' as is currently there:
http://perldoc.perl.org/perlport.html#PLATFORMS
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/rpc/genprotocol.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl
index 4f8b6c4..abd40fd 100755
--- a/src/rpc/genprotocol.pl
+++ b/src/rpc/genprotocol.pl
@@ -43,7 +43,7 @@ open RPCGEN, "-|", $rpcgen, $mode, $xdrdef
open TARGET, ">$target"
or die "cannot create $target: $!";
-my $fixup = $^O eq "linux" || $^O eq "cygwin" || $^O eq "gnukfreebsd";
+my $fixup = $^O eq "linux" || $^O eq "cygwin" || $^O eq "freebsd";
if ($mode eq "-c") {
print TARGET "#include <config.h>\n";
--
1.8.1.5
11 years, 2 months
[libvirt] [PATCH]lxc: goto cleanup if lxcContainerBuildInitCmd returns NULL
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
We should goto cleanup directly
if lxcContainerBuildInitCmd returns NULL,
which would avoid lots of unnecessary works.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/lxc/lxc_container.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 3fdf397..f03f236 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1820,7 +1820,10 @@ static int lxcContainerChild(void *data)
if ((hasReboot = lxcContainerHasReboot()) < 0)
goto cleanup;
- cmd = lxcContainerBuildInitCmd(vmDef);
+ if (!(cmd = lxcContainerBuildInitCmd(vmDef))) {
+ VIR_DEBUG("Failed to build init cmd for container");
+ goto cleanup;
+ }
virCommandWriteArgLog(cmd, 1);
if (lxcContainerSetID(vmDef) < 0)
--
1.8.2.1
11 years, 2 months
[libvirt] Openvswitch support question
by Vasiliy Tolstov
Hi all.
I'm using vs witch and libvirt 1.2.
I'm write vswitch controller and want to react on up/down port in virtual
switch.
All fork fine, but message sent to controller does not contain Mac address
of added interface. Does this libvirt problem or this is only vswitch error?
11 years, 2 months
[libvirt] [PATCH]lxc: do cleanup when failed to bind fs as read-only
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
We forgot to 'goto cleanup' when lxcContainerMountFSTmpfs
failed to bind fs as read-only.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/lxc/lxc_container.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index c60f5d8..3fdf397 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1451,6 +1451,7 @@ static int lxcContainerMountFSTmpfs(virDomainFSDefPtr fs,
virReportSystemError(errno,
_("Failed to make directory %s readonly"),
fs->dst);
+ goto cleanup;
}
}
--
1.8.2.1
11 years, 2 months
[libvirt] [PATCH] storage: use btrfs file clone ioctl when possible
by Oskari Saarenmaa
Btrfs provides a copy-on-write clone ioctl so let's try to use it instead
of copying files block by block. The ioctl is executed unconditionally if
it's available and we fall back to block copying if it fails, similarly to
cp --reflink=auto.
Signed-off-by: Oskari Saarenmaa <os(a)ohmu.fi>
---
configure.ac | 5 +++++
src/storage/storage_backend.c | 11 +++++++++++
2 files changed, 16 insertions(+)
diff --git a/configure.ac b/configure.ac
index 553015a..acae92e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1984,6 +1984,11 @@ fi
AM_CONDITIONAL([WITH_STORAGE], [test "$with_storage" = "yes"])
dnl
+dnl check for headers for filesystem specific operations
+dnl
+AC_CHECK_HEADERS([linux/btrfs.h])
+
+dnl
dnl check for (ESX)
dnl
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index b7edf85..40bfb73 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -38,6 +38,9 @@
# include <sys/ioctl.h>
# include <linux/fs.h>
#endif
+#ifdef HAVE_LINUX_BTRFS_H
+# include <linux/btrfs.h>
+#endif
#if WITH_SELINUX
# include <selinux/selinux.h>
@@ -149,6 +152,13 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
goto cleanup;
}
+#ifdef HAVE_LINUX_BTRFS_H
+ /* try to perform a btrfs CoW clone */
+ if (ioctl(fd, BTRFS_IOC_CLONE, inputfd) == 0) {
+ goto done;
+ }
+#endif
+
#ifdef __linux__
if (ioctl(fd, BLKBSZGET, &wbytes) < 0) {
wbytes = 0;
@@ -210,6 +220,7 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
} while ((amtleft -= interval) > 0);
}
+done:
if (fdatasync(fd) < 0) {
ret = -errno;
virReportSystemError(errno, _("cannot sync data to file '%s'"),
--
1.8.3.1
11 years, 2 months