[libvirt] [PATCH v4 1/2] daemon: Fix domain name leak in error path
by Wang King
Domain name duplicated in make_nonnull_domain, but not freed when virTypedParamsSerialize
return negative.
---
daemon/remote.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 1610fea..a8c21fd 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1066,8 +1066,10 @@ remoteRelayDomainEventTunable(virConnectPtr conn,
if (virTypedParamsSerialize(params, nparams,
(virTypedParameterRemotePtr *) &data.params.params_val,
&data.params.params_len,
- VIR_TYPED_PARAM_STRING_OKAY) < 0)
+ VIR_TYPED_PARAM_STRING_OKAY) < 0) {
+ VIR_FREE(data.dom.name);
return -1;
+ }
remoteDispatchObjectEventSend(callback->client, remoteProgram,
REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TUNABLE,
@@ -1206,8 +1208,10 @@ remoteRelayDomainEventJobCompleted(virConnectPtr conn,
if (virTypedParamsSerialize(params, nparams,
(virTypedParameterRemotePtr *) &data.params.params_val,
&data.params.params_len,
- VIR_TYPED_PARAM_STRING_OKAY) < 0)
+ VIR_TYPED_PARAM_STRING_OKAY) < 0) {
+ VIR_FREE(data.dom.name);
return -1;
+ }
remoteDispatchObjectEventSend(callback->client, remoteProgram,
REMOTE_PROC_DOMAIN_EVENT_CALLBACK_JOB_COMPLETED,
--
2.8.3
7 years, 7 months
[libvirt] [PATCH] qemu: fix argument of virDomainNetGetActualDirectMode
by ZhiPeng Lu
it should be a comparison of modes between new and old devices. So
the argument of the second virDomainNetGetActualDirectMode should be
newdev.
Signed-off-by: ZhiPeng Lu <lu.zhipeng(a)zte.com.cn>
---
src/qemu/qemu_hotplug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 120bcdc..eec99af 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3273,7 +3273,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
if (STRNEQ_NULLABLE(virDomainNetGetActualDirectDev(olddev),
virDomainNetGetActualDirectDev(newdev)) ||
- virDomainNetGetActualDirectMode(olddev) != virDomainNetGetActualDirectMode(olddev) ||
+ virDomainNetGetActualDirectMode(olddev) != virDomainNetGetActualDirectMode(newdev) ||
!virNetDevVPortProfileEqual(virDomainNetGetActualVirtPortProfile(olddev),
virDomainNetGetActualVirtPortProfile(newdev)) ||
!virNetDevVlanEqual(virDomainNetGetActualVlan(olddev),
--
1.8.3.1
7 years, 7 months
[libvirt] [PATCH v2] autogen.sh: Improve and generalize
by Andrea Bolognani
The goal is twofold: firstly, we want to extend the script so
that it can deal with more than a single git submodule, and
secondly we'd like to reduce the amount of duplicated code.
Moreover, since we're making heavy changes to the code anyway,
we might as well make sure it follows a somewhat consistent
coding style too.
To reduce code duplication, we introduce a new --dry-run
option, which can be used by third parties to figure out
whether calling autogen.sh is necessary or not: this allows
us to get rid of the reimplementation of part of the logic
in cfg.mk and guarantee they'll never get out of sync.
Other changes include: making dirty submodules checking and
cleaning entirely independent of other operations; removing
the use of 'set -e' and handling errors explicitly instead;
better parsing of command line arguments.
---
Changes from [v1]:
* drop the generic submodule update framework and simply
update all submodules unconditionally, *then* perform
any required gnulib-specific step;
* handle "autogen not required" and "dry run error"
differently in cfg.mk;
* improve comments.
[v1] https://www.redhat.com/archives/libvir-list/2017-April/msg00816.html
autogen.sh | 253 ++++++++++++++++++++++++++++++++++++++++---------------------
cfg.mk | 53 ++++++-------
2 files changed, 193 insertions(+), 113 deletions(-)
diff --git a/autogen.sh b/autogen.sh
index d1c319d..d5d836a 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,117 +1,196 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
-set -e
+die()
+{
+ echo "error: $1" >&2
+ exit 1
+}
-srcdir=`dirname "$0"`
-test -z "$srcdir" && srcdir=.
+starting_point=$(pwd)
-THEDIR=`pwd`
-cd "$srcdir"
+srcdir=$(dirname "$0")
+test "$srcdir" || srcdir=.
-test -f src/libvirt.c || {
- echo "You must run this script in the top-level libvirt directory"
- exit 1
+cd "$srcdir" || {
+ die "Failed to cd into $srcdir"
}
+test -f src/libvirt.c || {
+ die "$0 must live in the top-level libvirt directory"
+}
-EXTRA_ARGS=
+dry_run=
no_git=
-if test "x$1" = "x--no-git"; then
- no_git=" $1"
- shift
- case "$1 $2" in
- --gnulib-srcdir=*) no_git="$no_git $1"; shift ;;
- --gnulib-srcdir\ *) no_git="$no_git $1=$2"; shift; shift;;
- esac
-fi
-if test -z "$NOCONFIGURE" ; then
- if test "x$1" = "x--system"; then
- shift
- prefix=/usr
- libdir=$prefix/lib
- sysconfdir=/etc
- localstatedir=/var
- if [ -d /usr/lib64 ]; then
- libdir=$prefix/lib64
- fi
- EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir"
- echo "Running ./configure with $EXTRA_ARGS $@"
- else
- if test -z "$*" && test ! -f "$THEDIR/config.status"; then
- echo "I am going to run ./configure with no arguments - if you wish"
- echo "to pass any to it, please specify them on the $0 command line."
- fi
- fi
-fi
+gnulib_srcdir=
+extra_args=
+while test "$#" -gt 0; do
+ case "$1" in
+ --dry-run)
+ # This variable will serve both as an indicator of the fact that
+ # a dry run has been requested, and to store the result of the
+ # dry run. It will be ultimately used as return code for the
+ # script: 0 means no action is necessary, 2 means that autogen.sh
+ # needs to be executed, and 1 is reserved for failures
+ dry_run=0
+ shift
+ ;;
+ --no-git)
+ no_git=" $1"
+ shift
+ ;;
+ --gnulib-srcdir=*)
+ gnulib_srcdir=" $1"
+ shift
+ ;;
+ --gnulib-srcdir)
+ gnulib_srcdir=" $1=$2"
+ shift
+ shift
+ ;;
+ --system)
+ prefix=/usr
+ sysconfdir=/etc
+ localstatedir=/var
+ if test -d $prefix/lib64; then
+ libdir=$prefix/lib64
+ else
+ libdir=$prefix/lib
+ fi
+ extra_args="--prefix=$prefix --localstatedir=$localstatedir"
+ extra_args="$extra_args --sysconfdir=$sysconfdir --libdir=$libdir"
+ shift
+ ;;
+ *)
+ # All remaining arguments will be passed to configure verbatim
+ break
+ ;;
+ esac
+done
+no_git="$no_git$gnulib_srcdir"
-# Compute the hash we'll use to determine whether rerunning bootstrap
-# is required. The first is just the SHA1 that selects a gnulib snapshot.
-# The second ensures that whenever we change the set of gnulib modules used
-# by this package, we rerun bootstrap to pull in the matching set of files.
-# The third ensures that whenever we change the set of local gnulib diffs,
-# we rerun bootstrap to pull in those diffs.
-bootstrap_hash()
+gnulib_hash()
{
+ local no_git=$1
+
if test "$no_git"; then
- echo no-git
+ echo "no-git"
return
fi
- git submodule status | sed 's/^[ +-]//;s/ .*//'
+
+ # Compute the hash we'll use to determine whether rerunning bootstrap
+ # is required. The first is just the SHA1 that selects a gnulib snapshot.
+ # The second ensures that whenever we change the set of gnulib modules used
+ # by this package, we rerun bootstrap to pull in the matching set of files.
+ # The third ensures that whenever we change the set of local gnulib diffs,
+ # we rerun bootstrap to pull in those diffs.
+ git submodule status .gnulib | awk '{ print $1 }'
git hash-object bootstrap.conf
- git ls-tree -d HEAD gnulib/local | awk '{print $3}'
+ git ls-tree -d HEAD gnulib/local | awk '{ print $3 }'
}
-# Ensure that whenever we pull in a gnulib update or otherwise change to a
-# different version (i.e., when switching branches), we also rerun ./bootstrap.
-# Also, running 'make rpm' tends to litter the po/ directory, and some people
-# like to run 'git clean -x -f po' to fix it; but only ./bootstrap regenerates
-# the required file po/Makevars.
-# Only run bootstrap from a git checkout, never from a tarball.
+# Only look into git submodules if we're in a git checkout
if test -d .git || test -f .git; then
- curr_status=.git-module-status t=
- if test "$no_git"; then
- t=no-git
- elif test -d .gnulib; then
- t=$(bootstrap_hash; git diff .gnulib)
+
+ # Check for dirty submodules
+ if test -z "$CLEAN_SUBMODULE"; then
+ for path in $(git submodule status | awk '{ print $2 }'); do
+ case "$(git diff "$path")" in
+ *-dirty*)
+ echo "error: $path is dirty, please investigate" >&2
+ echo "set CLEAN_SUBMODULE to discard submodule changes" >&2
+ exit 1
+ ;;
+ esac
+ done
fi
- case $t:${CLEAN_SUBMODULE+set} in
- *:set) ;;
- *-dirty*)
- echo "error: gnulib submodule is dirty, please investigate" 2>&1
- echo "set env-var CLEAN_SUBMODULE to discard gnulib changes" 2>&1
- exit 1 ;;
- esac
- # Keep this test in sync with cfg.mk:_update_required
- if test "$t" = "$(cat $curr_status 2>/dev/null)" \
- && test -f "po/Makevars" && test -f AUTHORS; then
- # good, it's up to date, all we need is autoreconf
- autoreconf -if
+ if test "$CLEAN_SUBMODULE" && test -z "$no_git"; then
+ if test -z "$dry_run"; then
+ echo "Cleaning up submodules..."
+ git submodule foreach 'git clean -dfqx && git reset --hard' || {
+ die "Cleaning up submodules failed"
+ }
+ fi
+ fi
+
+ # Update all submodules. If any of the submodules has not been
+ # initialized yet, it will be initialized now; moreover, any submodule
+ # with uncommitted changes will be returned to the expected state
+ echo "Updating submodules..."
+ git submodule update --init || {
+ die "Updating submodules failed"
+ }
+
+ # The expected hash, eg. the one computed after the last
+ # successful bootstrap run, is stored on disk
+ state_file=.git-module-status
+ expected_hash=$(cat "$state_file" 2>/dev/null)
+ actual_hash=$(gnulib_hash "$no_git")
+
+ if test "$actual_hash" = "$expected_hash" && \
+ test -f po/Makevars && test -f AUTHORS; then
+ # The gnulib hash matches our expectations, and all the files
+ # that can only be generated through bootstrap are present:
+ # we just need to run autoreconf. Unless we're performing a
+ # dry run, of course...
+ if test -z "$dry_run"; then
+ echo "Running autoreconf..."
+ autoreconf -if || {
+ die "autoreconf failed"
+ }
+ fi
else
- if test -z "$no_git" && test ${CLEAN_SUBMODULE+set}; then
- echo cleaning up submodules...
- git submodule foreach 'git clean -dfqx && git reset --hard'
+ # Whenever the gnulib submodule or any of the related bits
+ # has been changed in some way (see gnulib_hash) we need to
+ # run bootstrap again. If we're performing a dry run, we
+ # change the return code instead to signal our caller
+ if test "$dry_run"; then
+ dry_run=2
+ else
+ echo "Running bootstrap..."
+ ./bootstrap$no_git --bootstrap-sync || {
+ die "bootstrap failed"
+ }
+ gnulib_hash >"$state_file"
fi
- echo running bootstrap$no_git...
- ./bootstrap$no_git --bootstrap-sync && bootstrap_hash > $curr_status \
- || { echo "Failed to bootstrap, please investigate."; exit 1; }
fi
fi
-test -n "$NOCONFIGURE" && exit 0
+# When performing a dry run, we can stop here
+test "$dry_run" && exit "$dry_run"
-cd "$THEDIR"
+# If asked not to run configure, we can stop here
+test "$NOCONFIGURE" && exit 0
-if test "x$OBJ_DIR" != x; then
- mkdir -p "$OBJ_DIR"
- cd "$OBJ_DIR"
+cd "$starting_point" || {
+ die "Failed to cd into $starting_point"
+}
+
+if test "$OBJ_DIR"; then
+ mkdir -p "$OBJ_DIR" || {
+ die "Failed to create $OBJ_DIR"
+ }
+ cd "$OBJ_DIR" || {
+ die "Failed to cd into $OBJ_DIR"
+ }
fi
-if test -z "$*" && test -z "$EXTRA_ARGS" && test -f config.status; then
- ./config.status --recheck
+if test -z "$*" && test -z "$extra_args" && test -f config.status; then
+ echo "Running config.status..."
+ ./config.status --recheck || {
+ die "config.status failed"
+ }
else
- $srcdir/configure $EXTRA_ARGS "$@"
-fi && {
- echo
- echo "Now type 'make' to compile libvirt."
-}
+ if test -z "$*" && test -z "$extra_args"; then
+ echo "I am going to run configure with no arguments - if you wish"
+ echo "to pass any to it, please specify them on the $0 command line."
+ else
+ echo "Running configure with $extra_args $@"
+ fi
+ "$srcdir/configure" $extra_args "$@" || {
+ die "configure failed"
+ }
+fi
+
+echo
+echo "Now type 'make' to compile libvirt."
diff --git a/cfg.mk b/cfg.mk
index 09548fe..c04a991 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1026,33 +1026,30 @@ prev_version_file = /dev/null
ifneq ($(_gl-Makefile),)
ifeq (0,$(MAKELEVEL))
- _curr_status = .git-module-status
- # The sed filter accommodates those who check out on a commit from which
- # no tag is reachable. In that case, git submodule status prints a "-"
- # in column 1 and does not print a "git describe"-style string after the
- # submodule name. Contrast these:
- # -b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib
- # b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib (v0.0-2286-gb653eda)
- # $ cat .git-module-status
- # b653eda3ac4864de205419d9f41eec267cb89eeb
- #
- # Keep this logic in sync with autogen.sh.
- _submodule_hash = $(SED) 's/^[ +-]//;s/ .*//'
- _update_required := $(shell \
- cd '$(srcdir)'; \
- test -d .git || { echo 0; exit; }; \
- test -f po/Makevars || { echo 1; exit; }; \
- test -f AUTHORS || { echo 1; exit; }; \
- test "no-git" = "$$(cat $(_curr_status))" && { echo 0; exit; }; \
- actual=$$(git submodule status | $(_submodule_hash); \
- git hash-object bootstrap.conf; \
- git ls-tree -d HEAD gnulib/local | awk '{print $$3}'; \
- git diff .gnulib); \
- stamp="$$($(_submodule_hash) $(_curr_status) 2>/dev/null)"; \
- test "$$stamp" = "$$actual"; echo $$?)
+ _dry_run_result := $(shell \
+ cd '$(srcdir)'; \
+ test -d .git || test -f .git || { echo 0; exit; }; \
+ $(srcdir)/autogen.sh --dry-run >/dev/null 2>&1; \
+ echo $$?; \
+ )
_clean_requested = $(filter %clean,$(MAKECMDGOALS))
- ifeq (1,$(_update_required)$(_clean_requested))
- $(info INFO: gnulib update required; running ./autogen.sh first)
+
+ # A return value of 0 means no action is required
+
+ # A return value of 1 means a genuine error has occurred while
+ # performing the dry run, and it should be reported so it can
+ # be investigated
+ ifeq (1,$(_dry_run_result))
+ $(info INFO: autogen.sh error, running again to show details)
+maint.mk Makefile: _autogen_error
+ endif
+
+ # A return value of 2 means that autogen.sh needs to be executed
+ # in earnest before building, probably because of gnulib updates.
+ # We don't run autogen.sh if the clean target has been invoked,
+ # though, as it would be quite pointless
+ ifeq (2,$(_dry_run_result)$(_clean_requested))
+ $(info INFO: running autogen.sh is required, running it now...)
$(shell touch $(srcdir)/AUTHORS $(srcdir)/ChangeLog)
maint.mk Makefile: _autogen
endif
@@ -1066,6 +1063,10 @@ _autogen:
$(srcdir)/autogen.sh
./config.status
+.PHONY: _autogen_error
+_autogen_error:
+ $(srcdir)/autogen.sh --dry-run
+
# regenerate HACKING as part of the syntax-check
ifneq ($(_gl-Makefile),)
syntax-check: $(top_srcdir)/HACKING spacing-check test-wrap-argv \
--
2.7.4
7 years, 7 months
[libvirt] [PATCH] test: Remove unnecessary unlocks in cleanup paths
by John Ferlan
Commit id '865f479da' altered the logic to use a common test*ObjFindByName
helpers which would lock/unlock the test driver; however, a few cleanup paths
in that cleanup missed removing the Unlock, so remove it now.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/test/test_driver.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 00999b1..2db3f7d 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -3931,7 +3931,6 @@ testInterfaceUndefine(virInterfacePtr iface)
ret = 0;
cleanup:
- testDriverUnlock(privconn);
return ret;
}
@@ -3960,7 +3959,6 @@ testInterfaceCreate(virInterfacePtr iface,
cleanup:
if (privinterface)
virInterfaceObjUnlock(privinterface);
- testDriverUnlock(privconn);
return ret;
}
@@ -3989,7 +3987,6 @@ testInterfaceDestroy(virInterfacePtr iface,
cleanup:
if (privinterface)
virInterfaceObjUnlock(privinterface);
- testDriverUnlock(privconn);
return ret;
}
@@ -4480,7 +4477,6 @@ testStoragePoolUndefine(virStoragePoolPtr pool)
if (privpool)
virStoragePoolObjUnlock(privpool);
testObjectEventQueue(privconn, event);
- testDriverUnlock(privconn);
return ret;
}
@@ -4591,7 +4587,6 @@ testStoragePoolDestroy(virStoragePoolPtr pool)
testObjectEventQueue(privconn, event);
if (privpool)
virStoragePoolObjUnlock(privpool);
- testDriverUnlock(privconn);
return ret;
}
--
2.9.3
7 years, 7 months
[libvirt] [PATCH] util: relax virNetDevSetCoalesce() stub
by Roman Bogorodskiy
Currently, virNetDevSetCoalesce() stub is always returning error. As
it's used by virNetDevTapCreateInBridgePort(), it essentially breaks
bridged networking if coalesce is not supported.
To make it work, relax the stub to trigger error only when its
coalesce argument is not NULL, otherwise report success.
---
src/util/virnetdev.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 131a56a8d..131c4d983 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -3155,8 +3155,11 @@ int virNetDevSetCoalesce(const char *ifname,
}
# else
int virNetDevSetCoalesce(const char *ifname,
- virNetDevCoalescePtr coalesce ATTRIBUTE_UNUSED)
+ virNetDevCoalescePtr coalesce)
{
+ if (!coalesce)
+ return 0;
+
virReportSystemError(ENOSYS,
_("Cannot set coalesce info on interface '%s'"),
ifname);
--
2.11.0
7 years, 7 months
[libvirt] [PATCH] Fix minor typos
by Yuri Chornoivan
Hi,
Attached is a minor fix for the typos in libvirt's git/master.
Best regards,
Yuri
P. S. Sorry for the lame format. My mail provider rejects direct sending
emails from git send.
7 years, 7 months
[libvirt] [PATCH go-xml] Support for filesystem devices
by Ryan Goodfellow
This commit adds filesystem device support. A new family of types
DomainFilesystem* are introduced and plumbed into the DomainDeviceList
struct.
Testing has also been included.
---
domain.go | 40 ++++++++++++++++++++++++++++++++++++++++
domain_test.go | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 95 insertions(+)
diff --git a/domain.go b/domain.go
index 307c71c..cccd9a6 100644
--- a/domain.go
+++ b/domain.go
@@ -81,6 +81,45 @@ type DomainDisk struct {
Target *DomainDiskTarget `xml:"target"`
}
+type DomainFilesystemDriver struct {
+ Type string `xml:"type,attr"`
+ Name string `xml:"name,attr,omitempty"`
+ WRPolicy string `xml:"wrpolicy,attr,omitempty"`
+}
+
+type DomainFilesystemSource struct {
+ Dir string `xml:"dir,attr,omitempty"`
+ File string `xml:"file,attr,omitempty"`
+}
+
+type DomainFilesystemTarget struct {
+ Dir string `xml:"dir,attr"`
+}
+
+type DomainFilesystemReadOnly struct {
+}
+
+type DomainFilesystemSpaceHardLimit struct {
+ Value int `xml:",chardata"`
+ Unit string `xml:"unit,attr,omitempty"`
+}
+
+type DomainFilesystemSpaceSoftLimit struct {
+ Value int `xml:",chardata"`
+ Unit string `xml:"unit,attr,omitempty"`
+}
+
+type DomainFilesystem struct {
+ Type string `xml:"type,attr"`
+ AccessMode string `xml:"accessmode,attr"`
+ Driver *DomainFilesystemDriver `xml:"driver"`
+ Source *DomainFilesystemSource `xml:"source"`
+ Target *DomainFilesystemTarget `xml:"target"`
+ ReadOnly *DomainFilesystemReadOnly `xml:"readonly"`
+ SpaceHardLimit *DomainFilesystemSpaceHardLimit `xml:"space_hard_limit"`
+ SpaceSoftLimit *DomainFilesystemSpaceSoftLimit `xml:"space_soft_limit"`
+}
+
type DomainInterfaceMAC struct {
Address string `xml:"address,attr"`
}
@@ -212,6 +251,7 @@ type DomainVideo struct {
type DomainDeviceList struct {
Controllers []DomainController `xml:"controller"`
Disks []DomainDisk `xml:"disk"`
+ Filesystems []DomainFilesystem `xml:"filesystem"`
Interfaces []DomainInterface `xml:"interface"`
Serials []DomainChardev `xml:"serial"`
Consoles []DomainChardev `xml:"console"`
diff --git a/domain_test.go b/domain_test.go
index e5347ea..06d585c 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -690,6 +690,61 @@ var domainTestData = []struct {
`</domain>`,
},
},
+ {
+ Object: &Domain{
+ Type: "kvm",
+ Name: "test",
+ Devices: &DomainDeviceList{
+ Filesystems: []DomainFilesystem{
+ DomainFilesystem{
+ Type: "mount",
+ AccessMode: "mapped",
+ Driver: &DomainFilesystemDriver{
+ Type: "path",
+ WRPolicy: "immediate",
+ },
+ Source: &DomainFilesystemSource{
+ Dir: "/home/user/test",
+ },
+ Target: &DomainFilesystemTarget{
+ Dir: "user-test-mount",
+ },
+ },
+ DomainFilesystem{
+ Type: "file",
+ AccessMode: "passthrough",
+ Driver: &DomainFilesystemDriver{
+ Name: "loop",
+ Type: "raw",
+ },
+ Source: &DomainFilesystemSource{
+ File: "/home/user/test.img",
+ },
+ Target: &DomainFilesystemTarget{
+ Dir: "user-file-test-mount",
+ },
+ },
+ },
+ },
+ },
+ Expected: []string{
+ `<domain type="kvm">`,
+ ` <name>test</name>`,
+ ` <devices>`,
+ ` <filesystem type="mount" accessmode="mapped">`,
+ ` <driver type="path" wrpolicy="immediate"></driver>`,
+ ` <source dir="/home/user/test"></source>`,
+ ` <target dir="user-test-mount"></target>`,
+ ` </filesystem>`,
+ ` <filesystem type="file" accessmode="passthrough">`,
+ ` <driver type="raw" name="loop"></driver>`,
+ ` <source file="/home/user/test.img"></source>`,
+ ` <target dir="user-file-test-mount"></target>`,
+ ` </filesystem>`,
+ ` </devices>`,
+ `</domain>`,
+ },
+ },
}
func TestDomain(t *testing.T) {
--
2.11.0
7 years, 7 months
[libvirt] [PATCH] [PATCH] rpc: fix keep alive timer segfault
by Yi Wang
ka maybe have been freeed in virObjectUnref, application using
virKeepAliveTimer will segfault when unlock ka. We should keep
ka's refs positive before using it.
Signed-off-by: Yi Wang <wang.yi59(a)zte.com.cn>
---
src/rpc/virkeepalive.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c
index c9faf88..4f666fd 100644
--- a/src/rpc/virkeepalive.c
+++ b/src/rpc/virkeepalive.c
@@ -160,17 +160,17 @@ virKeepAliveTimer(int timer ATTRIBUTE_UNUSED, void *opaque)
bool dead;
void *client;
+ virObjectRef(ka);
virObjectLock(ka);
client = ka->client;
dead = virKeepAliveTimerInternal(ka, &msg);
+ virObjectUnlock(ka);
+
if (!dead && !msg)
goto cleanup;
- virObjectRef(ka);
- virObjectUnlock(ka);
-
if (dead) {
ka->deadCB(client);
} else if (ka->sendCB(client, msg) < 0) {
@@ -178,11 +178,8 @@ virKeepAliveTimer(int timer ATTRIBUTE_UNUSED, void *opaque)
virNetMessageFree(msg);
}
- virObjectLock(ka);
- virObjectUnref(ka);
-
cleanup:
- virObjectUnlock(ka);
+ virObjectUnref(ka);
}
--
1.8.3.1
7 years, 7 months
[libvirt] [PATCH] util: fix virNetDevSetCoalesce fallback on Win32/FreeBSD
by Daniel P. Berrange
The current fallback stub for virNetDevSetCoalesce is inside an
earlier conditional block. This deals with the feature being
missing on older Linux platforms. We need a second fallback stub
though, outside the top level conditional, to ensure builds work
on Win32/FreeBSD platforms too.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
Pushed as a build fix
src/util/virnetdev.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 6ff1b48..27f1637 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -3207,6 +3207,15 @@ virNetDevGetFeatures(const char *ifname ATTRIBUTE_UNUSED,
ifname);
return 0;
}
+
+int virNetDevSetCoalesce(const char *ifname,
+ virNetDevCoalescePtr coalesce ATTRIBUTE_UNUSED)
+{
+ virReportSystemError(ENOSYS,
+ _("Cannot set coalesce info on interface '%s'"),
+ ifname);
+ return -1;
+}
#endif
--
2.9.3
7 years, 7 months