[libvirt] [PATCH] docs: mention lifted vCPUs restriction for esx
by Pino Toscano
It was lifted with c92b6023e8eb670e01571e299a85e9da9bd4844c.
Signed-off-by: Pino Toscano <ptoscano(a)redhat.com>
---
docs/drvesx.html.in | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/docs/drvesx.html.in b/docs/drvesx.html.in
index 901d65958a..ac7bc645d1 100644
--- a/docs/drvesx.html.in
+++ b/docs/drvesx.html.in
@@ -337,7 +337,9 @@ error: invalid argument in libvirt was built without the 'esx' driver
Memory size has to be a multiple of 4096
</li>
<li>
- Number of virtual CPU has to be 1 or a multiple of 2
+ Number of virtual CPU has to be 1 or a multiple of 2.
+ <span class="since">Since 4.10.0</span> any number of vCPUs is
+ supported.
</li>
<li>
Valid MAC address prefixes are <code>00:0c:29</code> and
--
2.21.0
5 years
[libvirt] [PATCH 0/5] PATCH 0/8] Remove use of 'strsep' gnulib module (kill-a-gnulib-module-a-day initiative)
by Peter Krempa
Peter Krempa (5):
rpc: use virStringSplit instead of strsep
util: file: Use g_autofree in virFindFileInPath
util: file: Simplify logic of shortuct cases in virFindFileInPath
util: file: Replace use of 'strsep' with virStringSplit
gnulib: Remove use of 'strsep' module
bootstrap.conf | 1 -
src/rpc/virnetsocket.c | 28 ++++++++++++----------------
src/util/virfile.c | 38 ++++++++++++++++----------------------
3 files changed, 28 insertions(+), 39 deletions(-)
--
2.23.0
5 years
[libvirt] [PATCH] libxl: Fix lock manager lock ordering
by Jim Fehlig
The ordering of lock manager locks in the libxl driver has a flaw that was
uncovered by a migration error path. In the perform phase of migration, the
source host calls virDomainLockProcessPause to release the lock before
sending the VM to the destination host. If the send fails an attempt is made
to reacquire the lock with virDomainLockProcessResume, but that too can fail
if the destination host has not finished cleaning up the failed VM and
releasing the lock it acquired when starting to receive the VM.
This change delays calling virDomainLockProcessResume in libxlDomainStart
until the VM is successfully created, but before it is unpaused. A similar
approach is used by the qemu driver, avoiding the need to release the lock
if VM creation fails. In the migration perform phase, releasing the lock
with virDomainLockProcessPause is delayed until the VM is successfully
sent to the destination, which avoids reacquiring the lock if the send
fails.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_domain.c | 14 +++++++-------
src/libxl/libxl_migration.c | 14 +++++---------
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 4073bf8d46..a830a19b99 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -1364,13 +1364,6 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
NULL) < 0)
goto cleanup;
- if (virDomainLockProcessResume(driver->lockManager,
- "xen:///system",
- vm,
- priv->lockState) < 0)
- goto cleanup;
- VIR_FREE(priv->lockState);
-
if (libxlNetworkPrepareDevices(vm->def) < 0)
goto cleanup_dom;
@@ -1453,6 +1446,13 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
libxlLoggerOpenFile(cfg->logger, domid, vm->def->name, config_json);
+ if (virDomainLockProcessResume(driver->lockManager,
+ "xen:///system",
+ vm,
+ priv->lockState) < 0)
+ goto destroy_dom;
+ VIR_FREE(priv->lockState);
+
/* Always enable domain death events */
if (libxl_evenable_domain_death(cfg->ctx, vm->def->id, 0, &priv->deathW))
goto destroy_dom;
diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index a1021d499b..8e64dc5d04 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -1253,20 +1253,16 @@ libxlDomainMigrationSrcPerform(libxlDriverPrivatePtr driver,
sockfd = virNetSocketDupFD(sock, true);
virObjectUnref(sock);
- if (virDomainLockProcessPause(driver->lockManager, vm, &priv->lockState) < 0)
- VIR_WARN("Unable to release lease on %s", vm->def->name);
- VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState));
-
/* suspend vm and send saved data to dst through socket fd */
virObjectUnlock(vm);
ret = libxlDoMigrateSrcSend(driver, vm, flags, sockfd);
virObjectLock(vm);
- if (ret < 0) {
- virDomainLockProcessResume(driver->lockManager,
- "xen:///system",
- vm,
- priv->lockState);
+ if (ret == 0) {
+ if (virDomainLockProcessPause(driver->lockManager, vm, &priv->lockState) < 0)
+ VIR_WARN("Unable to release lease on %s", vm->def->name);
+ VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState));
+ } else {
/*
* Confirm phase will not be executed if perform fails. End the
* job started in begin phase.
--
2.23.0
5 years
[libvirt] [PATCH v2 0/3] use virStringParseYesNo helper
by Mao Zhongyi
A function virStringParseYesNo was added to convert
string 'yes' to true and 'no' to false, so use this
helper to replace 'STREQ(.*, \"yes\")' and
'STREQ(.*, \"no\")' as it allows us to drop several
repetitive if-then-else string->bool conversion blocks.
v2->v1
p1:
- ignore the return value of virStringParseYesNo.
- update the commit message. [Michal Privoznik]
p2:
- add the Acked-by tag.
p3:
- pass return value of helper to rc directly.
[Michal Privoznik]
Mao Zhongyi (3):
conf/domain_conf: use virStringParseYesNo helper
conf/network_conf: use virStringParseYesNo helper
qemu/qemu_migration_params: use virStringParseYesNo helper
src/conf/domain_conf.c | 35 ++++++++++++--------------------
src/conf/network_conf.c | 4 +---
src/qemu/qemu_migration_params.c | 7 +------
3 files changed, 15 insertions(+), 31 deletions(-)
--
2.17.1
5 years
[libvirt] [PATCH v2 0/5] Fix up some issues from x and y resolution patches
by Jonathon Jongsma
This is a follow-up series responding to some comments from Jan Tomko. Most
importantly, the fact that the errors are not propagated up to the caller,
they're only logged. To fix this, the function signatures were changed to
return a error status.
The patch series was also re-ordered slightly to improve readability (I hope).
Jonathon Jongsma (5):
qemu: fix documentation for video resolution
conf: remove unnecessary NULL checks
conf: use glib allocation when parsing video props
conf: report errors when parsing video resolution
conf: report errors when parsing video acceleration
docs/formatdomain.html.in | 12 +++--
src/conf/domain_conf.c | 108 ++++++++++++++++++++++----------------
2 files changed, 71 insertions(+), 49 deletions(-)
--
2.21.0
5 years
[libvirt] [PATCH 0/8] Remove use of 'areadlink' gnulib module (kill-a-gnulib-module-a-day initiative)
by Peter Krempa
This removes use of 'areadlink' by using 'g_file_read_link' and fixes a
few insane uses.
Note that I'll post the actual module deletion from bootstrap.conf
separately as touching that file results in lengthy rebuilds.
Peter Krempa (8):
qemu: domain: Use g_file_read_link instead of virFileReadLink
util: file: Remove virFileReadLink
qemu: tpm: Use g_autofree in qemuTPMEmulatorGetPid
qemu: tpm: Sanitize error values in qemuTPMEmulatorGetPid
qemu: gpu: Sanitize error values in qemuVhostUserGPUGetPid
util: pidfile: Sanitize return values of virPidFileReadIfAlive
util: pidfile: Sanitize return values of virPidFileReadPathIfAlive
util: pidfile: Replace 'areadlink' by 'g_file_read_link'
src/libvirt_private.syms | 1 -
src/qemu/qemu_domain.c | 18 +++++-----
src/qemu/qemu_tpm.c | 16 ++++-----
src/qemu/qemu_vhost_user_gpu.c | 12 ++++---
src/util/virfile.c | 13 -------
src/util/virfile.h | 3 --
src/util/virpidfile.c | 64 +++++++++++++++++-----------------
7 files changed, 56 insertions(+), 71 deletions(-)
--
2.23.0
5 years
[libvirt] [PATCH Rust 0/4] Map more functions in stream module
by Zixing Liu
This set of patches will add more functions to the Rust bindings.
Newly mapped functions from C library: virStreamNew virStreamEventUpdateCallback virStreamEventRemoveCallback virStreamEventAddCallback.
virStreamEventAddCallback can accept normal fn functions or closures (can capture variables outside)
The changes are not very thoroughly tested since event module is not implemented at all so the virStreamEventAddCallback will always return "unsupported by the connection driver".
Also the changes have run though the rustfmt to ensure the format conforms to Rust officially recommended code style.
Zixing Liu (4):
libvirt-rust: stream: add more functions in stream
libvirt-rust: stream: add more functions in stream
libvirt-rust: stream: automated lint
libvirt-rust: use reference instead of moving
src/domain.rs | 2 +-
src/stream.rs | 128 ++++++++++++++++++++++++++++++++++++++++++------
tests/stream.rs | 40 +++++++++++++++
3 files changed, 153 insertions(+), 17 deletions(-)
create mode 100644 tests/stream.rs
--
2.24.0
5 years
[libvirt] [RFC] default video device type
by Pavel Mores
Hi,
I'm looking into fixing
https://bugzilla.redhat.com/show_bug.cgi?id=1668141
(as a short summary, if a graphics device is added to XML that has no video
device, libvirt automatically adds a video device which is always of type
'cirrus' - even if the underlying qemu doesn't support cirrus).
I'm able to affect the behaviour in question by using qemu capabilities in
qemuDomainDeviceVideoDefPostParse(), see proof-of-concept change in [1]. I
have a couple of questions though:
1) is this a proper place and approach to fix the bug?
2) what would be the full specification of expected behaviour? The bug report
only states that the video type shouldn't be cirrus but doesn't say what it
should be. [2] gives some information about the order of preference of video
device types but I was wondering if there are any opinions about this on this
list?
Cheers,
pvl
[1]
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b4175a846e..0de491b79f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -7821,7 +7821,8 @@ qemuDomainDeviceNetDefPostParse(virDomainNetDefPtr net,
static int
qemuDomainDeviceVideoDefPostParse(virDomainVideoDefPtr video,
- const virDomainDef *def)
+ const virDomainDef *def,
+ virQEMUCapsPtr qemuCaps)
{
if (video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT) {
if (ARCH_IS_PPC64(def->os.arch))
@@ -7830,8 +7831,16 @@ qemuDomainDeviceVideoDefPostParse(virDomainVideoDefPtr video,
qemuDomainIsRISCVVirt(def) ||
ARCH_IS_S390(def->os.arch))
video->type = VIR_DOMAIN_VIDEO_TYPE_VIRTIO;
- else
- video->type = VIR_DOMAIN_VIDEO_TYPE_CIRRUS;
+ else {
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE)
+ && virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) {
+ video->type = VIR_DOMAIN_VIDEO_TYPE_QXL;
+ video->vgamem = QEMU_QXL_VGAMEM_DEFAULT;
+ } else {
+ video->type = VIR_DOMAIN_VIDEO_TYPE_VGA;
+ }
+ }
}
if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL &&
@@ -7926,7 +7935,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
break;
case VIR_DOMAIN_DEVICE_VIDEO:
- ret = qemuDomainDeviceVideoDefPostParse(dev->data.video, def);
+ ret = qemuDomainDeviceVideoDefPostParse(dev->data.video, def, qemuCaps);
break;
case VIR_DOMAIN_DEVICE_PANIC:
[2] https://www.kraxel.org/blog/2019/09/display-devices-in-qemu/
5 years
[libvirt] [PATCH] virhostuptime: Add linux stub for musl
by Michal Privoznik
When we want to know the boot timestamp of the host, we can call
virHostGetBootTime(). Under the hood, it uses getutxid() which is
defined by POSIX and properly check for in configure. However,
musl took a path where it declares the function but instead of
providing any useful implementation it returns NULL meaning "no
record found". If that's the case, use our second best option -
/proc/uptime and a bit of maths.
https://bugzilla.redhat.com/show_bug.cgi?id=1760885
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/util/virhostuptime.c | 64 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 61 insertions(+), 3 deletions(-)
diff --git a/src/util/virhostuptime.c b/src/util/virhostuptime.c
index 62b781acd5..3189074d3d 100644
--- a/src/util/virhostuptime.c
+++ b/src/util/virhostuptime.c
@@ -25,16 +25,68 @@
#endif
#include "virhostuptime.h"
+#include "viralloc.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "virtime.h"
#include "virthread.h"
+#define VIR_FROM_THIS VIR_FROM_NONE
+
+VIR_LOG_INIT("util.virhostuptime");
+
static unsigned long long bootTime;
static int bootTimeErrno;
static virOnceControl virHostGetBootTimeOnce = VIR_ONCE_CONTROL_INITIALIZER;
-#ifdef HAVE_GETUTXID
+#if defined(__linux__)
+# define UPTIME_FILE "/proc/uptime"
+static int
+virHostGetBootTimeProcfs(unsigned long long *btime)
+{
+ unsigned long long now;
+ double up;
+ g_autofree char *buf = NULL;
+ char *tmp;
+
+ if (virTimeMillisNow(&now) < 0)
+ return -errno;
+
+ /* 1KiB limit is more than enough. */
+ if (virFileReadAll(UPTIME_FILE, 1024, &buf) < 0)
+ return -errno;
+
+ /* buf contains two doubles now:
+ * $uptime $idle_time
+ * We're interested only in the first one */
+ if (!(tmp = strchr(buf, ' '))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("uptime file has unexpected format '%s'"),
+ buf);
+ return -EINVAL;
+ }
+
+ *tmp = '\0';
+
+ if (virStrToDouble(buf, NULL, &up) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to parse sched info value '%s'"),
+ buf);
+ return -EINVAL;
+ }
+
+ *btime = now / 1000 - up + 0.5;
+
+ return 0;
+}
+#endif /* defined(__linux__) */
+
+#if defined(HAVE_GETUTXID) || defined(__linux__)
static void
virHostGetBootTimeOnceInit(void)
{
+# ifdef HAVE_GETUTXID
struct utmpx id = {.ut_type = BOOT_TIME};
struct utmpx *res = NULL;
@@ -45,16 +97,22 @@ virHostGetBootTimeOnceInit(void)
}
endutxent();
+# endif /* HAVE_GETUTXID */
+
+ if (bootTimeErrno == ENODATA ||
+ (bootTime == 0 && bootTimeErrno == 0)) {
+ bootTimeErrno = -virHostGetBootTimeProcfs(&bootTime);
+ }
}
-#else /* !HAVE_GETUTXID */
+#else /* !defined(HAVE_GETUTXID) && !defined(__linux__) */
static void
virHostGetBootTimeOnceInit(void)
{
bootTimeErrno = ENOSYS;
}
-#endif /* HAVE_GETUTXID */
+#endif /* !defined(HAVE_GETUTXID) && !defined(__linux__) */
/**
* virHostGetBootTime:
--
2.21.0
5 years