backport new changes to 4.0.0
by Jiatong Shen
Hello,
Sorry in advance if I am asking questions at the wrong place.
I would like know if we have plans to backport new features to old
releases, for example block copy remote disks. If the answer is no, then
where can I find some guidance on building a libvirt debian packages?
Thank you very much for the help.
--
Best Regards,
Jiatong Shen
4 years, 7 months
[PATCH v3 00/10] Another round of qemu:///embed fixes
by Michal Privoznik
v3 of:
https://www.redhat.com/archives/libvir-list/2020-March/msg01112.html
diff to v2:
- Patch 2/10 is new; after discussion to v2 we can access
driver->privileged and driver->embeddedRoot directly
- Patch 3/10 is slightly reworked; it still drops unnecessary layers of
nesting in the default case (/var/lib/libvirt/qemu/ram) but it doesn't
do that if user provides a path via qemu.conf
Michal Prívozník (10):
tests: Fix virQEMUDriverConfigNew() calling with respect to @root
qemu: Drop virQEMUDriverIsPrivileged()
qemu: Drop two layers of nesting of memoryBackingDir
conf: Move virDomainGenerateMachineName to hypervisor/
virDomainDriverGenerateMachineName: Factor out embed path hashing
qemuDomainGetMachineName: Access embeddedRoot from driver rather than
cfg
Revert "qemu_conf: Track embed root dir"
qemu: Make hugepages path generation embed driver aware
qemu: Make memory path generation embed driver aware
qemu: Make auto dump path generation embed driver aware
src/conf/domain_conf.c | 72 ---------------
src/conf/domain_conf.h | 7 --
src/hypervisor/domain_driver.c | 88 +++++++++++++++++++
src/hypervisor/domain_driver.h | 11 +++
src/libvirt_private.syms | 3 +-
src/lxc/lxc_domain.c | 3 +-
src/qemu/qemu_cgroup.c | 4 +-
src/qemu/qemu_command.c | 23 +++--
src/qemu/qemu_conf.c | 76 +++++++++-------
src/qemu/qemu_conf.h | 23 +++--
src/qemu/qemu_domain.c | 19 ++--
src/qemu/qemu_driver.c | 42 ++++-----
src/qemu/qemu_interface.c | 6 +-
src/qemu/qemu_process.c | 7 +-
tests/domaincapstest.c | 2 +-
.../qemuxml2argvdata/cpu-numa-memshared.args | 8 +-
.../fd-memory-no-numa-topology.args | 2 +-
.../fd-memory-numa-topology.args | 4 +-
.../fd-memory-numa-topology2.args | 8 +-
.../fd-memory-numa-topology3.args | 12 +--
.../hugepages-memaccess2.args | 12 +--
.../qemuxml2argvdata/pages-dimm-discard.args | 4 +-
...vhost-user-fs-fd-memory.x86_64-latest.args | 2 +-
tests/testutilsqemu.c | 2 +-
tests/virsystemdtest.c | 5 +-
25 files changed, 235 insertions(+), 210 deletions(-)
--
2.24.1
4 years, 7 months
[libvirt-jenkins-ci PATCH 0/5] Introduce the new 'gitlab' flavor
by Erik Skultety
Erik Skultety (5):
guests: templates: Introduce a gitlab-runner systemd service template
guests: templates: Introduce a gitlab-runner RC init service template
guests: Introduce the new 'gitlab' flavor
playbooks: gitlab: Force a random password for the root account
guests: lcitool: Enable the new 'gitlab' flavor in the lcitool script
guests/group_vars/all/main.yml | 3 +
guests/lcitool | 29 ++++++--
guests/playbooks/update/main.yml | 5 ++
guests/playbooks/update/tasks/gitlab.yml | 68 +++++++++++++++++++
.../update/templates/gitlab-runner.j2 | 32 +++++++++
.../update/templates/gitlab-runner.service.j2 | 12 ++++
6 files changed, 144 insertions(+), 5 deletions(-)
create mode 100644 guests/playbooks/update/tasks/gitlab.yml
create mode 100644 guests/playbooks/update/templates/gitlab-runner.j2
create mode 100644 guests/playbooks/update/templates/gitlab-runner.service.j2
--
2.25.1
4 years, 7 months
[PATCH] libxl: fix crash when initializing driver
by Jim Fehlig
Commit 54a401af478 split out DriverConfigInit from DriverConfigNew, but
then called it a bit late from libxlStateInitialize. The cfg is used in
libxlDriverConfigLoadFile and when uninitialized results in a crash.
Calling DriverConfigInit immediately after DriverConfigNew fixes the
crash.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_driver.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 7ec4fcc3d1..980984b199 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -702,14 +702,14 @@ libxlStateInitialize(bool privileged,
if (!(cfg = libxlDriverConfigNew()))
goto error;
+ if (libxlDriverConfigInit(cfg) < 0)
+ goto error;
+
driverConf = g_strdup_printf("%s/libxl.conf", cfg->configBaseDir);
if (libxlDriverConfigLoadFile(cfg, driverConf) < 0)
goto error;
- if (libxlDriverConfigInit(cfg) < 0)
- goto error;
-
/* Register the callbacks providing access to libvirt's event loop */
libxl_osevent_register_hooks(cfg->ctx, &libxl_osevent_callbacks, cfg->ctx);
--
2.26.0
4 years, 7 months
[PATCH] formatdomain.html.in: fix 'sockets' info in topology element
by Daniel Henrique Barboza
In the 'topology' element it is mentioned, regarding the sockets
value, "They refer to the total number of CPU sockets".
This is not accurate. What we're doing is calculating the number
of sockets per NUMA node, which can be checked in the current
implementation of virHostCPUGetInfoPopulateLinux(). Calculating
the total number of sockets would break the topology sanity
check nodes*sockets*cores*threads=online_cpus.
This documentation fix is important to avoid user confusion when
seeing the output of 'virsh capabilities' and expecting it to be
equal to the output of 'lscpu'. E.g in a Power 9 host this 'lscpu'
output:
Architecture: ppc64le
Byte Order: Little Endian
CPU(s): 160
On-line CPU(s) list: 0-159
Thread(s) per core: 4
Core(s) per socket: 20
Socket(s): 2
NUMA node(s): 2
Model: 2.2 (pvr 004e 1202)
Model name: POWER9, altivec supported
And this XML output from virsh capabilities:
<cpu>
<arch>ppc64le</arch>
<model>POWER9</model>
<vendor>IBM</vendor>
<topology sockets='1' dies='1' cores='20' threads='4'/>
(...)
</cpu>
Both are correct, as long as we mention in the Libvirt documentation
that 'sockets' in the topology element represents the number of sockets
per NUMA node.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
docs/formatdomain.html.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index aaeb05961f..7940d6ace5 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1675,9 +1675,9 @@
<dd>The <code>topology</code> element specifies requested topology of
virtual CPU provided to the guest. Four attributes, <code>sockets</code>,
<code>dies</code>, <code>cores</code>, and <code>threads</code>,
- accept non-zero positive integer values. They refer to the total number
- of CPU sockets, number of dies per socket, number of cores per die, and
- number of threads per core, respectively. The <code>dies</code>
+ accept non-zero positive integer values. They refer to the number of
+ CPU sockets per NUMA node, number of dies per socket, number of cores
+ per die, and number of threads per core, respectively. The <code>dies</code>
attribute is optional and will default to 1 if omitted, while the other
attributes are all mandatory. Hypervisors may require that the maximum
number of vCPUs specified by the <code>cpus</code> element equals to
--
2.25.1
4 years, 7 months
[PATCH] tools: variables clean-up in libvirt-guests script
by Prathamesh Chavan
Redeclared variables in script functions marked as local.
Variables `guest_running` and `guests_shutting_down` in the
functions 'guest_is_on` and `check_guests_shutdown` were
untouched, as the functions returned values in these
variables.
Signed-off-by: Prathamesh Chavan <pc44800(a)gmail.com>
---
I'm submitting this as my BiteSizedTask for GSoC'20
I've cc'd Martin Kletzander, as he is mentor for this task,
and to ensure that the needful was done by me.
After running `make check`, I received "PASS: 98 and
SKIP: 7" as the result.
Travis-ci build report can be found at [1].
For my project, 'Introducing job control to the storage driver',
right now I'm going through the `/src/qemu/THREADS.txt` as well
as previous work done by Tucker DiNapoli during GSoC'14, as well
as the proposal of Taowei Luo for GSoC'15. Their email threads
are surely helping me get a better picture of the project.
Apart from this, please let me know if there is anything else,
which could help me with this project. Thansk!
[1]: https://travis-ci.org/github/pratham-pc/libvirt/builds/668209157
tools/libvirt-guests.sh.in | 104 +++++++++++++++++++------------------
1 file changed, 54 insertions(+), 50 deletions(-)
diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in
index a881f6266e..90a18fee49 100644
--- a/tools/libvirt-guests.sh.in
+++ b/tools/libvirt-guests.sh.in
@@ -65,7 +65,7 @@ retval() {
# If URI is "default" virsh is called without the "-c" argument
# (using libvirt's default connection)
run_virsh() {
- uri=$1
+ local uri=$1
shift
if [ "x$uri" = xdefault ]; then
@@ -86,7 +86,7 @@ run_virsh_c() {
# check if URI is reachable
test_connect()
{
- uri=$1
+ local uri=$1
if run_virsh "$uri" connect 2>/dev/null; then
return 0;
@@ -103,8 +103,8 @@ test_connect()
# --transient: list only transient guests
# [none]: list both persistent and transient guests
list_guests() {
- uri=$1
- persistent=$2
+ local uri=$1
+ local persistent=$2
list=$(run_virsh_c "$uri" list --uuid $persistent)
if [ $? -ne 0 ]; then
@@ -118,8 +118,8 @@ list_guests() {
# guest_name URI UUID
# return name of guest UUID on URI
guest_name() {
- uri=$1
- uuid=$2
+ local uri=$1
+ local uuid=$2
run_virsh "$uri" domname "$uuid" 2>/dev/null
}
@@ -128,8 +128,8 @@ guest_name() {
# check if guest UUID on URI is running
# Result is returned by variable "guest_running"
guest_is_on() {
- uri=$1
- uuid=$2
+ local uri=$1
+ local uuid=$2
guest_running=false
id=$(run_virsh "$uri" domid "$uuid")
@@ -161,13 +161,13 @@ start() {
return 0
fi
- isfirst=true
- bypass=
- sync_time=false
+ local isfirst=true
+ local bypass=
+ local sync_time=false
test "x$BYPASS_CACHE" = x0 || bypass=--bypass-cache
test "x$SYNC_TIME" = x0 || sync_time=true
while read uri list; do
- configured=false
+ local configured=false
set -f
for confuri in $URIS; do
set +f
@@ -186,7 +186,7 @@ start() {
eval_gettext "Resuming guests on \$uri URI..."; echo
for guest in $list; do
- name=$(guest_name "$uri" "$guest")
+ local name=$(guest_name "$uri" "$guest")
eval_gettext "Resuming guest \$name: "
if guest_is_on "$uri" "$guest"; then
if "$guest_running"; then
@@ -217,17 +217,17 @@ start() {
# was saved.
suspend_guest()
{
- uri=$1
- guest=$2
+ local uri=$1
+ local guest=$2
- name=$(guest_name "$uri" "$guest")
- label=$(eval_gettext "Suspending \$name: ")
- bypass=
- slept=0
+ local name=$(guest_name "$uri" "$guest")
+ local label=$(eval_gettext "Suspending \$name: ")
+ local bypass=
+ local slept=0
test "x$BYPASS_CACHE" = x0 || bypass=--bypass-cache
printf '%s...\n' "$label"
run_virsh "$uri" managedsave $bypass "$guest" >/dev/null &
- virsh_pid=$!
+ local virsh_pid=$!
while true; do
sleep 1
kill -0 "$virsh_pid" >/dev/null 2>&1 || break
@@ -251,15 +251,17 @@ suspend_guest()
# was successfully shutdown or the timeout defined by $SHUTDOWN_TIMEOUT expired.
shutdown_guest()
{
- uri=$1
- guest=$2
+ local uri=$1
+ local guest=$2
- name=$(guest_name "$uri" "$guest")
+ local name=$(guest_name "$uri" "$guest")
eval_gettext "Starting shutdown on guest: \$name"
echo
retval run_virsh "$uri" shutdown "$guest" >/dev/null || return
- timeout=$SHUTDOWN_TIMEOUT
- check_timeout=false
+ local timeout=$SHUTDOWN_TIMEOUT
+ local check_timeout=false
+ local format=
+ local slept=
if [ $timeout -gt 0 ]; then
check_timeout=true
format=$(eval_gettext "Waiting for guest %s to shut down, %d seconds left\n")
@@ -300,8 +302,8 @@ shutdown_guest()
# was issued to libvirt to allow parallel shutdown.
shutdown_guest_async()
{
- uri=$1
- guest=$2
+ local uri=$1
+ local guest=$2
name=$(guest_name "$uri" "$guest")
eval_gettext "Starting shutdown on guest: \$name"
@@ -323,8 +325,8 @@ guest_count()
# Result is returned in "guests_shutting_down"
check_guests_shutdown()
{
- uri=$1
- guests_to_check=$2
+ local uri=$1
+ local guests_to_check=$2
guests_shutting_down=
for guest in $guests_to_check; do
@@ -344,16 +346,16 @@ check_guests_shutdown()
# a shutdown complete notice for guests that have finished
print_guests_shutdown()
{
- uri=$1
- before=$2
- after=$3
+ local uri=$1
+ local before=$2
+ local after=$3
for guest in $before; do
case " $after " in
*" $guest "*) continue;;
esac
- name=$(guest_name "$uri" "$guest")
+ local name=$(guest_name "$uri" "$guest")
if [ -n "$name" ]; then
eval_gettext "Shutdown of guest \$name complete."
echo
@@ -365,12 +367,14 @@ print_guests_shutdown()
# Shutdown guests GUESTS on machine URI in parallel
shutdown_guests_parallel()
{
- uri=$1
- guests=$2
-
- on_shutdown=
- check_timeout=false
- timeout=$SHUTDOWN_TIMEOUT
+ local uri=$1
+ local guests=$2
+
+ local on_shutdown=
+ local check_timeout=false
+ local timeout=$SHUTDOWN_TIMEOUT
+ local slept=
+ local format=
if [ $timeout -gt 0 ]; then
check_timeout=true
format=$(eval_gettext "Waiting for %d guests to shut down, %d seconds left\n")
@@ -382,7 +386,7 @@ shutdown_guests_parallel()
while [ -n "$guests" ] &&
[ $(guest_count "$on_shutdown") -lt "$PARALLEL_SHUTDOWN" ]; do
set -- $guests
- guest=$1
+ local guest=$1
shift
guests=$*
if [ -z "$(echo $on_shutdown | grep $guest)" ] &&
@@ -394,9 +398,9 @@ shutdown_guests_parallel()
sleep 1
set -- $guests
- guestcount=$#
+ local guestcount=$#
set -- $on_shutdown
- shutdowncount=$#
+ local shutdowncount=$#
if $check_timeout; then
if [ $(($timeout % 5)) -eq 0 ]; then
@@ -415,7 +419,7 @@ shutdown_guests_parallel()
fi
fi
- on_shutdown_prev=$on_shutdown
+ local on_shutdown_prev=$on_shutdown
check_guests_shutdown "$uri" "$on_shutdown"
on_shutdown="$guests_shutting_down"
print_guests_shutdown "$uri" "$on_shutdown_prev" "$on_shutdown"
@@ -428,8 +432,8 @@ stop() {
# last stop was not followed by start
[ -f "$LISTFILE" ] && return 0
- suspending=true
- if [ "x$ON_SHUTDOWN" = xshutdown ]; then
+ local suspending=true
+ if [ "/x$ON_SHUTDOWN" = xshutdown ]; then
suspending=false
if [ $SHUTDOWN_TIMEOUT -lt 0 ]; then
gettext "SHUTDOWN_TIMEOUT must be equal or greater than 0"
@@ -448,9 +452,9 @@ stop() {
eval_gettext "Running guests on \$uri URI: "
- list=$(list_guests "$uri")
+ local list=$(list_guests "$uri")
if [ $? -eq 0 ]; then
- empty=true
+ local empty=true
for uuid in $list; do
"$empty" || printf ", "
printf %s "$(guest_name "$uri" "$uuid")"
@@ -464,9 +468,9 @@ stop() {
fi
if "$suspending"; then
- transient=$(list_guests "$uri" "--transient")
+ local transient=$(list_guests "$uri" "--transient")
if [ $? -eq 0 ]; then
- empty=true
+ local empty=true
for uuid in $transient; do
if "$empty"; then
eval_gettext "Not suspending transient guests on URI: \$uri: "
@@ -563,7 +567,7 @@ rh_status() {
# usage [val]
# Display usage string, then exit with VAL (defaults to 2).
usage() {
- program_name=$0
+ local program_name=$0
eval_gettext "Usage: \$program_name {start|stop|status|restart|"\
"condrestart|try-restart|reload|force-reload|gueststatus|shutdown}"; echo
exit ${1-2}
--
2.17.1
4 years, 7 months
[PATCH] qemu_cgroup.c: use VIR_AUTOSTRINGLIST, g_autofree and g_autoptr
by Seeteena Thoufeek
Signed-off-by: Seeteena Thoufeek <s1seetee(a)linux.vnet.ibm.com>
---
src/qemu/qemu_cgroup.c | 91 +++++++++++++++++++-------------------------------
1 file changed, 35 insertions(+), 56 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index c0e30f6..d34c515 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -62,7 +62,7 @@ qemuSetupImagePathCgroup(virDomainObjPtr vm,
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int perms = VIR_CGROUP_DEVICE_READ;
- char **targetPaths = NULL;
+ VIR_AUTOSTRINGLIST targetPaths = NULL;
size_t i;
int rv;
int ret = -1;
@@ -82,12 +82,11 @@ qemuSetupImagePathCgroup(virDomainObjPtr vm,
virCgroupGetDevicePermsString(perms),
rv);
if (rv < 0)
- goto cleanup;
+ return ret;
if (rv > 0) {
/* @path is neither character device nor block device. */
- ret = 0;
- goto cleanup;
+ return 0;
}
if (virDevMapperGetTargets(path, &targetPaths) < 0 &&
@@ -95,7 +94,7 @@ qemuSetupImagePathCgroup(virDomainObjPtr vm,
virReportSystemError(errno,
_("Unable to get devmapper targets for %s"),
path);
- goto cleanup;
+ return ret;
}
for (i = 0; targetPaths && targetPaths[i]; i++) {
@@ -105,13 +104,10 @@ qemuSetupImagePathCgroup(virDomainObjPtr vm,
virCgroupGetDevicePermsString(perms),
rv);
if (rv < 0)
- goto cleanup;
+ return ret;
}
- ret = 0;
- cleanup:
- virStringListFree(targetPaths);
- return ret;
+ return 0;
}
@@ -739,7 +735,7 @@ static int
qemuSetupDevicesCgroup(virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- virQEMUDriverConfigPtr cfg = NULL;
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(priv->driver);
const char *const *deviceACL = NULL;
int rv = -1;
int ret = -1;
@@ -757,15 +753,15 @@ qemuSetupDevicesCgroup(virDomainObjPtr vm)
return 0;
}
- goto cleanup;
+ return ret;
}
if (qemuSetupFirmwareCgroup(vm) < 0)
- goto cleanup;
+ return ret;
for (i = 0; i < vm->def->ndisks; i++) {
if (qemuSetupImageChainCgroup(vm, vm->def->disks[i]->src) < 0)
- goto cleanup;
+ return ret;
}
rv = virCgroupAllowDevice(priv->cgroup, 'c', DEVICE_PTY_MAJOR, -1,
@@ -773,9 +769,8 @@ qemuSetupDevicesCgroup(virDomainObjPtr vm)
virDomainAuditCgroupMajor(vm, priv->cgroup, "allow", DEVICE_PTY_MAJOR,
"pty", "rw", rv == 0);
if (rv < 0)
- goto cleanup;
+ return ret;
- cfg = virQEMUDriverGetConfig(priv->driver);
deviceACL = cfg->cgroupDeviceACL ?
(const char *const *)cfg->cgroupDeviceACL :
defaultDeviceACL;
@@ -791,7 +786,7 @@ qemuSetupDevicesCgroup(virDomainObjPtr vm)
virDomainAuditCgroupMajor(vm, priv->cgroup, "allow", DEVICE_SND_MAJOR,
"sound", "rw", rv == 0);
if (rv < 0)
- goto cleanup;
+ return ret;
}
for (i = 0; deviceACL[i] != NULL; i++) {
@@ -805,57 +800,54 @@ qemuSetupDevicesCgroup(virDomainObjPtr vm)
virDomainAuditCgroupPath(vm, priv->cgroup, "allow", deviceACL[i], "rw", rv);
if (rv < 0 &&
!virLastErrorIsSystemErrno(ENOENT))
- goto cleanup;
+ return ret;
}
if (virDomainChrDefForeach(vm->def,
true,
qemuSetupChardevCgroupCB,
vm) < 0)
- goto cleanup;
+ return ret;
if (vm->def->tpm && qemuSetupTPMCgroup(vm) < 0)
- goto cleanup;
+ return ret;
for (i = 0; i < vm->def->nhostdevs; i++) {
/* This may allow /dev/vfio/vfio multiple times, but that
* is not a problem. Kernel will have only one record. */
if (qemuSetupHostdevCgroup(vm, vm->def->hostdevs[i]) < 0)
- goto cleanup;
+ return ret;
}
for (i = 0; i < vm->def->nmems; i++) {
if (qemuSetupMemoryDevicesCgroup(vm, vm->def->mems[i]) < 0)
- goto cleanup;
+ return ret;
}
for (i = 0; i < vm->def->ngraphics; i++) {
if (qemuSetupGraphicsCgroup(vm, vm->def->graphics[i]) < 0)
- goto cleanup;
+ return ret;
}
for (i = 0; i < vm->def->nvideos; i++) {
if (qemuSetupVideoCgroup(vm, vm->def->videos[i]) < 0)
- goto cleanup;
+ return ret;
}
for (i = 0; i < vm->def->ninputs; i++) {
if (qemuSetupInputCgroup(vm, vm->def->inputs[i]) < 0)
- goto cleanup;
+ return ret;
}
for (i = 0; i < vm->def->nrngs; i++) {
if (qemuSetupRNGCgroup(vm, vm->def->rngs[i]) < 0)
- goto cleanup;
+ return ret;
}
if (vm->def->sev && qemuSetupSEVCgroup(vm) < 0)
- goto cleanup;
+ return ret;
- ret = 0;
- cleanup:
- virObjectUnref(cfg);
- return ret;
+ return 0;
}
@@ -924,13 +916,13 @@ qemuInitCgroup(virDomainObjPtr vm,
{
int ret = -1;
qemuDomainObjPrivatePtr priv = vm->privateData;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(priv->driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(priv->driver);
if (!virQEMUDriverIsPrivileged(priv->driver))
- goto done;
+ return 0;
if (!virCgroupAvailable())
- goto done;
+ return 0;
virCgroupFree(&priv->cgroup);
@@ -938,7 +930,7 @@ qemuInitCgroup(virDomainObjPtr vm,
virDomainResourceDefPtr res;
if (VIR_ALLOC(res) < 0)
- goto cleanup;
+ return ret;
res->partition = g_strdup("/machine");
@@ -949,7 +941,7 @@ qemuInitCgroup(virDomainObjPtr vm,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Resource partition '%s' must start with '/'"),
vm->def->resource->partition);
- goto cleanup;
+ return ret;
}
if (virCgroupNewMachine(priv->machineName,
@@ -964,16 +956,9 @@ qemuInitCgroup(virDomainObjPtr vm,
cfg->maxThreadsPerProc,
&priv->cgroup) < 0) {
if (virCgroupNewIgnoreError())
- goto done;
-
- goto cleanup;
+ return 0;
}
-
- done:
- ret = 0;
- cleanup:
- virObjectUnref(cfg);
- return ret;
+ return ret;
}
static void
@@ -1058,14 +1043,14 @@ int
qemuConnectCgroup(virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(priv->driver);
+ g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(priv->driver);
int ret = -1;
if (!virQEMUDriverIsPrivileged(priv->driver))
- goto done;
+ return 0;
if (!virCgroupAvailable())
- goto done;
+ return 0;
virCgroupFree(&priv->cgroup);
@@ -1075,14 +1060,9 @@ qemuConnectCgroup(virDomainObjPtr vm)
cfg->cgroupControllers,
priv->machineName,
&priv->cgroup) < 0)
- goto cleanup;
+ return ret;
qemuRestoreCgroupState(vm);
-
- done:
- ret = 0;
- cleanup:
- virObjectUnref(cfg);
return ret;
}
@@ -1269,7 +1249,7 @@ qemuCgroupEmulatorAllNodesAllow(virCgroupPtr cgroup,
qemuCgroupEmulatorAllNodesDataPtr *retData)
{
qemuCgroupEmulatorAllNodesDataPtr data = NULL;
- char *all_nodes_str = NULL;
+ g_autofree char *all_nodes_str = NULL;
virBitmapPtr all_nodes = NULL;
int ret = -1;
@@ -1298,7 +1278,6 @@ qemuCgroupEmulatorAllNodesAllow(virCgroupPtr cgroup,
ret = 0;
cleanup:
- VIR_FREE(all_nodes_str);
virBitmapFree(all_nodes);
qemuCgroupEmulatorAllNodesDataFree(data);
--
1.8.3.1
4 years, 7 months
[PATCH v3 0/3] add support for QEMU 9pfs 'multidevs' option
by Christian Schoenebeck
QEMU 4.2 added a new option 'multidevs' for 9pfs. The following patch adds
support for this new option to libvirt.
In short, what is this about: to distinguish files uniquely from each other
in general, numeric file IDs are typically used for comparison, which in
practice is the combination of a file's device ID and the file's inode
number. Unfortunately 9p protocol's QID field used for this purpose,
currently is too small to fit both the device ID and inode number in, which
hence is a problem if one 9pfs export contains multiple devices and may
thus lead to misbheaviours on guest (e.g. with SAMBA file servers) in that
case due to potential file ID collisions.
To mitigate this problem with 9pfs a 'multidevs' option was introduced in
QEMU 4.2 for defining how to deal with this, e.g. multidevs=remap will cause
QEMU's 9pfs implementation to remap all inodes from host side to different
inode numbers on guest side in a way that prevents file ID collisions.
NOTE: In the libvirt docs changes of this libvirt patch I simply assumed
"since 6.2.0". So the final libvirt version number would need to be adjusted
in that text if necessary.
See QEMU discussion with following Message-ID for details:
8a2ffe17fda3a86b9a5a437e1245276881f1e235.1567680121.git.qemu_oss(a)crudebyte.com
v2->v3:
* Rebased to master (SHA-1 e4bf03b8ff).
* Auto sense QEMU capability for command line option fsdev.multidevs
instead of checking for QEMU version 4.2. [patch 1]
* Auto regenerated capabilities data for all archs (fixes capability
test). [patch 1]
* Added XML test. [patch 2]
* Added argv test. [patch 3]
Message-ID of v2: cover.1584723662.git.qemu_oss(a)crudebyte.com
Christian Schoenebeck (3):
qemu: capabilities: add QEMU_CAPS_VIRTFS_MULTIDEVS
conf: add 'multidevs' option
qemu: add support for 'multidevs' option
docs/formatdomain.html.in | 40 ++++++++++++-
docs/schemas/domaincommon.rng | 10 ++++
src/conf/domain_conf.c | 29 ++++++++++
src/conf/domain_conf.h | 13 +++++
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 7 +++
src/qemu/qemu_domain.c | 12 ++++
.../caps_4.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 +
.../caps_4.2.0.x86_64.xml | 1 +
.../caps_5.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 +
.../caps_5.0.0.x86_64.xml | 1 +
.../virtio-9p-multidevs.x86_64-latest.args | 45 +++++++++++++++
.../qemuxml2argvdata/virtio-9p-multidevs.xml | 53 ++++++++++++++++++
tests/qemuxml2argvtest.c | 2 +
.../virtio-9p-multidevs.x86_64-latest.xml | 56 +++++++++++++++++++
tests/qemuxml2xmltest.c | 2 +
19 files changed, 277 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/virtio-9p-multidevs.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/virtio-9p-multidevs.xml
create mode 100644 tests/qemuxml2xmloutdata/virtio-9p-multidevs.x86_64-latest.xml
--
2.20.1
4 years, 7 months
[libvirt PATCH] fix build by NULL string handling
by Mishal Shah
Fix libvirt build by taking care of NULL string handling
---
src/openvz/openvz_driver.c | 6 +++++-
tests/sockettest.c | 8 ++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 1a189dbbe7..46f117cd00 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -2084,7 +2084,7 @@ openvzDomainMigratePrepare3Params(virConnectPtr dconn,
virDomainDefPtr def = NULL;
virDomainObjPtr vm = NULL;
char *my_hostname = NULL;
- const char *hostname = NULL;
+ char *hostname = NULL;
virURIPtr uri = NULL;
int ret = -1;
@@ -2149,6 +2149,10 @@ openvzDomainMigratePrepare3Params(virConnectPtr dconn,
}
}
+ if (hostname == NULL) {
+ goto error;
+ }
+
*uri_out = g_strdup_printf("ssh://%s", hostname);
ret = 0;
diff --git a/tests/sockettest.c b/tests/sockettest.c
index 29a565de40..f0a0815b88 100644
--- a/tests/sockettest.c
+++ b/tests/sockettest.c
@@ -188,8 +188,12 @@ static int testMaskNetwork(const char *addrstr,
return -1;
if (STRNEQ(networkstr, gotnet)) {
- VIR_FREE(gotnet);
- fprintf(stderr, "Expected %s, got %s\n", networkstr, gotnet);
+ if (gotnet == NULL) {
+ fprintf(stderr, "Expected %s, got empty string\n", networkstr);
+ } else {
+ fprintf(stderr, "Expected %s, got %s\n", networkstr, gotnet);
+ VIR_FREE(gotnet);
+ }
return -1;
}
VIR_FREE(gotnet);
--
2.17.1
4 years, 7 months