[libvirt] [PATCH 0/3] virsh: Cleanups and checks for options
by Martin Kletzander
Option-ordering and typing checks and a reorder so tests pass.
Martin Kletzander (3):
virsh: Reorder some options
virsh: Enforce proper ordering of options
virsh: Error out if VSH_OT_STRING option has VSH_OFLAG_REQ flag
tools/virsh-domain.c | 76 ++++++++++++++++++++++++++--------------------------
tools/virsh-pool.c | 8 +++---
tools/virsh-volume.c | 8 +++---
tools/virsh.c | 11 +++++++-
4 files changed, 56 insertions(+), 47 deletions(-)
--
2.1.3
10 years
[libvirt] [PATCH 0/4] [RFE] introduce new vgamem attribute for video devices
by Pavel Hrdina
This patch series fixes few issues with vram and ram attributes for video
devices and introduces new vgamem attribute to allow setting up video memory
size for QEMU video devices.
Pavel Hrdina (4):
video: cleanup usage of vram attribute and update documentation
qxl: fix setting ram and vram values for qemu qxl device
caps: introduce new qemu capability for vgamem_mb device property
qemu-command: introduce new vgamem attribute for video devices
docs/formatdomain.html.in | 68 ++++--
docs/schemas/domaincommon.rng | 5 +
src/conf/domain_conf.c | 66 +++++-
src/conf/domain_conf.h | 5 +-
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 41 ++++
src/qemu/qemu_capabilities.h | 5 +
src/qemu/qemu_command.c | 53 ++++-
tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 4 +
tests/qemucapabilitiesdata/caps_1.2.2-1.replies | 232 ++++++++++++++++++-
tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 5 +
tests/qemucapabilitiesdata/caps_1.3.1-1.replies | 248 ++++++++++++++++++++-
tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 5 +
tests/qemucapabilitiesdata/caps_1.4.2-1.replies | 248 ++++++++++++++++++++-
tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 5 +
tests/qemucapabilitiesdata/caps_1.5.3-1.replies | 248 ++++++++++++++++++++-
tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 5 +
tests/qemucapabilitiesdata/caps_1.6.0-1.replies | 248 ++++++++++++++++++++-
tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 5 +
tests/qemucapabilitiesdata/caps_1.6.50-1.replies | 248 ++++++++++++++++++++-
tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 5 +
tests/qemucapabilitiesdata/caps_2.1.1-1.replies | 248 ++++++++++++++++++++-
...qemuhotplug-console-compat-2+console-virtio.xml | 2 +-
.../qemuxml2argv-console-compat-2.xml | 2 +-
.../qemuxml2argv-graphics-listen-network.xml | 2 +-
.../qemuxml2argv-graphics-sdl-fullscreen.xml | 2 +-
.../qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml | 2 +-
.../qemuxml2argv-graphics-spice-compression.args | 2 +-
.../qemuxml2argv-graphics-spice-compression.xml | 4 +-
.../qemuxml2argv-graphics-spice-qxl-vga.xml | 4 +-
.../qemuxml2argv-graphics-spice-sasl.args | 4 +-
.../qemuxml2argv-graphics-spice.args | 4 +-
.../qemuxml2argv-graphics-spice.xml | 4 +-
.../qemuxml2argv-graphics-vnc-policy.xml | 2 +-
.../qemuxml2argv-graphics-vnc-sasl.xml | 2 +-
.../qemuxml2argv-graphics-vnc-socket.xml | 2 +-
.../qemuxml2argv-graphics-vnc-tls.xml | 2 +-
.../qemuxml2argv-graphics-vnc-websocket.xml | 2 +-
.../qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml | 2 +-
.../qemuxml2argv-net-bandwidth.xml | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml | 2 +-
.../qemuxml2argv-pcihole64-q35.args | 2 +-
.../qemuxml2argv-pcihole64-q35.xml | 2 +-
.../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-q35.args | 2 +-
.../qemuxml2argv-serial-spiceport.xml | 2 +-
.../qemuxml2argv-video-qxl-device-vgamem.args | 6 +
.../qemuxml2argv-video-qxl-device-vgamem.xml | 29 +++
.../qemuxml2argv-video-qxl-device.args | 6 +
.../qemuxml2argv-video-qxl-device.xml | 29 +++
.../qemuxml2argv-video-qxl-nodevice.args | 5 +
.../qemuxml2argv-video-qxl-nodevice.xml | 29 +++
.../qemuxml2argv-video-qxl-sec-device-vgamem.args | 8 +
.../qemuxml2argv-video-qxl-sec-device-vgamem.xml | 32 +++
.../qemuxml2argv-video-qxl-sec-device.args | 7 +
.../qemuxml2argv-video-qxl-sec-device.xml | 32 +++
.../qemuxml2argv-video-qxl-sec-nodevice.xml | 32 +++
.../qemuxml2argv-video-vga-device-vgamem.args | 6 +
.../qemuxml2argv-video-vga-device-vgamem.xml | 29 +++
.../qemuxml2argv-video-vga-device.args | 6 +
.../qemuxml2argv-video-vga-device.xml | 29 +++
.../qemuxml2argv-video-vga-nodevice.args | 5 +
.../qemuxml2argv-video-vga-nodevice.xml | 29 +++
tests/qemuxml2argvtest.c | 18 ++
.../qemuxml2xmlout-graphics-listen-network2.xml | 2 +-
.../qemuxml2xmlout-graphics-spice-timeout.xml | 2 +-
.../qemuxml2xmlout-pci-autoadd-addr.xml | 2 +-
.../qemuxml2xmlout-pci-autoadd-idx.xml | 2 +-
tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml | 2 +-
...emuxml2xmlout-seclabel-dynamic-none-relabel.xml | 2 +-
70 files changed, 2288 insertions(+), 117 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-nodevice.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.xml
--
2.0.4
10 years
[libvirt] [PATCH] virsh: Fix msg: blockjob is aborted from another client
by Erik Skultety
When a block{pull, copy, commit} is aborted via keyboard interrupt,
the job is properly canceled followed by proper error message.
However, when the job receives an abort from another client connected
to the same domain, the error message incorrectly indicates that
a blockjob has been finished successfully, though the abort request
took effect. This patch introduces a new blockjob abort handler, which
is registered when the client calls block{copy,commit,pull} routine,
providing its caller the status of the finished blockjob.
---
tools/virsh-domain.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 71 insertions(+), 3 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 8e743f1..025395f 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1710,6 +1710,17 @@ static void vshCatchInt(int sig ATTRIBUTE_UNUSED,
intCaught = 1;
}
+static void
+vshBlockJobStatusHandler(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virDomainPtr dom ATTRIBUTE_UNUSED,
+ const char *disk ATTRIBUTE_UNUSED,
+ int type ATTRIBUTE_UNUSED,
+ int status,
+ void *opaque)
+{
+ *(int *) opaque = status;
+}
+
/*
* "blockcommit" command
*/
@@ -1809,6 +1820,8 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd)
const char *path = NULL;
bool quit = false;
int abort_flags = 0;
+ int status = -1;
+ int cb_id = -1;
blocking |= vshCommandOptBool(cmd, "timeout") || pivot || finish;
if (blocking) {
@@ -1838,6 +1851,18 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd)
return false;
}
+ virConnectDomainEventGenericCallback cb =
+ VIR_DOMAIN_EVENT_CALLBACK(vshBlockJobStatusHandler);
+
+ if ((cb_id = virConnectDomainEventRegisterAny(ctl->conn,
+ dom,
+ VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2,
+ cb,
+ &status,
+ NULL)) < 0) {
+ goto cleanup;
+ }
+
if (!blockJobImpl(ctl, cmd, VSH_CMD_BLOCK_JOB_COMMIT, &dom))
goto cleanup;
@@ -1879,7 +1904,7 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd)
intCaught ? "interrupted" : "timeout");
intCaught = 0;
timeout = 0;
- quit = true;
+ status = VIR_DOMAIN_BLOCK_JOB_CANCELED;
if (virDomainBlockJobAbort(dom, path, abort_flags) < 0) {
vshError(ctl, _("failed to abort job for disk %s"), path);
goto cleanup;
@@ -1891,6 +1916,9 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd)
}
}
+ if (status == VIR_DOMAIN_BLOCK_JOB_CANCELED)
+ quit = true;
+
if (verbose && !quit) {
/* printf [100 %] */
vshPrintJobProgress(_("Block Commit"), 0, 1);
@@ -1921,6 +1949,8 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd)
virDomainFree(dom);
if (blocking)
sigaction(SIGINT, &old_sig_action, NULL);
+ if (virConnectDomainEventDeregisterAny(ctl->conn, cb_id) < 0)
+ ret = false;
return ret;
}
@@ -2044,6 +2074,8 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
char *xmlstr = NULL;
virTypedParameterPtr params = NULL;
int nparams = 0;
+ int status = -1;
+ int cb_id = -1;
if (vshCommandOptStringReq(ctl, cmd, "path", &path) < 0)
return false;
@@ -2084,6 +2116,18 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
return false;
}
+ virConnectDomainEventGenericCallback cb =
+ VIR_DOMAIN_EVENT_CALLBACK(vshBlockJobStatusHandler);
+
+ if ((cb_id = virConnectDomainEventRegisterAny(ctl->conn,
+ dom,
+ VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2,
+ cb,
+ &status,
+ NULL)) < 0) {
+ goto cleanup;
+ }
+
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
goto cleanup;
@@ -2217,7 +2261,7 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
intCaught ? "interrupted" : "timeout");
intCaught = 0;
timeout = 0;
- quit = true;
+ status = VIR_DOMAIN_BLOCK_JOB_CANCELED;
if (virDomainBlockJobAbort(dom, path, abort_flags) < 0) {
vshError(ctl, _("failed to abort job for disk %s"), path);
goto cleanup;
@@ -2229,6 +2273,9 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
}
}
+ if (status == VIR_DOMAIN_BLOCK_JOB_CANCELED)
+ quit = true;
+
if (!quit && pivot) {
abort_flags |= VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT;
if (virDomainBlockJobAbort(dom, path, abort_flags) < 0) {
@@ -2257,6 +2304,8 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
virDomainFree(dom);
if (blocking)
sigaction(SIGINT, &old_sig_action, NULL);
+ if (virConnectDomainEventDeregisterAny(ctl->conn, cb_id) < 0)
+ ret = false;
return ret;
}
@@ -2514,6 +2563,8 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
const char *path = NULL;
bool quit = false;
int abort_flags = 0;
+ int status = -1;
+ int cb_id = -1;
if (blocking) {
if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0)
@@ -2539,6 +2590,18 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
return false;
}
+ virConnectDomainEventGenericCallback cb =
+ VIR_DOMAIN_EVENT_CALLBACK(vshBlockJobStatusHandler);
+
+ if ((cb_id = virConnectDomainEventRegisterAny(ctl->conn,
+ dom,
+ VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2,
+ cb,
+ &status,
+ NULL)) < 0) {
+ goto cleanup;
+ }
+
if (!blockJobImpl(ctl, cmd, VSH_CMD_BLOCK_JOB_PULL, &dom))
goto cleanup;
@@ -2575,7 +2638,7 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
intCaught ? "interrupted" : "timeout");
intCaught = 0;
timeout = 0;
- quit = true;
+ status = VIR_DOMAIN_BLOCK_JOB_CANCELED;
if (virDomainBlockJobAbort(dom, path, abort_flags) < 0) {
vshError(ctl, _("failed to abort job for disk %s"), path);
goto cleanup;
@@ -2587,6 +2650,9 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
}
}
+ if (status == VIR_DOMAIN_BLOCK_JOB_CANCELED)
+ quit = true;
+
if (verbose && !quit) {
/* printf [100 %] */
vshPrintJobProgress(_("Block Pull"), 0, 1);
@@ -2599,6 +2665,8 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
virDomainFree(dom);
if (blocking)
sigaction(SIGINT, &old_sig_action, NULL);
+ if (virConnectDomainEventDeregisterAny(ctl->conn, cb_id) < 0)
+ ret = false;
return ret;
}
--
1.9.3
10 years
[libvirt] [PATCH] drvbhyve: Clean-up some used ATTRIBUTE_UNUSEDs.
by Conrad Meyer
---
src/bhyve/bhyve_device.c | 2 +-
src/bhyve/bhyve_driver.c | 10 +++++-----
src/bhyve/bhyve_process.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/bhyve/bhyve_device.c b/src/bhyve/bhyve_device.c
index fa266de..b458275 100644
--- a/src/bhyve/bhyve_device.c
+++ b/src/bhyve/bhyve_device.c
@@ -62,7 +62,7 @@ bhyveCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
}
virDomainPCIAddressSetPtr
-bhyveDomainPCIAddressSetCreate(virDomainDefPtr def ATTRIBUTE_UNUSED, unsigned int nbuses)
+bhyveDomainPCIAddressSetCreate(virDomainDefPtr def, unsigned int nbuses)
{
virDomainPCIAddressSetPtr addrs;
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 3820737..331f310 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -231,7 +231,7 @@ bhyveConnectClose(virConnectPtr conn)
}
static char *
-bhyveConnectGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
+bhyveConnectGetHostname(virConnectPtr conn)
{
if (virConnectGetHostnameEnsureACL(conn) < 0)
return NULL;
@@ -265,7 +265,7 @@ bhyveConnectGetSysinfo(virConnectPtr conn, unsigned int flags)
}
static int
-bhyveConnectGetVersion(virConnectPtr conn ATTRIBUTE_UNUSED, unsigned long *version)
+bhyveConnectGetVersion(virConnectPtr conn, unsigned long *version)
{
struct utsname ver;
@@ -1143,7 +1143,7 @@ bhyveStateCleanup(void)
}
static int
-bhyveStateInitialize(bool priveleged ATTRIBUTE_UNUSED,
+bhyveStateInitialize(bool priveleged,
virStateInhibitCallback callback ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
@@ -1249,7 +1249,7 @@ bhyveStateAutoStart(void)
}
static int
-bhyveConnectGetMaxVcpus(virConnectPtr conn ATTRIBUTE_UNUSED,
+bhyveConnectGetMaxVcpus(virConnectPtr conn,
const char *type)
{
if (virConnectGetMaxVcpusEnsureACL(conn) < 0)
@@ -1317,7 +1317,7 @@ bhyveNodeSetMemoryParameters(virConnectPtr conn,
}
static char *
-bhyveConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED,
+bhyveConnectBaselineCPU(virConnectPtr conn,
const char **xmlCPUs,
unsigned int ncpus,
unsigned int flags)
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 21f8331..a30e36a 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -251,7 +251,7 @@ virBhyveProcessStart(virConnectPtr conn,
int
virBhyveProcessStop(bhyveConnPtr driver,
virDomainObjPtr vm,
- virDomainShutoffReason reason ATTRIBUTE_UNUSED)
+ virDomainShutoffReason reason)
{
int ret = -1;
virCommandPtr cmd = NULL;
--
1.9.3
10 years
[libvirt] [libvirt-glib][PATCH] m4: sync macros with libvirt
by Michal Privoznik
The macros under the m4 directory are outdated a bit. When trying
to compile with newer gcc I see some errors:
make[2]: Entering directory '/home/zippy/work/libvirt/libvirt-glib.git/libvirt-glib'
CC libvirt_glib_1_0_la-libvirt-glib-error.lo
gcc: warning: switch '-Wmudflap' is no longer supported
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
m4/manywarnings.m4 | 217 ++++++++++++++++++++++++++++----------------
m4/virt-compile-warnings.m4 | 214 ++++++++++++++++++++++++++++++++-----------
m4/warnings.m4 | 2 +-
3 files changed, 299 insertions(+), 134 deletions(-)
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index fd0e372..3e6dd21 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,5 +1,5 @@
-# manywarnings.m4 serial 3
-dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
+# manywarnings.m4 serial 7
+dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -35,14 +35,12 @@ AC_DEFUN([gl_MANYWARN_COMPLEMENT],
# make sure your gcc understands it.
AC_DEFUN([gl_MANYWARN_ALL_GCC],
[
- dnl First, check if -Wno-missing-field-initializers is needed.
- dnl -Wmissing-field-initializers is implied by -W, but that issues
- dnl warnings with GCC version before 4.7, for the common idiom
- dnl of initializing types on the stack to zero, using { 0, }
+ dnl First, check for some issues that only occur when combining multiple
+ dnl gcc warning categories.
AC_REQUIRE([AC_PROG_CC])
if test -n "$GCC"; then
- dnl First, check -W -Werror -Wno-missing-field-initializers is supported
+ dnl Check if -W -Werror -Wno-missing-field-initializers is supported
dnl with the current $CC $CFLAGS $CPPFLAGS.
AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported])
AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [
@@ -77,108 +75,171 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
])
AC_MSG_RESULT([$gl_cv_cc_nomfi_needed])
fi
+
+ dnl Next, check if -Werror -Wuninitialized is useful with the
+ dnl user's choice of $CFLAGS; some versions of gcc warn that it
+ dnl has no effect if -O is not also used
+ AC_MSG_CHECKING([whether -Wuninitialized is supported])
+ AC_CACHE_VAL([gl_cv_cc_uninitialized_supported], [
+ gl_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wuninitialized"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[]], [[]])],
+ [gl_cv_cc_uninitialized_supported=yes],
+ [gl_cv_cc_uninitialized_supported=no])
+ CFLAGS="$gl_save_CFLAGS"])
+ AC_MSG_RESULT([$gl_cv_cc_uninitialized_supported])
+
fi
+ # List all gcc warning categories.
+ # To compare this list to your installed GCC's, run this Bash command:
+ #
+ # comm -3 \
+ # <(sed -n 's/^ *\(-[^ ]*\) .*/\1/p' manywarnings.m4 | sort) \
+ # <(gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort |
+ # grep -v -x -f <(
+ # awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec))
+
gl_manywarn_set=
for gl_manywarn_item in \
- -Wall \
-W \
- -Wformat-y2k \
- -Wformat-nonliteral \
- -Wformat-security \
- -Winit-self \
- -Wmissing-include-dirs \
- -Wswitch-default \
- -Wswitch-enum \
- -Wunused \
- -Wunknown-pragmas \
- -Wstrict-aliasing \
- -Wstrict-overflow \
- -Wsystem-headers \
- -Wfloat-equal \
- -Wtraditional \
- -Wtraditional-conversion \
- -Wdeclaration-after-statement \
- -Wundef \
- -Wshadow \
- -Wunsafe-loop-optimizations \
- -Wpointer-arith \
- -Wbad-function-cast \
- -Wc++-compat \
- -Wcast-qual \
- -Wcast-align \
- -Wwrite-strings \
- -Wconversion \
- -Wsign-conversion \
- -Wlogical-op \
- -Waggregate-return \
- -Wstrict-prototypes \
- -Wold-style-definition \
- -Wmissing-prototypes \
- -Wmissing-declarations \
- -Wmissing-noreturn \
- -Wmissing-format-attribute \
- -Wpacked \
- -Wpadded \
- -Wredundant-decls \
- -Wnested-externs \
- -Wunreachable-code \
- -Winline \
- -Winvalid-pch \
- -Wlong-long \
- -Wvla \
- -Wvolatile-register-var \
- -Wdisabled-optimization \
- -Wstack-protector \
- -Woverlength-strings \
- -Wbuiltin-macro-redefined \
- -Wmudflap \
- -Wpacked-bitfield-compat \
- -Wsync-nand \
- ; do
- gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
- done
- # The following are not documented in the manual but are included in
- # output from gcc --help=warnings.
- for gl_manywarn_item in \
- -Wattributes \
- -Wcoverage-mismatch \
- -Wmultichar \
- -Wunused-macros \
- ; do
- gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
- done
- # More warnings from gcc 4.6.2 --help=warnings.
- for gl_manywarn_item in \
-Wabi \
+ -Waddress \
+ -Waggressive-loop-optimizations \
+ -Wall \
+ -Warray-bounds \
+ -Wattributes \
+ -Wbad-function-cast \
+ -Wbuiltin-macro-redefined \
+ -Wcast-align \
+ -Wchar-subscripts \
+ -Wclobbered \
+ -Wcomment \
+ -Wcomments \
+ -Wcoverage-mismatch \
-Wcpp \
+ -Wdate-time \
-Wdeprecated \
-Wdeprecated-declarations \
+ -Wdisabled-optimization \
-Wdiv-by-zero \
-Wdouble-promotion \
+ -Wempty-body \
-Wendif-labels \
+ -Wenum-compare \
-Wextra \
-Wformat-contains-nul \
-Wformat-extra-args \
+ -Wformat-nonliteral \
+ -Wformat-security \
+ -Wformat-y2k \
-Wformat-zero-length \
- -Wformat=2 \
+ -Wfree-nonheap-object \
+ -Wignored-qualifiers \
+ -Wimplicit \
+ -Wimplicit-function-declaration \
+ -Wimplicit-int \
+ -Winit-self \
+ -Winline \
+ -Wint-to-pointer-cast \
+ -Winvalid-memory-model \
+ -Winvalid-pch \
+ -Wjump-misses-init \
+ -Wlogical-op \
+ -Wmain \
+ -Wmaybe-uninitialized \
+ -Wmissing-braces \
+ -Wmissing-declarations \
+ -Wmissing-field-initializers \
+ -Wmissing-include-dirs \
+ -Wmissing-parameter-type \
+ -Wmissing-prototypes \
-Wmultichar \
- -Wnormalized=nfc \
+ -Wnarrowing \
+ -Wnested-externs \
+ -Wnonnull \
+ -Wold-style-declaration \
+ -Wold-style-definition \
+ -Wopenmp-simd \
-Woverflow \
+ -Woverlength-strings \
+ -Woverride-init \
+ -Wpacked \
+ -Wpacked-bitfield-compat \
+ -Wparentheses \
+ -Wpointer-arith \
+ -Wpointer-sign \
-Wpointer-to-int-cast \
-Wpragmas \
+ -Wreturn-local-addr \
+ -Wreturn-type \
+ -Wsequence-point \
+ -Wshadow \
+ -Wsizeof-pointer-memaccess \
+ -Wstack-protector \
+ -Wstrict-aliasing \
+ -Wstrict-overflow \
+ -Wstrict-prototypes \
-Wsuggest-attribute=const \
+ -Wsuggest-attribute=format \
-Wsuggest-attribute=noreturn \
-Wsuggest-attribute=pure \
+ -Wswitch \
+ -Wswitch-default \
+ -Wsync-nand \
+ -Wsystem-headers \
-Wtrampolines \
+ -Wtrigraphs \
+ -Wtype-limits \
+ -Wuninitialized \
+ -Wunknown-pragmas \
+ -Wunsafe-loop-optimizations \
+ -Wunused \
+ -Wunused-but-set-parameter \
+ -Wunused-but-set-variable \
+ -Wunused-function \
+ -Wunused-label \
+ -Wunused-local-typedefs \
+ -Wunused-macros \
+ -Wunused-parameter \
+ -Wunused-result \
+ -Wunused-value \
+ -Wunused-variable \
+ -Wvarargs \
+ -Wvariadic-macros \
+ -Wvector-operation-performance \
+ -Wvla \
+ -Wvolatile-register-var \
+ -Wwrite-strings \
+ \
; do
gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
done
- # Disable the missing-field-initializers warning if needed
+ # gcc --help=warnings outputs an unusual form for this option; list
+ # it here so that the above 'comm' command doesn't report a false match.
+ gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc"
+
+ # These are needed for older GCC versions.
+ if test -n "$GCC"; then
+ case `($CC --version) 2>/dev/null` in
+ 'gcc (GCC) '[[0-3]].* | \
+ 'gcc (GCC) '4.[[0-7]].*)
+ gl_manywarn_set="$gl_manywarn_set -fdiagnostics-show-option"
+ gl_manywarn_set="$gl_manywarn_set -funit-at-a-time"
+ ;;
+ esac
+ fi
+
+ # Disable specific options as needed.
if test "$gl_cv_cc_nomfi_needed" = yes; then
gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
fi
+ if test "$gl_cv_cc_uninitialized_supported" = no; then
+ gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized"
+ fi
+
$1=$gl_manywarn_set
])
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index b1c4bd7..5081ab6 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -33,19 +33,96 @@ AC_DEFUN([LIBVIRT_GLIB_COMPILE_WARNINGS],[
dontwarn="$dontwarn -Wpadded"
# GCC very confused with -O2
dontwarn="$dontwarn -Wunreachable-code"
- # We explicitly need to remove const sometimes
+ # Too many to deal with
+ dontwarn="$dontwarn -Wconversion"
+ # Too many to deal with
+ dontwarn="$dontwarn -Wsign-conversion"
+ # GNULIB gettext.h violates
+ dontwarn="$dontwarn -Wvla"
+ # Many GNULIB header violations
+ dontwarn="$dontwarn -Wundef"
+ # Need to allow bad cast for execve()
dontwarn="$dontwarn -Wcast-qual"
- # Allow vars decl in the middle of blocks
- dontwarn="$dontwarn -Wdeclaration-after-statement"
- # Using long long is fine
+ # We need to use long long in many places
dontwarn="$dontwarn -Wlong-long"
- # Unused macros are ok
+ # We allow manual list of all enum cases without default:
+ dontwarn="$dontwarn -Wswitch-default"
+ # We allow optional default: instead of listing all enum values
+ dontwarn="$dontwarn -Wswitch-enum"
+ # Not a problem since we don't use -fstrict-overflow
+ dontwarn="$dontwarn -Wstrict-overflow"
+ # Not a problem since we don't use -funsafe-loop-optimizations
+ dontwarn="$dontwarn -Wunsafe-loop-optimizations"
+ # Things like virAsprintf mean we can't use this
+ dontwarn="$dontwarn -Wformat-nonliteral"
+ # Gnulib's stat-time.h violates this
+ dontwarn="$dontwarn -Waggregate-return"
+ # gcc 4.4.6 complains this is C++ only; gcc 4.7.0 implies this from -Wall
+ dontwarn="$dontwarn -Wenum-compare"
+
+ # gcc 4.2 treats attribute(format) as an implicit attribute(nonnull),
+ # which triggers spurious warnings for our usage
+ AC_CACHE_CHECK([whether the C compiler's -Wformat allows NULL strings],
+ [lv_cv_gcc_wformat_null_works], [
+ save_CFLAGS=$CFLAGS
+ CFLAGS='-Wunknown-pragmas -Werror -Wformat'
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <stddef.h>
+ static __attribute__ ((__format__ (__printf__, 1, 2))) int
+ foo (const char *fmt, ...) { return !fmt; }
+ ]], [[
+ return foo(NULL);
+ ]])],
+ [lv_cv_gcc_wformat_null_works=yes],
+ [lv_cv_gcc_wformat_null_works=no])
+ CFLAGS=$save_CFLAGS])
+
+ # Gnulib uses '#pragma GCC diagnostic push' to silence some
+ # warnings, but older gcc doesn't support this.
+ AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
+ [lv_cv_gcc_pragma_push_works], [
+ save_CFLAGS=$CFLAGS
+ CFLAGS='-Wunknown-pragmas -Werror'
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic pop
+ ]])],
+ [lv_cv_gcc_pragma_push_works=yes],
+ [lv_cv_gcc_pragma_push_works=no])
+ CFLAGS=$save_CFLAGS])
+ if test $lv_cv_gcc_pragma_push_works = no; then
+ dontwarn="$dontwarn -Wmissing-prototypes"
+ dontwarn="$dontwarn -Wmissing-declarations"
+ dontwarn="$dontwarn -Wcast-align"
+ else
+ AC_DEFINE_UNQUOTED([WORKING_PRAGMA_PUSH], 1,
+ [Define to 1 if gcc supports pragma push/pop])
+ fi
+
+ dnl Check whether strchr(s, char variable) causes a bogus compile
+ dnl warning, which is the case with GCC < 4.6 on some glibc
+ AC_CACHE_CHECK([whether the C compiler's -Wlogical-op gives bogus warnings],
+ [lv_cv_gcc_wlogical_op_broken], [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="-O2 -Wlogical-op -Werror"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <string.h>
+ ]], [[
+ const char *haystack;
+ char needle;
+ return strchr(haystack, needle) == haystack;]])],
+ [lv_cv_gcc_wlogical_op_broken=no],
+ [lv_cv_gcc_wlogical_op_broken=yes])
+ CFLAGS="$save_CFLAGS"])
+
+ # We might fundamentally need some of these disabled forever, but
+ # ideally we'd turn many of them on
+ dontwarn="$dontwarn -Wfloat-equal"
+ dontwarn="$dontwarn -Wdeclaration-after-statement"
+ dontwarn="$dontwarn -Wpacked"
dontwarn="$dontwarn -Wunused-macros"
-
-
- # g_clear_object & G_ATOMIC_OP_USE_GCC_BUILTINS causes
- # violations with this. XXX Fix glib ?
- dontwarn="$dontwarn -Wbad-function-cast"
+ dontwarn="$dontwarn -Woverlength-strings"
+ dontwarn="$dontwarn -Wstack-protector"
# Get all possible GCC warnings
gl_MANYWARN_ALL_GCC([maybewarn])
@@ -53,78 +130,105 @@ AC_DEFUN([LIBVIRT_GLIB_COMPILE_WARNINGS],[
# Remove the ones we don't want, blacklisted earlier
gl_MANYWARN_COMPLEMENT([wantwarn], [$maybewarn], [$dontwarn])
- # Check for $CC support of each warning
- for w in $wantwarn; do
- gl_WARN_ADD([$w])
- done
-
# GNULIB uses '-W' (aka -Wextra) which includes a bunch of stuff.
# Unfortunately, this means you can't simply use '-Wsign-compare'
# with gl_MANYWARN_COMPLEMENT
# So we have -W enabled, and then have to explicitly turn off...
- gl_WARN_ADD([-Wno-sign-compare])
-
- # Due to gutils.h bug in g_bit_storage
- gl_WARN_ADD([-Wno-sign-conversion])
- gl_WARN_ADD([-Wno-conversion])
- gl_WARN_ADD([-Wno-unused-parameter])
- # We can't enable this due to horrible spice_usb_device_get_description
- # signature
- gl_WARN_ADD([-Wno-format-nonliteral])
-
-
+ wantwarn="$wantwarn -Wno-sign-compare"
# GNULIB expects this to be part of -Wc++-compat, but we turn
# that one off, so we need to manually enable this again
- gl_WARN_ADD([-Wjump-misses-init])
+ wantwarn="$wantwarn -Wjump-misses-init"
+
+ # GNULIB turns on -Wformat=2 which implies -Wformat-nonliteral,
+ # so we need to manually re-exclude it. Also, older gcc 4.2
+ # added an implied ATTRIBUTE_NONNULL on any parameter marked
+ # ATTRIBUTE_FMT_PRINT, which causes -Wformat failure on our
+ # intentional use of virReportError(code, NULL).
+ wantwarn="$wantwarn -Wno-format-nonliteral"
+ if test $lv_cv_gcc_wformat_null_works = no; then
+ wantwarn="$wantwarn -Wno-format"
+ fi
# This should be < 256 really. Currently we're down to 4096,
# but using 1024 bytes sized buffers (mostly for virStrerror)
# stops us from going down further
- gl_WARN_ADD([-Wframe-larger-than=4096])
-
- # Use improved glibc headers
- AH_VERBATIM([FORTIFY_SOURCE],
- [/* Enable compile-time and run-time bounds-checking, and some warnings,
- without upsetting newer glibc. */
- #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
- # define _FORTIFY_SOURCE 2
- #endif
- ])
+ wantwarn="$wantwarn -Wframe-larger-than=4096"
+ dnl wantwarn="$wantwarn -Wframe-larger-than=256"
# Extra special flags
dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
dnl on Mingw32, but fails when actually used
case $host in
+ aarch64-*-*)
+ dnl "error: -fstack-protector not supported for this target [-Werror]"
+ ;;
*-*-linux*)
- dnl Fedora only uses -fstack-protector, but doesn't seem to
- dnl be great overhead in adding -fstack-protector-all instead
- dnl gl_WARN_ADD([-fstack-protector])
- gl_WARN_ADD([-fstack-protector-all])
- gl_WARN_ADD([--param=ssp-buffer-size=4])
+ dnl Prefer -fstack-protector-strong if it's available.
+ dnl There doesn't seem to be great overhead in adding
+ dnl -fstack-protector-all instead of -fstack-protector.
+ dnl
+ dnl We also don't need ssp-buffer-size with -all or -strong,
+ dnl since functions are protected regardless of buffer size.
+ dnl wantwarn="$wantwarn --param=ssp-buffer-size=4"
+ wantwarn="$wantwarn -fstack-protector-strong"
+ ;;
+ *-*-freebsd*)
+ dnl FreeBSD ships old gcc 4.2.1 which doesn't handle
+ dnl -fstack-protector-all well
+ wantwarn="$wantwarn -fstack-protector"
+
+ wantwarn="$wantwarn -Wno-unused-command-line-argument"
;;
esac
- gl_WARN_ADD([-fexceptions])
- gl_WARN_ADD([-fasynchronous-unwind-tables])
- gl_WARN_ADD([-fdiagnostics-show-option])
- gl_WARN_ADD([-funit-at-a-time])
+ wantwarn="$wantwarn -fexceptions"
+ wantwarn="$wantwarn -fasynchronous-unwind-tables"
# Need -fipa-pure-const in order to make -Wsuggest-attribute=pure
# fire even without -O.
- gl_WARN_ADD([-fipa-pure-const])
-
+ wantwarn="$wantwarn -fipa-pure-const"
# We should eventually enable this, but right now there are at
# least 75 functions triggering warnings.
- gl_WARN_ADD([-Wno-suggest-attribute=pure])
- gl_WARN_ADD([-Wno-suggest-attribute=const])
-
+ wantwarn="$wantwarn -Wno-suggest-attribute=pure"
+ wantwarn="$wantwarn -Wno-suggest-attribute=const"
if test "$set_werror" = "yes"
then
- gl_WARN_ADD([-Werror])
+ wantwarn="$wantwarn -Werror"
fi
- WARN_LDFLAGS=$WARN_CFLAGS
- AC_SUBST([WARN_CFLAGS])
- AC_SUBST([WARN_LDFLAGS])
+ # Check for $CC support of each warning
+ for w in $wantwarn; do
+ gl_WARN_ADD([$w])
+ done
+
+ case $host in
+ *-*-linux*)
+ dnl Fall back to -fstack-protector-all if -strong is not available
+ case $WARN_CFLAGS in
+ *-fstack-protector-strong*)
+ ;;
+ *)
+ gl_WARN_ADD(["-fstack-protector-all"])
+ ;;
+ esac
+ ;;
+ esac
+
+ # Silence certain warnings in gnulib, and use improved glibc headers
+ AC_DEFINE([lint], [1],
+ [Define to 1 if the compiler is checking for lint.])
+ AH_VERBATIM([FORTIFY_SOURCE],
+ [/* Enable compile-time and run-time bounds-checking, and some warnings,
+ without upsetting newer glibc. */
+ #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
+ # define _FORTIFY_SOURCE 2
+ #endif
+ ])
+
+ if test "$gl_cv_warn_c__Wlogical_op" = yes &&
+ test "$lv_cv_gcc_wlogical_op_broken" = yes; then
+ AC_DEFINE_UNQUOTED([BROKEN_GCC_WLOGICALOP], 1,
+ [Define to 1 if gcc -Wlogical-op reports false positives on strchr])
+ fi
])
diff --git a/m4/warnings.m4 b/m4/warnings.m4
index e3d239b..43156f4 100644
--- a/m4/warnings.m4
+++ b/m4/warnings.m4
@@ -1,5 +1,5 @@
# warnings.m4 serial 11
-dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
--
2.0.4
10 years
[libvirt] [PATCH] qemu: add port check for iscsi host when disk type is network
by Shanzhi Yu
For network type disk, host port is not checked when source protocol is
iscsi, so the error is not sure when with invalid port. If pass -1 to port
the error will be
error: Failed to start domain rh6-i
error: An error occurred, but the cause is unknown
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1163553
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
src/qemu/qemu_command.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f674ba9..f806225 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3016,6 +3016,12 @@ qemuBuildNetworkDriveURI(int protocol,
case VIR_STORAGE_NET_PROTOCOL_FTPS:
case VIR_STORAGE_NET_PROTOCOL_TFTP:
case VIR_STORAGE_NET_PROTOCOL_ISCSI:
+ if (STRNEQ_NULLABLE(hosts->port,"3260")) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("expected port for iscsi host should be 3260"));
+ goto cleanup;
+ }
+
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
if (nhosts != 1) {
virReportError(VIR_ERR_INTERNAL_ERROR,
--
1.9.3
10 years
[libvirt] [PATCH v2] nwfilter: fix deadlock caused updating network device and nwfilter
by Pavel Hrdina
Commit 6e5c79a1 tried to fix deadlock between nwfilter{Define,Undefine}
and starting of guest, but this same deadlock is also for
updating/attaching network device to domain.
The deadlock was introduced by removing global QEMU driver lock because
nwfilter was counting on this lock and ensure that all driver locks are
locked inside of nwfilter{Define,Undefine}.
This patch extends usage of virNWFilterReadLockFilterUpdates to prevent
the deadlock for all possible paths in QEMU driver. LXC and UML drivers
still have global lock.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1143780
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_driver.c | 12 ++++++++++++
src/qemu/qemu_migration.c | 3 +++
src/qemu/qemu_process.c | 4 ++++
3 files changed, 19 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 56e8430..716e9a4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5902,6 +5902,8 @@ qemuDomainRestoreFlags(virConnectPtr conn,
VIR_DOMAIN_SAVE_PAUSED, -1);
+ virNWFilterReadLockFilterUpdates();
+
fd = qemuDomainSaveImageOpen(driver, path, &def, &header, &xml,
(flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0,
&wrapperFd, false, false);
@@ -5979,6 +5981,7 @@ qemuDomainRestoreFlags(virConnectPtr conn,
virFileWrapperFdFree(wrapperFd);
if (vm)
virObjectUnlock(vm);
+ virNWFilterUnlockFilterUpdates();
return ret;
}
@@ -7500,6 +7503,8 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
VIR_DOMAIN_AFFECT_CONFIG, -1);
+ virNWFilterReadLockFilterUpdates();
+
cfg = virQEMUDriverGetConfig(driver);
affect = flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG);
@@ -7616,6 +7621,7 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
virObjectUnlock(vm);
virObjectUnref(caps);
virObjectUnref(cfg);
+ virNWFilterUnlockFilterUpdates();
return ret;
}
@@ -7646,6 +7652,8 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
VIR_DOMAIN_AFFECT_CONFIG |
VIR_DOMAIN_DEVICE_MODIFY_FORCE, -1);
+ virNWFilterReadLockFilterUpdates();
+
cfg = virQEMUDriverGetConfig(driver);
affect = flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG);
@@ -7762,6 +7770,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
virObjectUnlock(vm);
virObjectUnref(caps);
virObjectUnref(cfg);
+ virNWFilterUnlockFilterUpdates();
return ret;
}
@@ -14503,6 +14512,8 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
* and use of FORCE can cause multiple transitions.
*/
+ virNWFilterReadLockFilterUpdates();
+
if (!(vm = qemuDomObjFromSnapshot(snapshot)))
return -1;
@@ -14824,6 +14835,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
virObjectUnlock(vm);
virObjectUnref(caps);
virObjectUnref(cfg);
+ virNWFilterUnlockFilterUpdates();
return ret;
}
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index c797206..533bb35 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2525,6 +2525,8 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
if (virTimeMillisNow(&now) < 0)
return -1;
+ virNWFilterReadLockFilterUpdates();
+
if (flags & VIR_MIGRATE_OFFLINE) {
if (flags & (VIR_MIGRATE_NON_SHARED_DISK |
VIR_MIGRATE_NON_SHARED_INC)) {
@@ -2826,6 +2828,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
qemuDomainEventQueue(driver, event);
qemuMigrationCookieFree(mig);
virObjectUnref(caps);
+ virNWFilterUnlockFilterUpdates();
return ret;
stop:
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 24e5f0f..0078a70 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3438,6 +3438,8 @@ qemuProcessReconnect(void *opaque)
VIR_FREE(data);
+ virNWFilterReadLockFilterUpdates();
+
virObjectLock(obj);
cfg = virQEMUDriverGetConfig(driver);
@@ -3589,6 +3591,7 @@ qemuProcessReconnect(void *opaque)
virObjectUnref(conn);
virObjectUnref(cfg);
+ virNWFilterUnlockFilterUpdates();
return;
@@ -3624,6 +3627,7 @@ qemuProcessReconnect(void *opaque)
}
virObjectUnref(conn);
virObjectUnref(cfg);
+ virNWFilterUnlockFilterUpdates();
}
static int
--
2.0.4
10 years
[libvirt] [PATCH] network: Add bandwidth support to ethernet interface
by Anirban Chakraborty
Ethernet interfaces in libvirt currently do not support bandwidth setting.
For example, following xml file for an interface will not apply these
settings to corresponding qdiscs.
<interface type="ethernet">
<mac address="02:36:1d:18:2a:e4"/>
<model type="virtio"/>
<script path=""/>
<target dev="tap361d182a-e4"/>
<bandwidth>
<inbound average="984" peak="1024" burst="64"/>
<outbound average="2000" peak="2048" burst="128"/>
</bandwidth>
</interface>
Signed-off-by: Anirban Chakraborty <abchak(a)juniper.net>
---
src/conf/domain_conf.h | 21 +++++++++++++++++++++
src/lxc/lxc_driver.c | 3 +++
src/lxc/lxc_process.c | 18 +++++++++---------
src/qemu/qemu_command.c | 25 +++++++++++++++++++------
src/qemu/qemu_command.h | 2 ++
src/qemu/qemu_driver.c | 3 +++
src/qemu/qemu_hotplug.c | 12 ++++++++++++
src/qemu/qemu_process.c | 3 +++
src/util/virnetdevmacvlan.c | 10 ----------
src/util/virnetdevmacvlan.h | 1 -
10 files changed, 72 insertions(+), 26 deletions(-)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9908d88..40e85d9 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2848,4 +2848,25 @@ int virDomainObjSetMetadata(virDomainObjPtr vm,
bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
ATTRIBUTE_NONNULL(1);
+static inline bool virNetDevSupportBandwidth(virDomainNetType type)
+{
+ switch (type) {
+ case VIR_DOMAIN_NET_TYPE_BRIDGE:
+ case VIR_DOMAIN_NET_TYPE_NETWORK:
+ case VIR_DOMAIN_NET_TYPE_DIRECT:
+ case VIR_DOMAIN_NET_TYPE_ETHERNET:
+ return true;
+ case VIR_DOMAIN_NET_TYPE_USER:
+ case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
+ case VIR_DOMAIN_NET_TYPE_SERVER:
+ case VIR_DOMAIN_NET_TYPE_CLIENT:
+ case VIR_DOMAIN_NET_TYPE_MCAST:
+ case VIR_DOMAIN_NET_TYPE_INTERNAL:
+ case VIR_DOMAIN_NET_TYPE_HOSTDEV:
+ case VIR_DOMAIN_NET_TYPE_LAST:
+ break;
+ }
+ return false;
+}
+
#endif /* __DOMAIN_CONF_H */
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 979382b..8a21af4 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -72,6 +72,7 @@
#include "viraccessapicheck.h"
#include "viraccessapichecklxc.h"
#include "virhostdev.h"
+#include "qemu/qemu_command.h"
#define VIR_FROM_THIS VIR_FROM_LXC
@@ -4634,6 +4635,8 @@ lxcDomainDetachDeviceNetLive(virDomainObjPtr vm,
detach = vm->def->nets[detachidx];
+ qemuDomainClearNetBandwidth(vm);
+
switch (virDomainNetGetActualType(detach)) {
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_NETWORK:
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index ed30c37..3192011 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -274,11 +274,6 @@ char *virLXCProcessSetupInterfaceBridged(virConnectPtr conn,
if (virNetDevSetOnline(parentVeth, true) < 0)
goto cleanup;
- if (virNetDevBandwidthSet(net->ifname,
- virDomainNetGetActualBandwidth(net),
- false) < 0)
- goto cleanup;
-
if (net->filter &&
virDomainConfNWFilterInstantiate(conn, vm->uuid, net) < 0)
goto cleanup;
@@ -300,6 +295,7 @@ char *virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
virNetDevBandwidthPtr bw;
virNetDevVPortProfilePtr prof;
virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver);
+ const char *linkdev = virDomainNetGetActualDirectDev(net);
/* XXX how todo bandwidth controls ?
* Since the 'net-ifname' is about to be moved to a different
@@ -329,14 +325,13 @@ char *virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
if (virNetDevMacVLanCreateWithVPortProfile(
net->ifname, &net->mac,
- virDomainNetGetActualDirectDev(net),
+ linkdev,
virDomainNetGetActualDirectMode(net),
false, def->uuid,
- virDomainNetGetActualVirtPortProfile(net),
+ prof,
&res_ifname,
VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
- cfg->stateDir,
- virDomainNetGetActualBandwidth(net), 0) < 0)
+ cfg->stateDir, 0) < 0)
goto cleanup;
ret = res_ifname;
@@ -450,6 +445,11 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
goto cleanup;
}
+ /* set network bandwidth */
+ if (virNetDevBandwidthSet(def->nets[i]->ifname,
+ virDomainNetGetActualBandwidth(def->nets[i]), false) < 0)
+ goto cleanup;
+
(*veths)[(*nveths)-1] = veth;
/* Make sure all net definitions will have a name in the container */
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2e5af4f..7922672 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -191,7 +191,6 @@ qemuPhysIfaceConnect(virDomainDefPtr def,
virDomainNetGetActualVirtPortProfile(net),
&res_ifname,
vmop, cfg->stateDir,
- virDomainNetGetActualBandwidth(net),
macvlan_create_flags);
if (rc >= 0) {
virDomainAuditNetDevice(def, net, res_ifname, true);
@@ -371,11 +370,6 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
&net->mac) < 0)
goto cleanup;
- if (virNetDevBandwidthSet(net->ifname,
- virDomainNetGetActualBandwidth(net),
- false) < 0)
- goto cleanup;
-
if (net->filter &&
virDomainConfNWFilterInstantiate(conn, def->uuid, net) < 0) {
goto cleanup;
@@ -7427,6 +7421,13 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
goto cleanup;
}
+ /* Set Bandwidth */
+ if (virNetDevSupportBandwidth(actualType) &&
+ virNetDevBandwidthSet(net->ifname,
+ virDomainNetGetActualBandwidth(net),
+ false) < 0)
+ goto cleanup;
+
if ((actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
actualType == VIR_DOMAIN_NET_TYPE_ETHERNET ||
@@ -12463,3 +12464,15 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr qemuCaps,
virStringFreeList(progenv);
return def;
}
+
+void qemuDomainClearNetBandwidth(virDomainObjPtr vm)
+{
+ size_t i;
+ virDomainNetType type;
+
+ for (i = 0; i < vm->def->nnets; i++) {
+ type = virDomainNetGetActualType(vm->def->nets[i]);
+ if (virNetDevSupportBandwidth(type))
+ virNetDevBandwidthClear(vm->def->nets[i]->ifname);
+ }
+}
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index aa40c9e..7963a91 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -277,4 +277,6 @@ int qemuCheckDiskConfig(virDomainDiskDefPtr disk);
bool
qemuCheckFips(void);
+
+void qemuDomainClearNetBandwidth(virDomainObjPtr vm);
#endif /* __QEMU_COMMAND_H__*/
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2eaf77d..6ef1132 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2196,6 +2196,9 @@ qemuDomainDestroyFlags(virDomainPtr dom,
if (virDomainDestroyFlagsEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
+ /* Clear network bandwidth */
+ qemuDomainClearNetBandwidth(vm);
+
qemuDomainSetFakeReboot(driver, vm, false);
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 33241fb..9eb125f 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -50,6 +50,7 @@
#include "virstring.h"
#include "virtime.h"
#include "storage/storage_driver.h"
+#include "domain_conf.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
@@ -948,6 +949,12 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
goto cleanup;
}
+ /* Set Bandwidth */
+ if (virNetDevSupportBandwidth(actualType) &&
+ virNetDevBandwidthSet(net->ifname,
+ virDomainNetGetActualBandwidth(net), false) < 0)
+ goto cleanup;
+
for (i = 0; i < tapfdSize; i++) {
if (virSecurityManagerSetTapFDLabel(driver->securityManager,
vm->def, tapfd[i]) < 0)
@@ -3536,6 +3543,11 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
goto cleanup;
}
+ if (virNetDevSupportBandwidth(virDomainNetGetActualType(detach)) &&
+ virNetDevBandwidthClear(detach->ifname) < 0)
+ VIR_WARN("cannot clear bandwidth setting for device : %s",
+ detach->ifname);
+
qemuDomainMarkDeviceForRemoval(vm, &detach->info);
qemuDomainObjEnterMonitor(driver, vm);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ef258cf..21448a5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4825,6 +4825,9 @@ void qemuProcessStop(virQEMUDriverPtr driver,
virStrerror(errno, ebuf, sizeof(ebuf)));
}
+ /* Clear network bandwidth */
+ qemuDomainClearNetBandwidth(vm);
+
virDomainConfVMNWFilterTeardown(vm);
if (cfg->macFilter) {
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index c83341c..956a96b 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -811,7 +811,6 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *tgifname,
char **res_ifname,
virNetDevVPortProfileOp vmOp,
char *stateDir,
- virNetDevBandwidthPtr bandwidth,
unsigned int flags)
{
const char *type = (flags & VIR_NETDEV_MACVLAN_CREATE_WITH_TAP) ?
@@ -925,14 +924,6 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *tgifname,
rc = 0;
}
- if (virNetDevBandwidthSet(cr_ifname, bandwidth, false) < 0) {
- if (flags & VIR_NETDEV_MACVLAN_CREATE_WITH_TAP)
- VIR_FORCE_CLOSE(rc); /* sets rc to -1 */
- else
- rc = -1;
- goto disassociate_exit;
- }
-
if (vmOp == VIR_NETDEV_VPORT_PROFILE_OP_CREATE ||
vmOp == VIR_NETDEV_VPORT_PROFILE_OP_RESTORE) {
/* Only directly register upon a create or restore (restarting
@@ -1076,7 +1067,6 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname ATTRIBUTE_UNUSED,
char **res_ifname ATTRIBUTE_UNUSED,
virNetDevVPortProfileOp vmop ATTRIBUTE_UNUSED,
char *stateDir ATTRIBUTE_UNUSED,
- virNetDevBandwidthPtr bandwidth ATTRIBUTE_UNUSED,
unsigned int flags)
{
virCheckFlags(0, -1);
diff --git a/src/util/virnetdevmacvlan.h b/src/util/virnetdevmacvlan.h
index 41aa4e2..f08d32b 100644
--- a/src/util/virnetdevmacvlan.h
+++ b/src/util/virnetdevmacvlan.h
@@ -68,7 +68,6 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname,
char **res_ifname,
virNetDevVPortProfileOp vmop,
char *stateDir,
- virNetDevBandwidthPtr bandwidth,
unsigned int flags)
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(6)
ATTRIBUTE_NONNULL(8) ATTRIBUTE_NONNULL(10) ATTRIBUTE_RETURN_CHECK;
--
1.8.2.3
10 years
[libvirt] [PATCH 0/3] qemu: Improve send-key command using input-send-event
by Martin Kletzander
QEMU added a qmp command input-send-event that is more precise about
what the outcome for the guest is; it can control particular events as
press/release of a key, button, move of a pointer, etc.
This series is still waiting for two patches [1] from Amos Kong to be
applied before it can be used and will not be pushed until that change
is in upstream QEMU.
Martin
[1] https://lists.gnu.org/archive/html/qemu-devel/2014-11/msg01187.html
Martin Kletzander (3):
qemu: Add capability probing for 'imput-send-event' qmp command
util: Add virKeycodeValueIsModifier function
qemu: Improve qemuMonitorJSONSendKey function
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 3 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_driver.c | 4 +-
src/qemu/qemu_monitor.c | 6 +-
src/qemu/qemu_monitor.h | 3 +-
src/qemu/qemu_monitor_json.c | 142 ++++++++++++++++++++++++++++++++++++-------
src/qemu/qemu_monitor_json.h | 3 +-
src/util/virkeycode.c | 21 +++++++
src/util/virkeycode.h | 2 +
tests/qemumonitorjsontest.c | 72 ++++++++++++++++++++--
11 files changed, 226 insertions(+), 32 deletions(-)
--
2.1.3
10 years
[libvirt] [PATCH v2 0/5] Resolve fc_host startup, shutdown issues
by John Ferlan
This series will replace:
http://www.redhat.com/archives/libvir-list/2014-November/msg00197.html
There are two bugs being fixed here and having them reviewed together
makes things easier in the long run as the last 3 patches depended upon
the first 2 being present.
https://bugzilla.redhat.com/show_bug.cgi?id=1160565
Patch 1 is as was in the previous set
Patch 2 is essentially the same, except the single function
checkVhbaSCSIHostParent was split out to generate a
getVhbaSCSIHostParent which gets used later on.
https://bugzilla.redhat.com/show_bug.cgi?id=1160926
Patch 3 fixes an issue which took a bit of gdb time in order
to figure out exactly what was going wrong. Essentially,
the exising createVport code had a path which would find
the "best available" fc_host to use and save the parent on
return so that the deleteVport code would delete the parent.
However, the code used a copy of the adapter not a reference
to the adapter and thus the change was lost leaving the vHBA
on the system.
Patch 4 adds a new function to save the StoragePool XML given a
configFile. This will be used in the next patch because
while having the in memory fchost copy updated does work -
if libvirtd dies in between we're back at square 1 reading
storage pool config files and not knowing whence we started.
Patch 5 adds a new "managed" attribute to the fchost XML. It does this
mainly to let the deleteVport know when it should delete the
self created vport. Prior to this code, the reliance was that
we didn't have a parent provided. However, this causes an issue
where if someone used nodedev-create in order to create a vHBA
and then tried to use that vHBA in a storage pool we would delete
that vHBA when we were done, which may not be expected. Using
the managed attribute at creation time will let libvirt know
what to do in this case.
NOTE: There's still one more issue in the code, but it's a bit trickier
to resolve. A libvirt created vport doesn't seem to want to find the LUN's
on the initial PoolRefresh that occurs during startup. However, if one
does a refresh immediately after starting the pool, the luns show up.
It seems perhaps there's some sort of locking issue that won't allow the
udevEventHandleCallback to 'add' the new device.
John Ferlan (5):
storage: Check for valid fc_host parent at startup
storage: Ensure fc_host parent matches wwnn/wwpn
storage: Don't use a stack copy of the adapter
storage: Introduce virStoragePoolSaveConfig
storage: Introduce 'managed' for the fchost parent
docs/formatstorage.html.in | 28 ++-
docs/schemas/basictypes.rng | 5 +
src/conf/storage_conf.c | 70 ++++--
src/conf/storage_conf.h | 4 +
src/libvirt_private.syms | 1 +
src/storage/storage_backend_scsi.c | 237 ++++++++++++++++++---
.../pool-scsi-type-fc-host-managed.xml | 15 ++
.../pool-scsi-type-fc-host-managed.xml | 18 ++
tests/storagepoolxml2xmltest.c | 1 +
9 files changed, 323 insertions(+), 56 deletions(-)
create mode 100644 tests/storagepoolxml2xmlin/pool-scsi-type-fc-host-managed.xml
create mode 100644 tests/storagepoolxml2xmlout/pool-scsi-type-fc-host-managed.xml
--
1.9.3
10 years