[libvirt] [PATCH] storage: minor fix in luks encrypted volume creation
by Katerina Koukiou
This patch fixes the case when creating a luks encrypted volume
via an xml file without 'secret' element.
libvirtd was receiving SIGSEGV, now proper error is reported for
the missing element. (see bz 1468422)
Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
src/storage/storage_util.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 554fc757ed..18414ddb89 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -1277,6 +1277,13 @@ storageBackendCreateQemuImgSecretPath(virStoragePoolObjPtr pool,
return NULL;
}
+ if (!enc->secrets) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("A single <secret type='passphrase'...> "
+ "element is expected in encryption description"));
+ return NULL;
+ }
+
conn = virGetConnectSecret();
if (!conn)
return NULL;
--
2.15.0
6 years, 4 months
[libvirt] [PATCH v2] travis: switch to using Ubuntu 16.04 and 18.04
by Daniel P. Berrangé
The container images provided by Travis only support Ubuntu 14.04,
however, Travis has ability to run docker, which allows the build
script to use arbitrary OS images. This takes advantage of that to
convert the build over to Ubuntu 16.04 and 18.04
This is using the official Ubuntu provided images and installing
extra build deps required, as we previously did with Travis container
images. With the switch to Docker though, this can be improved, by
building custom Docker images with all the deps pre-installed which
will cut down build time. This can be driven from the package lists
in libvirt-jenkins-ci repo, to remove the duplication. This work
for future improvement though, this just does the minimal conversion
to match what we already do, but with newer distro.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
.travis.yml | 217 +++++++++++++++++++++++++++++-----------------------
1 file changed, 121 insertions(+), 96 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index c71411dcae..1e2f946352 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,5 @@
-sudo: false
-language: c
-cache: ccache
+sudo: required
+language: generic
branches:
except:
@@ -8,17 +7,41 @@ branches:
matrix:
include:
- - compiler: gcc
- dist: trusty
+ - services:
+ - docker
env:
- - PYTHON=$(which python2)
- - DISTCHECK_CONFIGURE_FLAGS="--with-init-script=upstart"
- - compiler: clang
- dist: trusty
- env:
- - PYTHON=$(which python3)
+ - IMAGE_NAME=ubuntu:18.04
+ - PYTHON=python3
- DISTCHECK_CONFIGURE_FLAGS="--with-init-script=systemd"
+ before_script:
+ - docker run
+ --privileged
+ -v $(pwd):/build
+ -w /build
+ -e VIR_TEST_DEBUG="$VIR_TEST_DEBUG"
+ -e PACKAGES="$PACKAGES"
+ -e DISTCHECK_FLAGS="$DISTCHECK_CONFIGURE_FLAGS"
+ $IMAGE_NAME
+ /bin/sh -c "$DOCKER_CMD"
+ - services:
+ - docker
+ env:
+ - IMAGE_NAME=ubuntu:16.04
+ - PYTHON=python2
+ - DISTCHECK_CONFIGURE_FLAGS="--with-init-script=upstart"
+ before_script:
+ - docker pull berrange/test
+ - docker run
+ --privileged
+ -v $(pwd):/build
+ -w /build
+ -e VIR_TEST_DEBUG="$VIR_TEST_DEBUG"
+ -e PACKAGES="$PACKAGES"
+ -e DISTCHECK_FLAGS="$DISTCHECK_CONFIGURE_FLAGS"
+ $IMAGE_NAME
+ /bin/sh -c "$DOCKER_CMD"
- compiler: clang
+ language: c
os: osx
env:
- PATH="/usr/local/opt/gettext/bin:/usr/local/opt/ccache/libexec:/usr/local/opt/rpcgen/bin:$PATH"
@@ -27,80 +50,18 @@ matrix:
- brew update
- brew upgrade
- brew install python ccache rpcgen yajl
+ before_script:
+ - ./autogen.sh --prefix=$(pwd)/install-root
script:
# We can't run make distcheck/syntax-check because they
# fail on macOS, but doing 'install' and 'dist' gives us
# some useful coverage
- make -j3 && make -j3 install && make -j3 dist
+ after_failure:
+ - echo '=== LOG FILE(S) START ==='
+ - find -name test-suite.log | xargs cat
+ - echo '=== LOG FILE(S) END ==='
-addons:
- apt:
- # Please keep this list sorted alphabetically
- packages:
- - augeas-tools
- - autoconf
- - automake
- - autopoint
- - bash-completion
- - ccache
- - dnsmasq-base
- - dwarves
- - ebtables
- - gcc
- - gettext
- - glusterfs-client
- - libacl1-dev
- - libapparmor-dev
- - libattr1-dev
- - libaudit-dev
- - libavahi-client-dev
- - libblkid-dev
- - libc6-dev
- - libcap-ng-dev
- - libc-dev-bin
- - libcurl4-gnutls-dev
- - libdbus-1-dev
- - libdevmapper-dev
- - libfuse-dev
- - libgnutls-dev
- - libnetcf-dev
- - libnl-3-dev
- - libnl-route-3-dev
- - libnuma-dev
- - libopenwsman-dev
- - libparted-dev
- - libpcap-dev
- - libpciaccess-dev
- - librbd-dev
- - libreadline-dev
- - libsanlock-dev
- - libsasl2-dev
- - libselinux1-dev
- - libssh2-1-dev
- - libssh-dev
- - libtirpc-dev
- - libtool
- - libudev-dev
- - libxen-dev
- - libxml2-dev
- - libxml2-utils
- - libyajl-dev
- - lvm2
- - make
-# - nfs-common # broken on trusty since build #807 (2018-01-09)
- - open-iscsi
- - parted
- - patch
- - perl
- - pkgconf
- - policykit-1
- - qemu-utils
- - radvd
- - scrub
- - sheepdog
- - systemtap-sdt-dev
- - xsltproc
- - zfs-fuse
git:
submodules: true
@@ -108,23 +69,87 @@ git:
env:
global:
- VIR_TEST_DEBUG=1
-
-before_script:
- - ./autogen.sh --prefix=$(pwd)/install-root
-
-script:
- - make -j3 && make -j3 syntax-check && make -j3 distcheck DISTCHECK_CONFIGURE_FLAGS=$DISTCHECK_CONFIGURE_FLAGS
-
-after_failure:
- - echo '============================================================================'
- - 'ver=$(sed -n "s/AC_INIT(\[libvirt\], \[\([0-9.]*\)\],.*/\1/p" configure.ac);
- if [ -f $(pwd)/tests/test-suite.log ]; then
- cat $(pwd)/tests/test-suite.log;
- elif [ -f libvirt-$ver/_build/tests/test-suite.log ]; then
- cat libvirt-$ver/_build/tests/test-suite.log;
- else
- echo "=== NO LOG FILE FOUND ===";
- fi'
+ - DOCKER_CMD="
+ apt-get update &&
+ apt-get install -y \$PACKAGES &&
+ ./autogen.sh --prefix=$(pwd)/install-root &&
+ make -j3 &&
+ make -j3 syntax-check &&
+ make -j3 distcheck DISTCHECK_CONFIGURE_FLAGS=\"\$DISTCHECK_FLAGS\" ||
+ (
+ echo '=== LOG FILE(S) START ==='
+ find -name test-suite.log | xargs cat
+ echo '=== LOG FILE(S) END ==='
+ exit 1
+ )
+ "
+ # Please keep this list sorted alphabetically
+ - PACKAGES="
+ augeas-tools
+ autoconf
+ automake
+ autopoint
+ bash-completion
+ ccache
+ dnsmasq-base
+ dwarves
+ ebtables
+ gcc
+ gettext
+ git
+ glusterfs-client
+ libacl1-dev
+ libapparmor-dev
+ libattr1-dev
+ libaudit-dev
+ libavahi-client-dev
+ libblkid-dev
+ libc6-dev
+ libcap-ng-dev
+ libc-dev-bin
+ libdbus-1-dev
+ libdevmapper-dev
+ libfuse-dev
+ libgnutls28-dev
+ libnetcf-dev
+ libnl-3-dev
+ libnl-route-3-dev
+ libnuma-dev
+ libopenwsman-dev
+ libparted-dev
+ libpcap-dev
+ libpciaccess-dev
+ librbd-dev
+ libreadline-dev
+ libsanlock-dev
+ libsasl2-dev
+ libselinux1-dev
+ libssh2-1-dev
+ libssh-dev
+ libtirpc-dev
+ libtool
+ libudev-dev
+ libxen-dev
+ libxml2-dev
+ libxml2-utils
+ libyajl-dev
+ lvm2
+ make
+ nfs-common
+ open-iscsi
+ parted
+ patch
+ perl
+ pkgconf
+ policykit-1
+ qemu-utils
+ radvd
+ scrub
+ sheepdog
+ systemtap-sdt-dev
+ xsltproc
+ zfs-fuse
+ "
notifications:
irc:
--
2.17.0
6 years, 4 months
[libvirt] [Bug] To long backingchain does not work (3 and more...)
by Xen Mann
Hey there!
I'm experiencing a strange behavior with libvirt and backing chains.
Getting higher than the first overlay results in a permission denied to the base image and I can't start any machine.
# Results while attempting to start machine
(after every attemt the whole files from ./houseBackup are restored)
Base.img (ok - Win 10 Installation starting)
FirstFloor.ovl (ok - Win 10 Installation starting)
SecondFloor.ovl (permission denied -> Base.img) => assumed Bug
Roof.ovl (permission denied -> Base.img) => assumed Bug
The bug is described in detail here together with a minimal example.
But maybe I'm still doing something wrong and somebody can give me a heads up =).
https://bugzilla.redhat.com/show_bug.cgi?id=1588373
Thx,
yours Xensemann!
6 years, 4 months
[libvirt] [PATCH] virsh: fix help for detach-disk --print-xml
by Ján Tomko
The help message was copied from attach-interface.
Introduced by commit <431e736>.
https://bugzilla.redhat.com/show_bug.cgi?id=1588295
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
Pushed as trivial.
tools/virsh-domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index b555d746c5..6aa79f11b9 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -12296,7 +12296,7 @@ static const vshCmdOptDef opts_detach_disk[] = {
VIRSH_COMMON_OPT_DOMAIN_CURRENT,
{.name = "print-xml",
.type = VSH_OT_BOOL,
- .help = N_("print XML document rather than attach the interface")
+ .help = N_("print XML document rather than detach the disk")
},
{.name = NULL}
};
--
2.16.1
6 years, 4 months
[libvirt] [PATCH v2] As qemuMonitorJSONIOProcess() will unlock the qemu monitor, there is some extreme situation, eg qemu send message to monitor twice in a short time, where the local viriable 'msg' of qemuMonitorIOProcess() could be a wild point:
by Weilun Zhu
1. qemuMonitorSend() assign mon->msg to parameter 'msg', which is alse a
local variable of its caller qemuMonitorJSONCommandWithFd(), cause
eventloop to send message to monitor, then wait condition.
2. qemu send message to monitor for the first time immediately.
3. qemuMonitorIOProcess() is called, then wake up the qemuMonitorSend()
thread, but the qemuMonitorSend() thread stuck for a while as cpu pressure
or some other reasons,, which means the qemu monitor is still unlocked.
4. qemu send event message to monitor for the second time,
such as RTC_CHANGE event
5. qemuMonitorIOProcess() is called, the local viriable 'msg' is
assigned to mon->msg.
6. qemuMonitorIOProcess() call qemuMonitorJSONIOProcess() to deal with
the qemu event.
7. qemuMonitorJSONIOProcess() unlock the qemu monitor in the macro
'QEMU_MONITOR_CALLBACK', then qemuMonitorSend() thread get the mutex
and free the mon->msg, assign mon->msg to NULL.
so the local viriable 'msg' of qemuMonitorIOProcess() is a wild pointer
now.
AFAIK, it is not harmful to call again virCondBroadcast() while msg is a
wild pointer, but just in case, we fix it in this patch.
---
src/qemu/qemu_monitor.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 43f1d2f816..4a7013367d 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -454,6 +454,14 @@ qemuMonitorIOProcess(qemuMonitorPtr mon)
#if DEBUG_IO
VIR_DEBUG("Process done %d used %d", (int)mon->bufferOffset, len);
#endif
+
+ /* As the monitor mutex was unlocked in qemuMonitorJSONIOProcess()
+ * while dealing with qemu event, mon->msg could be changed,
+ * thus we re-acquire the msg here */
+ msg = NULL;
+ if (mon->msg && mon->msg->txOffset == mon->msg->txLength) {
+ msg = mon->msg;
+
if (msg && msg->finished)
virCondBroadcast(&mon->notify);
return len;
--
2.18.0.rc1
6 years, 4 months
Re: [libvirt] [PATCH] qemu: Introduce VIRTIO_NET_F_STANDBY feature bit to virtio_net
by Samudrala, Sridhar
On 6/4/2018 7:06 PM, Jason Wang wrote:
>
>
> On 2018年06月05日 09:41, Samudrala, Sridhar wrote:
>> Ping on this patch now that the kernel patches are accepted into
>> davem's net-next tree.
>> https://patchwork.ozlabs.org/cover/920005/
>>
>>
>> On 5/7/2018 4:09 PM, Sridhar Samudrala wrote:
>>> This feature bit can be used by hypervisor to indicate virtio_net
>>> device to
>>> act as a standby for another device with the same MAC address.
>>>
>>> I tested this with a small change to the patch to mark the STANDBY
>>> feature 'true'
>>> by default as i am using libvirt to start the VMs.
>>> Is there a way to pass the newly added feature bit 'standby' to qemu
>>> via libvirt
>>> XML file?
>>>
>
> Maybe you can try qemu command line passthrough:
>
> https://libvirt.org/drvqemu.html#qemucommand
It looks like this can be used to pass command line arguments to qemu.
Is it possible to specify a virtio specific attribute via this method?
For ex: to say mrg_rxbuf is off we can add the following line to virtio
section of the domain xml file.
<host mrg_rxbuf='off'/>
I think libvirt needs to be extended to to support the new 'standby' attribute
via this mechanism.
Adding Liane Stump and libvirt to the CC list.
Michael,
Can we start with getting this patch into Qemu and an update to libvirt to
support the 'standby' feature so that this feature can be enabled via
some scripts/orchestration layer for now.
We could improve this solution by enhancing Qemu to do automatic management of the
addition/deletion of the primary device based on feature negotiation as a later patch.
>
> The patch looks good to me. Let's see if Michael have any comment.
>
> Thanks
>
>>> Signed-off-by: Sridhar Samudrala <sridhar.samudrala(a)intel.com>
>>> ---
>>> hw/net/virtio-net.c | 2 ++
>>> include/standard-headers/linux/virtio_net.h | 3 +++
>>> 2 files changed, 5 insertions(+)
>>>
>>> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
>>> index 90502fca7c..38b3140670 100644
>>> --- a/hw/net/virtio-net.c
>>> +++ b/hw/net/virtio-net.c
>>> @@ -2198,6 +2198,8 @@ static Property virtio_net_properties[] = {
>>> true),
>>> DEFINE_PROP_INT32("speed", VirtIONet, net_conf.speed,
>>> SPEED_UNKNOWN),
>>> DEFINE_PROP_STRING("duplex", VirtIONet, net_conf.duplex_str),
>>> + DEFINE_PROP_BIT64("standby", VirtIONet, host_features,
>>> VIRTIO_NET_F_STANDBY,
>>> + false),
>>> DEFINE_PROP_END_OF_LIST(),
>>> };
>>> diff --git a/include/standard-headers/linux/virtio_net.h
>>> b/include/standard-headers/linux/virtio_net.h
>>> index e9f255ea3f..01ec09684c 100644
>>> --- a/include/standard-headers/linux/virtio_net.h
>>> +++ b/include/standard-headers/linux/virtio_net.h
>>> @@ -57,6 +57,9 @@
>>> * Steering */
>>> #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
>>> +#define VIRTIO_NET_F_STANDBY 62 /* Act as standby for
>>> another device
>>> + * with the same MAC.
>>> + */
>>> #define VIRTIO_NET_F_SPEED_DUPLEX 63 /* Device set linkspeed
>>> and duplex */
>>> #ifndef VIRTIO_NET_NO_LEGACY
>>
>
6 years, 4 months
[libvirt] [PATCH v1 00/18] use VIR_AUTOFREE in src/util
by Sukrit Bhatnagar
This series of patches modifies some files in src/util
to use VIR_AUTOFREE for automatic freeing of memory and
get rid of some VIR_FREE macro invocations.
Sukrit Bhatnagar (18):
add macros for implementing automatic cleanup functionality
use VIR_AUTOFREE in src/util/virarptable.c
use VIR_AUTOFREE in src/util/virauth.c
use VIR_AUTOFREE in src/util/virauthconfig.c
use VIR_AUTOFREE in src/util/iohelper.c
use VIR_AUTOFREE in src/util/viraudit.c
use VIR_AUTOFREE in src/util/virbuffer.c
use VIR_AUTOFREE in src/util/vircgroup.c
use VIR_AUTOFREE in src/util/virfcp.c
use VIR_AUTOFREE in src/util/virdnsmasq.c
use VIR_AUTOFREE in src/util/vireventpoll.c
use VIR_AUTOFREE in src/util/virdbus.c
use VIR_AUTOFREE in src/util/virfdstream.c
use VIR_AUTOFREE in src/util/virfile.c
use VIR_AUTOFREE in src/util/virconf.c
use VIR_AUTOFREE in src/util/virfilecache.c
use VIR_AUTOFREE in src/util/virfirewall.c
use VIR_AUTOFREE in src/util/virhook.c
src/util/iohelper.c | 4 +-
src/util/viralloc.h | 69 +++++++
src/util/virarptable.c | 9 +-
src/util/viraudit.c | 3 +-
src/util/virauth.c | 60 ++----
src/util/virauthconfig.c | 34 ++-
src/util/virbuffer.c | 33 ++-
src/util/vircgroup.c | 526 ++++++++++++++++-------------------------------
src/util/virconf.c | 42 ++--
src/util/virdbus.c | 28 +--
src/util/virdnsmasq.c | 116 ++++-------
src/util/vireventpoll.c | 7 +-
src/util/virfcp.c | 20 +-
src/util/virfdstream.c | 3 +-
src/util/virfile.c | 303 +++++++++------------------
src/util/virfilecache.c | 35 +---
src/util/virfirewall.c | 13 +-
src/util/virhook.c | 16 +-
18 files changed, 487 insertions(+), 834 deletions(-)
--
1.8.3.1
6 years, 4 months
[libvirt] [PATCH 0/2] cmdDomblkinfo: introduce --all to show all
by Chen Hanxiao
This series introduce --all to cmdDomblkinfo to show
all block devices info in one cmd.
Likes a combination of domblklist and domblkinfo.
Chen Hanxiao (2):
cmdDomblkinfo: introduce --all to show all block devices info
news: add cmdDomblkinfo --all option
docs/news.xml | 8 ++++
tools/virsh-domain-monitor.c | 82 +++++++++++++++++++++++++++---------
tools/virsh.pod | 5 ++-
3 files changed, 75 insertions(+), 20 deletions(-)
--
2.17.0
6 years, 4 months
[libvirt] [perl PATCH] Blacklist virGetLastError{Code,Domain}
by Daniel P. Berrangé
These methods will not be exposed to apps, since we auto raise
all errors.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
t/030-api-coverage.t | 2 ++
1 file changed, 2 insertions(+)
Pushed as a trivial build fix
diff --git a/t/030-api-coverage.t b/t/030-api-coverage.t
index 39d6146..15d4a77 100644
--- a/t/030-api-coverage.t
+++ b/t/030-api-coverage.t
@@ -69,6 +69,8 @@ virFreeError
virResetLastError
virSaveLastError
virGetLastErrorMessage
+virGetLastErrorCode
+virGetLastErrorDomain
virConnectAuthCallbackPtr
virConnectOpen
--
2.17.0
6 years, 4 months
[libvirt] [go PATCH] Blacklist virGetLastError{Code,Domain}
by Daniel P. Berrangé
These methods will not be exposed to apps, since we always return
all errors.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
api_test.go | 2 ++
1 file changed, 2 insertions(+)
Pushed as a trivial build fix
diff --git a/api_test.go b/api_test.go
index 27f77dd..53632df 100644
--- a/api_test.go
+++ b/api_test.go
@@ -69,6 +69,8 @@ var (
"virCopyLastError",
"virFreeError",
"virGetLastErrorMessage",
+ "virGetLastErrorCode",
+ "virGetLastErrorDomain",
"virResetLastError",
"virSaveLastError",
"virDefaultErrorFunc",
--
2.17.0
6 years, 4 months