[libvirt] [PATCH] ci: Fetch list of available container images dynamically
by Andrea Bolognani
Any static list of images is destined to become outdated eventually,
so let's start generating it dynamically instead.
Unfortunately there doesn't seem to be a straightforward way to get
Podman/Docker to list all repositories under quay.io/libvirt, so we
have to resort to searching and filtering manually; and since the
two tools behave slightly differently in that regard, it's more
sane to have the logic in a separate shell script than it would be
to keep it inline in the Makefile with all the annoying escaping
that would entail.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
ci/Makefile | 37 +++++++++++++------------------------
ci/list-images.sh | 26 ++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 24 deletions(-)
create mode 100644 ci/list-images.sh
diff --git a/ci/Makefile b/ci/Makefile
index 27c1049b38..acb655941c 100644
--- a/ci/Makefile
+++ b/ci/Makefile
@@ -238,6 +238,17 @@ ci-build@%:
ci-check@%:
$(MAKE) -C $(CI_ROOTDIR) ci-build@$* CI_MAKE_ARGS="check"
+ci-list-images:
+ @echo
+ @echo "Available x86 container images:"
+ @echo
+ @sh list-images.sh "$(CI_ENGINE)" "$(CI_IMAGE_PREFIX)" | grep -v cross
+ @echo
+ @echo "Available cross-compiler container images:"
+ @echo
+ @sh list-images.sh "$(CI_ENGINE)" "$(CI_IMAGE_PREFIX)" | grep cross
+ @echo
+
ci-help:
@echo "Build libvirt inside containers used for CI"
@echo
@@ -246,30 +257,8 @@ ci-help:
@echo " ci-build@\$$IMAGE - run a default 'make'"
@echo " ci-check@\$$IMAGE - run a 'make check'"
@echo " ci-shell@\$$IMAGE - run an interactive shell"
- @echo
- @echo "Available x86 container images:"
- @echo
- @echo " centos-7"
- @echo " debian-9"
- @echo " debian-10"
- @echo " debian-sid"
- @echo " fedora-29"
- @echo " fedora-30"
- @echo " fedora-rawhide"
- @echo " ubuntu-16"
- @echo " ubuntu-18"
- @echo
- @echo "Available cross-compiler container images:"
- @echo
- @echo " debian-{9,10,sid}-cross-aarch64"
- @echo " debian-{9,10,sid}-cross-armv6l"
- @echo " debian-{9,10,sid}-cross-armv7l"
- @echo " debian-{10,sid}-cross-i686"
- @echo " debian-{9,10,sid}-cross-mips64el"
- @echo " debian-{9,10,sid}-cross-mips"
- @echo " debian-{9,10,sid}-cross-mipsel"
- @echo " debian-{9,10,sid}-cross-ppc64le"
- @echo " debian-{9,10,sid}-cross-s390x"
+ @echo " ci-list-images - list available images"
+ @echo " ci-help - show this help message"
@echo
@echo "Available make variables:"
@echo
diff --git a/ci/list-images.sh b/ci/list-images.sh
new file mode 100644
index 0000000000..35efdb6982
--- /dev/null
+++ b/ci/list-images.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+engine="$1"
+prefix="$2"
+
+do_podman() {
+ # Podman freaks out if the search term ends with a dash, which ours
+ # by default does, so let's strip it. The repository name is the
+ # second field in the output, and it already starts with the registry
+ podman search --limit 100 "${prefix%-}" | while read _ repo _; do
+ echo "$repo"
+ done
+}
+
+do_docker() {
+ # Docker doesn't include the registry name in the output, so we have
+ # to add it. The repository name is the first field in the output
+ registry="${prefix%%/*}"
+ docker search --limit 100 "$prefix" | while read repo _; do
+ echo "$registry/$repo"
+ done
+}
+
+"do_$engine" | grep "^$prefix" | sed "s,^$prefix,,g" | while read repo; do
+ echo " $repo"
+done | sort -u
--
2.23.0
4 years, 11 months
[libvirt] [PATCH 00/11] qemu: backup: Fixes and improvements
by Peter Krempa
I've got a report of pull-mode backup not working properly. While
investigating I've found out few other problems and one regression
caused by a recent patch. All of those are fixed below.
Additionally the last 3 patches are RFC and were created based on the
discussion on qemu-block and I don't really intend to push them right
away. At least until the discussion there is over:
https://lists.gnu.org/archive/html/qemu-block/2019-12/msg00416.html
Peter Krempa (11):
qemu: block: Use proper asyncJob when waiting for completion of
blockdev-create
qemu: Reset the node-name allocator in qemuDomainObjPrivateDataClear
qemu: backup: Configure backup store image with backing file
qemu: backup: Move deletion of backup images to job termination
qemu: blockjob: Remove infrastructure for remembering to delete image
qemu: backup: Properly propagate async job type when cancelling the
job
qemu: process: Terminate backup job on VM destroy
schemas: backup: Remove pointless <choice> for 'name' of backup disk
RFC:
conf: backup: Allow configuration of names exported via NBD
qemu: backup: Implement support for backup disk export name
configuration
qemu: backup: Implement support for backup disk bitmap name
configuration
docs/formatbackup.html.in | 9 +++
docs/schemas/domainbackup.rng | 16 ++--
src/conf/backup_conf.c | 11 +++
src/conf/backup_conf.h | 2 +
src/qemu/qemu_backup.c | 77 +++++++++++++------
src/qemu/qemu_backup.h | 10 ++-
src/qemu/qemu_block.c | 4 +-
src/qemu/qemu_blockjob.c | 20 +----
src/qemu/qemu_blockjob.h | 2 -
src/qemu/qemu_domain.c | 10 +--
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_process.c | 8 +-
.../backup-pull-seclabel.xml | 2 +-
.../backup-pull-seclabel.xml | 2 +-
.../qemustatusxml2xmldata/backup-pull-in.xml | 1 -
15 files changed, 110 insertions(+), 66 deletions(-)
--
2.23.0
4 years, 11 months
[libvirt] [PULL 0/3] Block patches
by Stefan Hajnoczi
The following changes since commit aceeaa69d28e6f08a24395d0aa6915b687d0a681:
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-12-17' into staging (2019-12-17 15:55:20 +0000)
are available in the Git repository at:
https://github.com/stefanha/qemu.git tags/block-pull-request
for you to fetch changes up to 725fe5d10dbd4259b1853b7d253cef83a3c0d22a:
virtio-blk: fix out-of-bounds access to bitmap in notify_guest_bh (2019-12-19 16:20:25 +0000)
----------------------------------------------------------------
Pull request
----------------------------------------------------------------
Li Hangjing (1):
virtio-blk: fix out-of-bounds access to bitmap in notify_guest_bh
Stefan Hajnoczi (2):
virtio-blk: deprecate SCSI passthrough
docs: fix rst syntax errors in unbuilt docs
docs/arm-cpu-features.rst | 6 +++---
docs/virtio-net-failover.rst | 4 ++--
docs/virtio-pmem.rst | 19 ++++++++++---------
hw/block/dataplane/virtio-blk.c | 2 +-
qemu-deprecated.texi | 11 +++++++++++
5 files changed, 27 insertions(+), 15 deletions(-)
--
2.23.0
4 years, 11 months
[libvirt] [PATCH] qemu: Warn of restore with managed save being risky
by Michael Weiser
Internal snapshots of a non-running domain do not carry any memory state
and restoring such a snapshot will not replace existing saved memory
state. This allows a scenario, where a user first suspends a domain into
managedsave, restores a non-running snapshot and then resumes the domain
from managedsave. After that, the guest system will run with its
previous memory state atop a different disk state. The most obvious
possible fallout from this is extensive file system corruption. Swap
content and RAID bitmaps might also be off.
This has been discussed[1] and fixed[2] from the end-user perspective for
virt-manager.
This patch marks the restore operation as risky at the libvirt level,
requiring the user to remove the saved memory state first or force the
operation.
[1] https://www.redhat.com/archives/virt-tools-list/2019-November/msg00011.html
[2] https://www.redhat.com/archives/virt-tools-list/2019-December/msg00049.html
Signed-off-by: Michael Weiser <michael.weiser(a)gmx.de>
Cc: Cole Robinson <crobinso(a)redhat.com>
---
src/qemu/qemu_driver.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ec8faf384c..dcd103d3bb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16652,6 +16652,15 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
_("must respawn qemu to start inactive snapshot"));
goto endjob;
}
+ if (vm->hasManagedSave &&
+ !(snapdef->state == VIR_DOMAIN_SNAPSHOT_RUNNING ||
+ snapdef->state == VIR_DOMAIN_SNAPSHOT_PAUSED)) {
+ virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, "%s",
+ _("revert to snapshot while there is a managed "
+ "saved state will cause corruption when run, "
+ "remove saved state first"));
+ goto endjob;
+ }
}
if (snap->def->dom) {
--
2.24.1
4 years, 11 months
[libvirt] [PATCH RFC] update cacrl without restarting libvirtd via virt-admin
by Zhangbo (Oscar)
This is an RFC request for supporting virt-admin to update cacrl without restarting libvirtd.
When a client wants to establish a TLS connection with libvirtd, a CRL file is used by libvirtd to verify the client's certificate. Right now, if the CRL file is changed, you must restart libvirtd to make it take effect. The restart behavior of libvirtd will cause clients connecting with libvirtd to fail.
In a server cluster, the CRL file may be updated quite frequently due to the large amount of certificates. If the new CRL does not take effect in time, there are security risks. So you may need to restart libvirtd frequently to make the CRL take effect in time. However, frequent restarts will affect the reliability of cluster virtual machine management(such as openstack) services.
This RFC patch adds a virt-admin command to update the server's CRL *online*.
This patch is not elegant enough, if this feature makes sense, I'd do more improvements.
---
include/libvirt/libvirt-admin.h | 4 ++
src/admin/admin_protocol.x | 13 +++++-
src/admin/admin_server.c | 13 ++++++
src/admin/admin_server.h | 4 ++
src/admin/libvirt-admin.c | 33 ++++++++++++++++
src/admin/libvirt_admin_private.syms | 1 +
src/admin/libvirt_admin_public.syms | 1 +
src/rpc/virnetserver.c | 58 +++++++++++++++++++++++++++
src/rpc/virnetserver.h | 3 ++
src/rpc/virnettlscontext.c | 33 ++++++++++++++++
src/rpc/virnettlscontext.h | 3 ++
tools/virt-admin.c | 59 ++++++++++++++++++++++++++++
12 files changed, 224 insertions(+), 1 deletion(-)
diff --git a/include/libvirt/libvirt-admin.h b/include/libvirt/libvirt-admin.h
index abf2792926..2df43db567 100644
--- a/include/libvirt/libvirt-admin.h
+++ b/include/libvirt/libvirt-admin.h
@@ -402,6 +402,10 @@ int virAdmServerSetClientLimits(virAdmServerPtr srv,
int nparams,
unsigned int flags);
+int virAdmServerUpdateTlsFile(virAdmServerPtr srv,
+ unsigned int filetype,
+ unsigned int flags);
+
int virAdmConnectGetLoggingOutputs(virAdmConnectPtr conn,
char **outputs,
unsigned int flags);
diff --git a/src/admin/admin_protocol.x b/src/admin/admin_protocol.x
index 42e215d23a..c74c0d777b 100644
--- a/src/admin/admin_protocol.x
+++ b/src/admin/admin_protocol.x
@@ -181,6 +181,12 @@ struct admin_server_set_client_limits_args {
unsigned int flags;
};
+struct admin_server_update_tls_file_args {
+ admin_nonnull_server srv;
+ unsigned int filetype;
+ unsigned int flags;
+};
+
struct admin_connect_get_logging_outputs_args {
unsigned int flags;
};
@@ -314,5 +320,10 @@ enum admin_procedure {
/**
* @generate: both
*/
- ADMIN_PROC_CONNECT_SET_LOGGING_FILTERS = 17
+ ADMIN_PROC_CONNECT_SET_LOGGING_FILTERS = 17,
+
+ /**
+ * @generate: both
+ */
+ ADMIN_PROC_SERVER_UPDATE_TLS_FILE = 18
};
diff --git a/src/admin/admin_server.c b/src/admin/admin_server.c
index ba87f701c3..2f695eea4f 100644
--- a/src/admin/admin_server.c
+++ b/src/admin/admin_server.c
@@ -367,3 +367,16 @@ adminServerSetClientLimits(virNetServerPtr srv,
return 0;
}
+
+int
+adminServerUpdateTlsFile(virNetServerPtr srv,
+ unsigned int filetype,
+ unsigned int flags)
+{
+ virCheckFlags(0, -1);
+
+ if (virNetServerUpdateTlsFile(srv, filetype) < 0)
+ return -1;
+
+ return 0;
+}
diff --git a/src/admin/admin_server.h b/src/admin/admin_server.h
index 1d5cbec55f..748235811a 100644
--- a/src/admin/admin_server.h
+++ b/src/admin/admin_server.h
@@ -67,3 +67,7 @@ int adminServerSetClientLimits(virNetServerPtr srv,
virTypedParameterPtr params,
int nparams,
unsigned int flags);
+
+int adminServerUpdateTlsFile(virNetServerPtr srv,
+ unsigned int filetype,
+ unsigned int flags);
diff --git a/src/admin/libvirt-admin.c b/src/admin/libvirt-admin.c
index 4099a54854..13c8db016d 100644
--- a/src/admin/libvirt-admin.c
+++ b/src/admin/libvirt-admin.c
@@ -1082,6 +1082,39 @@ virAdmServerSetClientLimits(virAdmServerPtr srv,
return ret;
}
+/**
+ * virAdmServerUpdateTlsFile:
+ * @srv: a valid server object reference
+ * @filetype: TLS file type, such as crl, cert, key
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * update TLS Context in TLS service.
+ *
+ * Returns 0 if the TLS files have been updated successfully or -1 in case of an
+ * error.
+ */
+int
+virAdmServerUpdateTlsFile(virAdmServerPtr srv,
+ unsigned int filetype,
+ unsigned int flags)
+{
+ int ret = -1;
+
+ VIR_DEBUG("srv=%p, filetype=%u flags=%x", srv, filetype, flags);
+ virResetLastError();
+
+ virCheckAdmServerGoto(srv, error);
+
+ /* rpc call to update tls file */
+ if ((ret = remoteAdminServerUpdateTlsFile(srv, filetype, flags)) < 0)
+ goto error;
+
+ return ret;
+ error:
+ virDispatchError(NULL);
+ return ret;
+}
+
/**
* virAdmConnectGetLoggingOutputs:
* @conn: pointer to an active admin connection
diff --git a/src/admin/libvirt_admin_private.syms b/src/admin/libvirt_admin_private.syms
index 9526412de8..d563757482 100644
--- a/src/admin/libvirt_admin_private.syms
+++ b/src/admin/libvirt_admin_private.syms
@@ -31,6 +31,7 @@ xdr_admin_server_lookup_client_args;
xdr_admin_server_lookup_client_ret;
xdr_admin_server_set_client_limits_args;
xdr_admin_server_set_threadpool_parameters_args;
+xdr_admin_server_update_tls_file_args;
# datatypes.h
virAdmClientClass;
diff --git a/src/admin/libvirt_admin_public.syms b/src/admin/libvirt_admin_public.syms
index 9a3f843780..97b223bfba 100644
--- a/src/admin/libvirt_admin_public.syms
+++ b/src/admin/libvirt_admin_public.syms
@@ -38,6 +38,7 @@ LIBVIRT_ADMIN_2.0.0 {
virAdmClientClose;
virAdmServerGetClientLimits;
virAdmServerSetClientLimits;
+ virAdmServerUpdateTlsFile;
};
LIBVIRT_ADMIN_3.0.0 {
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 4122636805..fc18b2a224 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -1209,3 +1209,61 @@ virNetServerSetClientLimits(virNetServerPtr srv,
virObjectUnlock(srv);
return ret;
}
+
+int
+virNetServerUpdateTlsFile(virNetServerPtr srv,
+ unsigned int filetype)
+{
+ int ret = -1;
+#if WITH_GNUTLS
+ size_t i;
+ int cnt = 0;
+ virNetTLSContextPtr ctxt = NULL;
+ virNetServerServicePtr svc = NULL;
+
+ if (filetype != TYPE_CACRL_LIBVIRT) {
+ virReportError(VIR_ERR_SYSTEM_ERROR,
+ _("Don't support CRL filetype: %d"),
+ filetype);
+ return ret;
+ }
+
+ virObjectLock(srv);
+
+ /* find svcTLS from srv */
+ for (i = 0; i < srv->nservices; i++) {
+ svc = srv->services[i];
+ /* find tls from svc */
+ ctxt = virNetServerServiceGetTLSContext(svc);
+ if (ctxt == NULL)
+ continue;
+
+ ret = virNetTLSContextUpdateCRL(ctxt);
+ if (ret < 0) {
+ VIR_ERROR(_("update tls file fail, "
+ "filetype: %d, svcID: %zu"), filetype, i);
+ ret = -1;
+ goto cleanup;
+ }
+ VIR_INFO("update success, filetype: %d, svcID: %zu", filetype, i);
+ cnt++;
+ }
+
+ if (cnt == 0) {
+ virReportError(VIR_ERR_SYSTEM_ERROR,
+ _("no tls server found, don't need update %d"),
+ filetype);
+ } else {
+ VIR_INFO("update tls file complete, filetype: %d",
+ filetype);
+ }
+
+ cleanup:
+ virObjectUnlock(srv);
+#else
+ virReportError(VIR_ERR_SYSTEM_ERROR,
+ _("Don't support GNUTLS: %d"),
+ filetype);
+#endif
+ return ret;
+}
diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h
index 260c99b22d..d0138d250f 100644
--- a/src/rpc/virnetserver.h
+++ b/src/rpc/virnetserver.h
@@ -133,3 +133,6 @@ size_t virNetServerGetCurrentUnauthClients(virNetServerPtr srv);
int virNetServerSetClientLimits(virNetServerPtr srv,
long long int maxClients,
long long int maxClientsUnauth);
+
+int virNetServerUpdateTlsFile(virNetServerPtr srv,
+ unsigned int filetype);
diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
index 08944f6771..1cc3cb8620 100644
--- a/src/rpc/virnettlscontext.c
+++ b/src/rpc/virnettlscontext.c
@@ -1106,6 +1106,39 @@ int virNetTLSContextCheckCertificate(virNetTLSContextPtr ctxt,
return ret;
}
+int virNetTLSContextUpdateCRL(virNetTLSContextPtr ctxt)
+{
+ int ret = -1;
+ char *cacrl = NULL;
+
+ if (VIR_STRDUP(cacrl, LIBVIRT_CACRL) < 0)
+ return -1;
+
+ if (!virFileExists(cacrl)) {
+ virReportSystemError(errno, _("%s not exist"), cacrl);
+ goto cleanup;
+ }
+
+ virObjectLock(ctxt);
+
+ ret = gnutls_certificate_set_x509_crl_file(ctxt->x509cred,
+ cacrl,
+ GNUTLS_X509_FMT_PEM);
+ if (ret < 0) {
+ virReportError(VIR_ERR_SYSTEM_ERROR,
+ _("Unable to update x509 CRL %s: %s"),
+ cacrl, gnutls_strerror(ret));
+ } else {
+ VIR_INFO("Load %d CRL from %s", ret, cacrl);
+ ret = 0;
+ }
+
+ virObjectUnlock(ctxt);
+ cleanup:
+ VIR_FREE(cacrl);
+ return ret;
+}
+
void virNetTLSContextDispose(void *obj)
{
virNetTLSContextPtr ctxt = obj;
diff --git a/src/rpc/virnettlscontext.h b/src/rpc/virnettlscontext.h
index f3273bc26a..b823ab2c3f 100644
--- a/src/rpc/virnettlscontext.h
+++ b/src/rpc/virnettlscontext.h
@@ -23,6 +23,8 @@
#include "internal.h"
#include "virobject.h"
+#define TYPE_CACRL_LIBVIRT 13
+
typedef struct _virNetTLSContext virNetTLSContext;
typedef virNetTLSContext *virNetTLSContextPtr;
@@ -65,6 +67,7 @@ virNetTLSContextPtr virNetTLSContextNewClient(const char *cacert,
int virNetTLSContextCheckCertificate(virNetTLSContextPtr ctxt,
virNetTLSSessionPtr sess);
+int virNetTLSContextUpdateCRL(virNetTLSContextPtr ctxt);
typedef ssize_t (*virNetTLSSessionWriteFunc)(const char *buf, size_t len,
void *opaque);
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index 30106d1971..25971dbf27 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -50,6 +50,8 @@
/* we don't need precision to milliseconds in this module */
#define VIRT_ADMIN_TIME_BUFLEN VIR_TIME_STRING_BUFLEN - 3
+#define LIBVIRT_CACRL_TYPE 13
+
static char *progname;
static const vshCmdGrp cmdGroups[];
@@ -1103,6 +1105,57 @@ cmdDaemonLogOutputs(vshControl *ctl, const vshCmd *cmd)
return true;
}
+/* ------------------------
+ * Command update-crl-file
+ * ------------------------
+ */
+static const vshCmdInfo info_srv_update_tls_file[] = {
+ {.name = "help",
+ .data = N_("notify tls file type, current only support libvirt cacrl(13)")
+ },
+ {.name = "desc",
+ .data = N_("notify libvirtd TLS server hot update CACRL.")
+ },
+ {.name = NULL}
+};
+
+static const vshCmdOptDef opts_srv_update_tls_file[] = {
+ {.name = "server",
+ .type = VSH_OT_DATA,
+ .flags = VSH_OFLAG_REQ,
+ .help = N_("Server to reload the CRL file."),
+ },
+ {.name = NULL}
+};
+
+static bool
+cmdSrvUpdateTlsFile(vshControl *ctl, const vshCmd *cmd)
+{
+ bool ret = false;
+ const char *srvname = NULL;
+ unsigned int filetype = LIBVIRT_CACRL_TYPE;
+
+ virAdmServerPtr srv = NULL;
+ vshAdmControlPtr priv = ctl->privData;
+
+ if (vshCommandOptStringReq(ctl, cmd, "server", &srvname) < 0)
+ return false;
+
+ if (!(srv = virAdmConnectLookupServer(priv->conn, srvname, 0)))
+ goto cleanup;
+
+ if (virAdmServerUpdateTlsFile(srv, filetype, 0) < 0) {
+ vshError(ctl, "%s", _("Unable to update server's tls file."));
+ goto cleanup;
+ }
+
+ ret = true;
+
+ cleanup:
+ virAdmServerFree(srv);
+ return ret;
+}
+
static void *
vshAdmConnectionHandler(vshControl *ctl)
{
@@ -1486,6 +1539,12 @@ static const vshCmdDef managementCmds[] = {
.info = info_daemon_log_outputs,
.flags = 0
},
+ {.name = "update-crl-file",
+ .handler = cmdSrvUpdateTlsFile,
+ .opts = opts_srv_update_tls_file,
+ .info = info_srv_update_tls_file,
+ .flags = 0
+ },
{.name = NULL}
};
4 years, 11 months
[libvirt] [tck PATCH 0/2] Enable the storage encryption test
by Erik Skultety
The test was present, but at the time the test was added libvirt (apparently)
didn't fully support LUKS encryption with disks.
Erik Skultety (2):
scripts: qemu: Fix the disk encryption test description
scripts: qemu: Enable disk encryption test
scripts/qemu/100-disk-encryption.t | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
--
2.23.0
4 years, 11 months
[libvirt] [PATCH] storage: Fix volStorageBackendRBDRefreshVolInfo
by Yi Li
Fix the return value status comparison checking for call to
volStorageBackendRBDRefreshVolInfo introduced by commit id f46d137e.
we only should fail when the return is < 0. -ENOENT, -ETIMEDOUT will
ignore according commit id f46d137e.
Signed-off-by: Yi Li <yili(a)winhong.com>
---
src/storage/storage_backend_rbd.c | 40 ++++++++++++++++++++++++---------------
1 file changed, 25 insertions(+), 15 deletions(-)
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 7ce26ed..1551cf4 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -411,6 +411,7 @@ volStorageBackendRBDGetFeatures(rbd_image_t image,
int r, ret = -1;
if ((r = rbd_get_features(image, features)) < 0) {
+ ret = r;
virReportSystemError(-r, _("failed to get the features of RBD image "
"%s"), volname);
goto cleanup;
@@ -427,16 +428,19 @@ volStorageBackendRBDGetFlags(rbd_image_t image,
const char *volname,
uint64_t *flags)
{
- int rc;
+ int r, ret = -1;
- if ((rc = rbd_get_flags(image, flags)) < 0) {
- virReportSystemError(-rc,
+ if ((r = rbd_get_flags(image, flags)) < 0) {
+ ret = r;
+ virReportSystemError(-r,
_("failed to get the flags of RBD image %s"),
volname);
- return -1;
+ goto cleanup;
}
+ ret = 0;
- return 0;
+ cleanup:
+ return ret;
}
static bool
@@ -470,6 +474,7 @@ virStorageBackendRBDSetAllocation(virStorageVolDefPtr vol,
if ((r = rbd_diff_iterate2(image, NULL, 0, info->size, 0, 1,
&virStorageBackendRBDRefreshVolInfoCb,
&allocation)) < 0) {
+ ret = r;
virReportSystemError(-r, _("failed to iterate RBD image '%s'"),
vol->name);
goto cleanup;
@@ -525,24 +530,28 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol,
uint64_t flags;
if ((r = rbd_open_read_only(ptr->ioctx, vol->name, &image, NULL)) < 0) {
- ret = -r;
+ ret = r;
virReportSystemError(-r, _("failed to open the RBD image '%s'"),
vol->name);
goto cleanup;
}
if ((r = rbd_stat(image, &info, sizeof(info))) < 0) {
- ret = -r;
+ ret = r;
virReportSystemError(-r, _("failed to stat the RBD image '%s'"),
vol->name);
goto cleanup;
}
- if (volStorageBackendRBDGetFeatures(image, vol->name, &features) < 0)
+ if ((r = volStorageBackendRBDGetFeatures(image, vol->name, &features)) < 0) {
+ ret = r;
goto cleanup;
+ }
- if (volStorageBackendRBDGetFlags(image, vol->name, &flags) < 0)
+ if ((r = volStorageBackendRBDGetFlags(image, vol->name, &flags)) < 0) {
+ ret = r;
goto cleanup;
+ }
vol->target.capacity = info.size;
vol->type = VIR_STORAGE_VOL_NETWORK;
@@ -555,8 +564,11 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol,
"Querying for actual allocation",
def->source.name, vol->name);
- if (virStorageBackendRBDSetAllocation(vol, image, &info) < 0)
+ if ((r = virStorageBackendRBDSetAllocation(vol, image, &info) < 0)) {
+ ret = r;
goto cleanup;
+ }
+
} else {
vol->target.allocation = info.obj_size * info.num_objs;
}
@@ -734,12 +746,10 @@ virStorageBackendRBDRefreshPool(virStoragePoolObjPtr pool)
*
* Do not error out and simply ignore the volume
*/
- if (r < 0) {
- if (r == -ENOENT || r == -ETIMEDOUT)
- continue;
-
+ if (r == -ENOENT || r == -ETIMEDOUT)
+ continue;
+ else if (r < 0)
goto cleanup;
- }
if (virStoragePoolObjAddVol(pool, vol) < 0)
goto cleanup;
--
2.7.5
4 years, 12 months
[libvirt] [go-xml PATCH 0/2] Fix libvirt-go-xml test CI
by Cole Robinson
Patch 1 is a nearby 'fix'
Patch 2 fixes the CI for the new address type='unassigned'
Cole Robinson (2):
Fix virtio-s390 address lookup
Support domain address type='unassigned'
domain.go | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
--
2.23.0
4 years, 12 months
[libvirt] [jenkins-ci PATCH] guests: update FreeBSD to use py37 packages
by Daniel P. Berrangé
The base python3 package was updated to python 3.7.5, so we must update
all the modules to match this version.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
guests/vars/mappings.yml | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index ef4e17a..7b97546 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -160,7 +160,7 @@ mappings:
flake8:
deb: flake8
- pkg: py36-flake8
+ pkg: py37-flake8
rpm: python3-flake8
CentOS7:
@@ -824,14 +824,14 @@ mappings:
python3-docutils:
default: python3-docutils
CentOS7: python36-docutils
- FreeBSD: py36-docutils
+ FreeBSD: py37-docutils
python3:
default: python3
python3-dbus:
default: python3-dbus
- FreeBSD: py36-dbus
+ FreeBSD: py37-dbus
CentOS7: python36-dbus
python3-devel:
@@ -843,24 +843,24 @@ mappings:
python3-gi:
deb: python3-gi
- pkg: py36-gobject3
+ pkg: py37-gobject3
rpm: python3-gobject
CentOS7: python36-gobject
python3-libxml2:
default: python3-libxml2
- FreeBSD: py36-libxml2
+ FreeBSD: py37-libxml2
CentOS7:
Ubuntu1604:
python3-lxml:
default: python3-lxml
- FreeBSD: py36-lxml
+ FreeBSD: py37-lxml
CentOS7: python36-lxml
python3-nose:
default: python3-nose
- FreeBSD: py36-nose
+ FreeBSD: py37-nose
CentOS7: python36-nose
python3-pip:
@@ -871,17 +871,17 @@ mappings:
python3-pytest:
default: python3-pytest
- FreeBSD: py36-pytest
+ FreeBSD: py37-pytest
CentOS7: python36-pytest
python3-requests:
default: python3-requests
- FreeBSD: py36-requests
+ FreeBSD: py37-requests
CentOS7: python36-requests
python3-setuptools:
default: python3-setuptools
- FreeBSD: py36-setuptools
+ FreeBSD: py37-setuptools
qemu-img:
default: qemu-utils
--
2.23.0
5 years
[libvirt] [PATCH] docs/auth.html.in: fixed typos
by Andrew Miloradovsky
Signed-off-by: Andrew Miloradovsky <andrew(a)interpretmath.pw>
---
docs/auth.html.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/auth.html.in b/docs/auth.html.in
index 62af43a915..c81c1e58ad 100644
--- a/docs/auth.html.in
+++ b/docs/auth.html.in
@@ -274,7 +274,7 @@ to turn on SASL auth in these listeners.
</p>
<p>
Since the libvirt SASL config file defaults to using GSSAPI (Kerberos), a
-config change is rquired to enable plain password auth. This is done by
+config change is required to enable plain password auth. This is done by
editting <code>/etc/sasl2/libvirt.conf</code> to set the <code>mech_list</code>
parameter to <code>scram-sha-1</code>.
</p>
@@ -317,7 +317,7 @@ in these scenarios - only the plain TCP listener needs encryption
Some operating systems do not install the SASL kerberos plugin by default. It
may be necessary to install a sub-package such as <code>cyrus-sasl-gssapi</code>.
To check whether the Kerberos plugin is installed run the <code>pluginviewer</code>
-program and verify that <code>gssapi</code> is listed,eg:
+program and verify that <code>gssapi</code> is listed, e.g.:
</p>
<pre>
# pluginviewer
@@ -359,7 +359,7 @@ kadmin.local: quit
<p>
Any client application wishing to connect to a Kerberos enabled libvirt server
merely needs to run <code>kinit</code> to gain a user principal. This may well
-be done automatically when a user logs into a desktop session, if PAM is setup
+be done automatically when a user logs into a desktop session, if PAM is set up
to authenticate against Kerberos.
</p>
</body>
--
2.24.0
5 years