Re: [libvirt] Channel paths
by Sascha Silbe
Dear Daniel,
[CC += libvir-list, didn't notice before this thread is on qemu-devel
only]
"Daniel P. Berrange" <berrange(a)redhat.com> writes:
> On Thu, Jun 02, 2016 at 09:27:45PM +0200, Sascha Silbe wrote:
>> Since 71408079 [qemu: Don't bother user with libvirt-internal paths],
>> the path chosen by libvirt isn't included in the domain XML anymore. So
>> now I need to choose the path inside the application. The only safe way
>> to do that is by using something in an application-managed namespace
>> (e.g. /var/lib/myapp/foo or /tmp/myapp/foo); I certainly wouldn't want
>> to second guess what paths would be safe inside the libvirt namespace
>> (/var/lib/libvirt/qemu). Except now I hear that anything outside
>> /var/lib/libvirt/qemu is not guaranteed to work due to e.g. the SELinux
>> policy configured by libvirt...
>
> IIUC that change 71408079 ought to only apply to the persistent XML
> configuration on disk. When the guest is running the live XML ought
> to still report the path libvirt chose, so you should still be able
> to see it while running. If that isn't the case then please raise a
> bug, because we certainly expect apps to be able to discover the
> path libvirt picked for exactly the reason you describe
OK, this makes a lot more sense now (persistent vs. live). Just tried it
with current libvirt master and it works, thanks.
It even worked with 71408079 itself. I'm pretty sure things were broken
some time in between, but a few quick probes didn't turn up a faulty
version and I'm not curious enough to do a linear search. Cannot
completely rule out other effects having played a role, either.
Sascha
--
Softwareentwicklung Sascha Silbe, Niederhofenstraße 5/1, 71229 Leonberg
https://se-silbe.de/
USt-IdNr. DE281696641
8 years, 5 months
[libvirt] [PATCH v3 0/4] Replace VIR_ERROR with standard vir*Error in state driver init
by Jovanka Gulicoska
Replace VIR_ERROR logging macros for error reporting in driver startup routines
with vir*Error function. Don't use virStrerror and remove ebuf.
Link to task: http://wiki.libvirt.org/page/BiteSizedTasks#Replace_VIR_ERROR_with_standa...
Jovanka Gulicoska (4):
uml: Replace VIR_ERROR with standard vir*Error in state driver init
qemu: Replace VIR_ERROR with standard vir*Error in state driver init
xen: Replace VIR_ERROR with standard vir*Error in state driver init
node_device: Replace VIR_ERROR with standard vir*Error in state driver
init
src/node_device/node_device_hal.c | 26 +++++++++++-------
src/node_device/node_device_udev.c | 49 ++++++++++++++++++++--------------
src/qemu/qemu_driver.c | 54 +++++++++++++++++++++++---------------
src/uml/uml_driver.c | 20 ++++++--------
src/xen/xen_driver.c | 5 ++--
5 files changed, 90 insertions(+), 64 deletions(-)
--
2.5.5
8 years, 5 months
[libvirt] [PATCH] Updated to deal with specifying user IDs to that do not map to usernames
by Roy Keene
Patch to libvirt master to avoid failing when a user ID is specified,
e.g. for <seclabel type='dac'>, that does not map to a user name.
This is useful if you want to run each VM as a separate user and not
bother creating an /etc/passwd entry for each UID.
It compiles but is as yet untested.
---
src/util/virutil.c | 69
+++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 50 insertions(+), 19 deletions(-)
diff --git a/src/util/virutil.c b/src/util/virutil.c
index d80d994..ae95237 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -790,26 +790,57 @@ virGetUserEnt(uid_t uid, char **name, gid_t
*group, char **dir)
if (VIR_RESIZE_N(strbuf, strbuflen, strbuflen, strbuflen) < 0)
goto cleanup;
}
- if (rc != 0) {
- virReportSystemError(rc,
- _("Failed to find user record for uid '%u'"),
- (unsigned int) uid);
- goto cleanup;
- } else if (pw == NULL) {
- virReportError(VIR_ERR_SYSTEM_ERROR,
- _("Failed to find user record for uid '%u'"),
- (unsigned int) uid);
- goto cleanup;
- }
- if (name && VIR_STRDUP(*name, pw->pw_name) < 0)
- goto cleanup;
- if (group)
- *group = pw->pw_gid;
- if (dir && VIR_STRDUP(*dir, pw->pw_dir) < 0) {
- if (name)
- VIR_FREE(*name);
- goto cleanup;
+ if (rc != 0 || pw == NULL) {
+ /*
+ * If the user does not exist or its data is not present, return
+ * a created username.
+ */
+ VIR_FREE(strbuf);
+
+ strbuflen = 128;
+
+ if (VIR_ALLOC_N(strbuf, strbuflen) < 0) {
+ return(-1);
+ }
+
+ /*
+ * Fake user home directory: /
+ */
+ if (dir) {
+ if (VIR_STRDUP(*dir, "/") < 0) {
+ goto cleanup;
+ }
+ }
+
+ /*
+ * Fake user GID: Same as UID
+ */
+ if (group) {
+ *group = (gid_t) uid;
+ }
+
+ /*
+ * Fake user name: Same as UID (in string)
+ */
+ snprintf(strbuf, strbuflen, "%llu", (unsigned long long) uid);
+
+ if (name && VIR_STRDUP(*name, strbuf) < 0) {
+ if (dir) {
+ VIR_FREE(*dir);
+ }
+ goto cleanup;
+ }
+ } else {
+ if (name && VIR_STRDUP(*name, pw->pw_name) < 0)
+ goto cleanup;
+ if (group)
+ *group = pw->pw_gid;
+ if (dir && VIR_STRDUP(*dir, pw->pw_dir) < 0) {
+ if (name)
+ VIR_FREE(*name);
+ goto cleanup;
+ }
}
ret = 0;
--
2.7.4
8 years, 5 months
[libvirt] [PATCH 0/5] qemu: Improve VM file logging using virtlogd
by Peter Krempa
Patch 4/5 fixes a bug that was introduced with virtlogd. Rest of the patches
add infrastructure for logging singular events to the vm log file.
Peter Krempa (5):
log: handler: Add new API to append to logging files
log: daemon: Add remote protocol handling for the log appending API
qemu: domain: Implement helper for one-shot log entries to the VM log
file
qemu: process: Append the "shutting down" message using the new APIs
qemu: migration: Add VM log entry on start of migration
src/libvirt_private.syms | 1 +
src/logging/log_daemon_dispatch.c | 26 ++++++++++++++++
src/logging/log_handler.c | 50 +++++++++++++++++++++++++++++++
src/logging/log_handler.h | 8 +++++
src/logging/log_manager.c | 34 +++++++++++++++++++++
src/logging/log_manager.h | 8 +++++
src/logging/log_protocol.x | 20 ++++++++++++-
src/qemu/qemu_domain.c | 62 +++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_domain.h | 5 ++++
src/qemu/qemu_migration.c | 7 +++++
src/qemu/qemu_process.c | 11 ++-----
11 files changed, 223 insertions(+), 9 deletions(-)
--
2.8.3
8 years, 5 months
[libvirt] [PATCH 0/3] Speed up schema testing
by Ján Tomko
Currently, we spawn a new xmllint process for every tested XML file.
Fortunately, xmllint accepts multiple files on its command line.
Use xargs on XML files we expect to be valid and only fall back
to file-by-file check if that fails (or if VIR_TEST_EXPENSIVE was requested).
This speeds up successfully passing domainschematest 32x (from ~13s to ~0.5s)
and make check over 2x (over 16s to ~8s), making it even more fun to use with
git rebase -x.
Ján Tomko (3):
schematestutils: split out file-by-file schema checking
schematestutils: split out check_one_file
schematestutils: Add check_schema_quick
tests/schematestutils.sh | 79 ++++++++++++++++++++++++++++++++++++------------
1 file changed, 59 insertions(+), 20 deletions(-)
--
2.7.3
8 years, 5 months
[libvirt] [PATCH] util: Perform proper virRandomBytes return value checking
by John Ferlan
Document the return value of virRandomBytes as 0 or some errno value and
then make sure all callers make the proper checks.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/util/vircrypto.c | 2 +-
src/util/virrandom.c | 2 ++
tests/vircryptotest.c | 6 ++++--
tests/virrandomtest.c | 2 +-
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/util/vircrypto.c b/src/util/vircrypto.c
index 4f288f0..8452936 100644
--- a/src/util/vircrypto.c
+++ b/src/util/vircrypto.c
@@ -301,7 +301,7 @@ virCryptoGenerateRandom(size_t nbytes)
/* If we don't have gnutls_rnd(), we will generate a less cryptographically
* strong master buf from /dev/urandom.
*/
- if ((ret = virRandomBytes(buf, nbytes)) < 0) {
+ if ((ret = virRandomBytes(buf, nbytes))) {
virReportSystemError(ret, "%s", _("failed to generate byte stream"));
VIR_FREE(buf);
return NULL;
diff --git a/src/util/virrandom.c b/src/util/virrandom.c
index 62a0e31..41daa40 100644
--- a/src/util/virrandom.c
+++ b/src/util/virrandom.c
@@ -167,6 +167,8 @@ uint32_t virRandomInt(uint32_t max)
*
* Generate a stream of random bytes from /dev/urandom
* into @buf of size @buflen
+ *
+ * Returns 0 on success or an errno on failure
*/
int
virRandomBytes(unsigned char *buf,
diff --git a/tests/vircryptotest.c b/tests/vircryptotest.c
index 72265d9..e7b7de5 100644
--- a/tests/vircryptotest.c
+++ b/tests/vircryptotest.c
@@ -87,9 +87,11 @@ testCryptoEncrypt(const void *opaque)
VIR_ALLOC_N(iv, ivlen) < 0)
goto cleanup;
- if (virRandomBytes(enckey, enckeylen) < 0 ||
- virRandomBytes(iv, ivlen) < 0)
+ if (virRandomBytes(enckey, enckeylen) ||
+ virRandomBytes(iv, ivlen)) {
+ fprintf(stderr, "Failed to generate random bytes\n");
goto cleanup;
+ }
if (virCryptoEncryptData(data->algorithm, enckey, enckeylen, iv, ivlen,
data->input, data->inputlen,
diff --git a/tests/virrandomtest.c b/tests/virrandomtest.c
index 367bdc7..687ebd9 100644
--- a/tests/virrandomtest.c
+++ b/tests/virrandomtest.c
@@ -40,7 +40,7 @@ testRandomBytes(const void *unused ATTRIBUTE_UNUSED)
if (VIR_ALLOC_N(data, datalen) < 0)
return -1;
- if (virRandomBytes(data, datalen) < 0) {
+ if (virRandomBytes(data, datalen)) {
fprintf(stderr, "Failed to generate random bytes");
goto cleanup;
}
--
2.5.5
8 years, 5 months
[libvirt] [PATCH] Reindent virNetDevSendEthtoolIoctl
by Ján Tomko
---
src/util/virnetdev.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
Pushed as trivial.
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index e6c57ac..af122f5 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -3213,15 +3213,15 @@ virNetDevSendEthtoolIoctl(int fd, struct ifreq *ifr)
ret = ioctl(fd, SIOCETHTOOL, ifr);
if (ret != 0) {
switch (errno) {
- case EINVAL: /* kernel doesn't support SIOCETHTOOL */
- VIR_DEBUG("ethtool ioctl: invalid request");
- break;
- case EOPNOTSUPP: /* kernel doesn't support specific feature */
- VIR_DEBUG("ethtool ioctl: request not supported");
- break;
- default:
- virReportSystemError(errno, "%s", _("ethtool ioctl error"));
- break;
+ case EINVAL: /* kernel doesn't support SIOCETHTOOL */
+ VIR_DEBUG("ethtool ioctl: invalid request");
+ break;
+ case EOPNOTSUPP: /* kernel doesn't support specific feature */
+ VIR_DEBUG("ethtool ioctl: request not supported");
+ break;
+ default:
+ virReportSystemError(errno, "%s", _("ethtool ioctl error"));
+ break;
}
}
--
2.7.3
8 years, 5 months
[libvirt] [PATCH] Reindent comment of virNetDevFeatureAvailable
by Ján Tomko
---
src/util/virnetdev.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
Pushed as trivial.
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 7db4497..5ad61fe 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -3241,14 +3241,14 @@ virNetDevSendEthtoolIoctl(const char *ifname, void *cmd)
/**
-* virNetDevFeatureAvailable
-* This function checks for the availability of a network device feature
-*
-* @ifname: name of the interface
-* @cmd: reference to an ethtool command structure
-*
-* Returns 0 if not found, 1 on success, and -1 on failure.
-*/
+ * virNetDevFeatureAvailable
+ * This function checks for the availability of a network device feature
+ *
+ * @ifname: name of the interface
+ * @cmd: reference to an ethtool command structure
+ *
+ * Returns 0 if not found, 1 on success, and -1 on failure.
+ */
static int
virNetDevFeatureAvailable(const char *ifname, struct ethtool_value *cmd)
{
--
2.7.3
8 years, 5 months
[libvirt] [PATCH] spec: Advertise nvram paths of official fedora edk2 builds
by Cole Robinson
Fedora now ships edk2 firmware in its official repos, so adapt
the nvram path list to match. Eventually we can remove the nightly
links as well once some integration kinks have been worked out,
and documentation updated.
Move the macro building into the %build target, which lets us
build up a shell variable and make things a bit more readable
https://bugzilla.redhat.com/show_bug.cgi?id=1335395
---
libvirt.spec.in | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index c7fcf85..8b88eef 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -192,12 +192,6 @@
%define qemu_group qemu
-# Advertise OVMF and AAVMF from nightly firmware repo
-%if 0%{?fedora}
- %define arg_loader_nvram --with-loader-nvram="/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd:/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd:/usr/share/edk2.git/aarch64/QEMU_EFI-pflash.raw:/usr/share/edk2.git/aarch64/vars-template-pflash.raw"
-%endif
-
-
%if 0%{?fedora} || 0%{?rhel} >= 7
%define with_systemd_macros 1
%else
@@ -1097,6 +1091,18 @@ rm -rf .git
%define arg_selinux_mount --with-selinux-mount="/selinux"
%endif
+%if 0%{?fedora}
+ # Nightly firmware repo x86/OVMF
+ LOADERS="/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd:/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd"
+ # Nightly firmware repo aarch64/AAVMF
+ LOADERS="$LOADERS:/usr/share/edk2.git/aarch64/QEMU_EFI-pflash.raw:/usr/share/edk2.git/aarch64/vars-template-pflash.raw"
+ # Fedora official x86/OVMF
+ LOADERS="$LOADERS:/usr/share/edk2/ovmf/OVMF_CODE.fd:/usr/share/edk2/ovmf/OVMF_VARS.fd"
+ # Fedora official aarch64/AAVMF
+ LOADERS="$LOADERS:/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw:/usr/share/edk2/aarch64/vars-template-pflash.raw"
+ %define arg_loader_nvram --with-loader-nvram="$LOADERS"
+%endif
+
# place macros above and build commands below this comment
%if 0%{?enable_autotools}
--
2.7.4
8 years, 5 months
[libvirt] [PATCH] qemu: process: Allow VIR_QEMU_PROCESS_START_NEW in qemuProcessLaunch
by Peter Krempa
The new flag was not added to virCheckFlags in commit '0d1c17aa' causing
a regression where VMs were not able to start.
---
Pushed under the trivial rule.
src/qemu/qemu_process.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2f5829c..66bc4b1 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5062,7 +5062,8 @@ qemuProcessLaunch(virConnectPtr conn,
* but doesn't hurt to check */
virCheckFlags(VIR_QEMU_PROCESS_START_COLD |
VIR_QEMU_PROCESS_START_PAUSED |
- VIR_QEMU_PROCESS_START_AUTODESTROY, -1);
+ VIR_QEMU_PROCESS_START_AUTODESTROY |
+ VIR_QEMU_PROCESS_START_NEW, -1);
cfg = virQEMUDriverGetConfig(driver);
--
2.8.3
8 years, 5 months