[libvirt] [Call for Presentations] FOSDEM 2020 Virtualization & IaaS Devroom
by Kashyap Chamarthy
The FOSDEM open source developer conference is taking place in
Brussels, Belgium on February 1st & 2nd, 2020. The call for
virtualization presentations has been posted[1]. Reposting the text
here (formatted for readability):
-----------------------------------------------------------------------
We are excited to announce that the call for proposals is now open for
the Virtualization & IaaS devroom at the upcoming FOSDEM 2020, to be
hosted on February 1st 2020.
The year 2020 will mark FOSDEM’s 20th anniversary as one of the
longest-running free and open source software developer events,
attracting thousands of developers and users from all over the world.
FOSDEM will be held once again in Brussels, Belgium, on February 1st &
2nd, 2020.
This devroom is a collaborative effort, and is organized by dedicated
folks from projects such as OpenStack, Xen Project, oVirt, QEMU, KVM,
libvirt, Foreman, and virtualization-related projects. We would like to
invite all those who are involved in these fields to submit your
proposals by December 1st, 2019.
Important Dates
---------------
- Submission deadline: 1 December 2019
- Acceptance notifications: 10 December 2019
- Final schedule announcement: 15th December 2019
- Devroom is only on one day: 1st February 2020
About the Devroom
-----------------
The Virtualization & IaaS devroom will feature session topics such as open
source hypervisors and virtual machine managers such as Xen Project,
KVM, QEMU, bhyve, and VirtualBox, and Infrastructure-as-a-Service
projects such as KubeVirt, Apache CloudStack, OpenStack, oVirt, QEMU and
OpenNebula.
This devroom will host presentations that focus on topics of shared
interest, such as KVM; QEMU; libvirt; shared storage; virtualized
networking; cloud security; clustering and high availability;
interfacing with multiple hypervisors; hyperconverged deployments; and
scaling across hundreds or thousands of servers.
Presentations in this devroom will be aimed at developers working on
these platforms who are looking to collaborate and improve shared
infrastructure or solve common problems. We seek topics that encourage
dialog between projects and continued work post-FOSDEM.
Submit Your Proposal
--------------------
All submissions must be made via the Pentabarf event planning site[1]. If
you have not used Pentabarf before, you will need to create an account. If
you submitted proposals for FOSDEM in previous years, you can use your
existing account.
After creating the account, select Create Event to start the submission
process. Make sure to select Virtualization and IaaS devroom from the Track
list. Please fill out all the required fields, and provide a meaningful
abstract and description of your proposed session.
Submission Guidelines
---------------------
We expect more proposals than we can possibly accept, so it is vitally
important that you submit your proposal on or before the deadline. Late
submissions are unlikely to be considered.
All presentation slots are 30 minutes, with 20 minutes planned for
presentations, and 10 minutes for Q&A.
All presentations will be recorded and made available under Creative
Commons licenses. In the Submission notes field, please indicate that you
agree that your presentation will be licensed under the CC-By-SA-4.0 or
CC-By-4.0 license and that you agree to have your presentation recorded.
For example:
"If my presentation is accepted for FOSDEM, I hereby agree to license all
recordings, slides, and other associated materials under the Creative
Commons Attribution Share-Alike 4.0 International License. Sincerely,
<NAME>."
In the Submission notes field, please also confirm that if your talk is
accepted, you will be able to attend FOSDEM and deliver your presentation.
We will not consider proposals from prospective speakers who are unsure
whether they will be able to secure funds for travel and lodging to attend
FOSDEM. (Sadly, we are not able to offer travel funding for prospective
speakers.)
Speaker Mentoring Program
-------------------------
As a part of the rising efforts to grow our communities and encourage a
diverse and inclusive conference ecosystem, we're happy to announce that
we'll be offering mentoring for new speakers. Our mentors can help you
with tasks such as reviewing your abstract, reviewing your presentation
outline or slides, or practicing your talk with you.
You may apply to the mentoring program as a newcomer speaker if you:
Never presented before or
Presented only lightning talks or
Presented full-length talks at small meetups (<50 ppl)
Mentored presentations will have 25-minute slots, where 20 minutes will
include the presentation and 5 minutes will be reserved for questions.
The number of newcomer session slots is limited, so we will probably not be
able to accept all applications.
You must submit your talk and abstract to apply for the mentoring program,
our mentors are volunteering their time and will happily provide feedback
but won't write your presentation for you!
If you are experiencing problems with Pentabarf, the proposal submission
interface, or have other questions, you can email our devroom mailing
list[2] and we will try to help you.
How to Apply
------------
In addition to agreeing to video recording and confirming that you can
attend FOSDEM in case your session is accepted, please write "speaker
mentoring program application" in the "Submission notes" field, and list
any prior speaking experience or other relevant information for your
application.
Code of Conduct
---------------
Following the release of the updated code of conduct for FOSDEM, we'd
like to remind all speakers and attendees that all of the presentations
and discussions in our devroom are held under the guidelines set in the
CoC and we expect attendees, speakers, and volunteers to follow the CoC
at all times.
If you submit a proposal and it is accepted, you will be required to
confirm that you accept the FOSDEM CoC. If you have any questions about
the CoC or wish to have one of the devroom organizers review your
presentation slides or any other content for CoC compliance, please
email us and we will do our best to assist you.
Call for Volunteers
-------------------
We are also looking for volunteers to help run the devroom. We need
assistance watching time for the speakers, and helping with video for
the devroom. Please contact devroom mailing list [2] for more
information.
Questions?
----------
If you have any questions about this devroom, please send your questions
to our devroom mailing list. You can also subscribe to the list to
receive updates about important dates, session announcements, and to
connect with other attendees.
See you all at FOSDEM!
-----------------------------------------------------------------------
[1] https://lists.fosdem.org/pipermail/fosdem/2019q4/002889.html
--
/kashyap
5 years, 2 months
[libvirt] [RFC] Accepting PRs/MRs for libvirt on GitHub/GitLab
by Andrea Bolognani
As we look to make the libvirt project easier to contribute to, one
fact that certainly comes to mind is that we only accept patches via
the mailing list. While the core developers are comfortable with the
email-based workflow and swear by it, many perspective contributors
are used to the PR/MR workflow common to many Open Source projects
these days, and similarly swear by it.
If we look at the PRs submitted on GitHub against the libvirt mirror
repository[1], there's just three of them per year on average, which
is arguably not a lot; however, it should be noted that each
repository also carries a fairly loud "PULL REQUESTS ARE IGNORED"
message right at the top, and it's not unlikely that a number of
perspective contributors simply lost interest after seeing it.
As a way to make contributions easier without forcing core developers
to give up their current workflow or making the project dependent on
a third-party provider, I suggest we adopt a hybrid approach.
First of all, we'd remove the ominous message from GitHub mirror
repositories (interestingly, the same is not present on GitLab).
Then, we'd starting accepting PRs/MRs. The way we'd handle them is
that, when one comes in, one among the handful of core developers who
volunteered to do so would review the patches on the respective
platform, working with the submitter to get it into shape just like
they would do on the mailing list; once the series is finally ready
to be merged, the core developer would update the PR/MR as necessary,
for example picking up R-bs or fixing the kind of trivial issues that
usually don't warrant a repost, and then push to master as usual.
More in detail: GitHub and GitLab have a feature that allows project
members to update PRs/MRs: basically the way it works is that, if the
PR/MR was created by the user 'foo' from their branch 'bar', the
libvirt developer is allowed to (force-)push to the foo/libvirt/bar
branch, and doing so updates the corresponding PR/MR; after that, if
the updated branch is locally merged into master and master is pushed
to the libvirt.org repo, once it gets mirrored GitHub/GitLab will
recognize that the commit IDs match and automatically mark the PR/MR
as merged. I have tested this behavior on both platforms (minus the
mirroring part) with Martin's help.
One last important bit. In the spirit of not requiring core
developers to alter their workflow, the developer who reviewed the
patches on GitHub/GitLab will also be responsible to format them to
the mailing list after merging them: this way, even those who don't
have a GitHub/GitLab account will get a chance to take notice of the
code changes and weigh in. Unlike what we're used to, this feedback
will come after the fact, but assuming that issues are spotted only
at that point we can either push the relevant fixes as follow-up
commits or even revert the series outright, so I don't feel like it
would be a massive problem overall.
Thoughts?
[1] https://github.com/libvirt/libvirt/pulls?q=is:pr+is:closed
--
Andrea Bolognani / Red Hat / Virtualization
5 years, 2 months
[libvirt] [PATCH 0/2] gitdm: Update configuration
by Andrea Bolognani
Andrea Bolognani (2):
gitdm: Fix sorting
gitdm: Add missing entries
docs/gitdm/companies/others | 4 +++-
docs/gitdm/groups/unaffiliated | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
--
2.21.0
5 years, 2 months
[libvirt] [PATCH v1] qemu_driver: improve comparison/baseline error reporting
by Collin Walling
Providing an erroneous CPU definition in the XML file provided to the
hypervisor-cpu-compare/baseline command will result in a verbose
internal error. Let's add some sanity checking before executing the QMP
commands to provide a cleaner message if something is wrong with the
CPU model or features.
An internal error will still appear for other messages originating from
QEMU e.g. if a newer feature is not available for an older CPU model.
Signed-off-by: Collin Walling <walling(a)linux.ibm.com>
---
src/qemu/qemu_driver.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2e422b5..a4f916b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13645,6 +13645,52 @@ qemuConnectCompareCPU(virConnectPtr conn,
}
+static int
+qemuConnectCheckCPUModel(qemuMonitorPtr mon,
+ virCPUDefPtr cpu)
+{
+ qemuMonitorCPUModelInfoPtr modelInfo = NULL;
+ qemuMonitorCPUModelExpansionType type;
+ size_t i, j;
+ int ret = -1;
+
+ /* Collect CPU model name and features known by QEMU */
+ type = QEMU_MONITOR_CPU_MODEL_EXPANSION_FULL;
+ if (qemuMonitorGetCPUModelExpansion(mon, type, cpu, true,
+ false, &modelInfo) < 0)
+ goto cleanup;
+
+ /* Sanity check CPU model */
+ if (!modelInfo) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unknown CPU model: %s"), cpu->model);
+ goto cleanup;
+ }
+
+ /* Sanity check CPU features */
+ for (i = 0; i < cpu->nfeatures; i++) {
+ const char *feat = cpu->features[i].name;
+
+ for (j = 0; j < modelInfo->nprops; j++) {
+ const char *prop = modelInfo->props[j].name;
+ if (STREQ(feat, prop))
+ break;
+ }
+
+ if (j == modelInfo->nprops) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unknown CPU feature: %s"), feat);
+ goto cleanup;
+ }
+ }
+ ret = 0;
+
+ cleanup:
+ qemuMonitorCPUModelInfoFree(modelInfo);
+ return ret;
+}
+
+
static virCPUCompareResult
qemuConnectCPUModelComparison(virQEMUCapsPtr qemuCaps,
const char *libDir,
@@ -13665,6 +13711,11 @@ qemuConnectCPUModelComparison(virQEMUCapsPtr qemuCaps,
if (qemuProcessQMPStart(proc) < 0)
goto cleanup;
+ if (qemuConnectCheckCPUModel(proc->mon, cpu_a) < 0 ||
+ qemuConnectCheckCPUModel(proc->mon, cpu_b) < 0) {
+ goto cleanup;
+ }
+
if (qemuMonitorGetCPUModelComparison(proc->mon, cpu_a, cpu_b, &result) < 0)
goto cleanup;
@@ -13863,6 +13914,9 @@ qemuConnectCPUModelBaseline(virQEMUCapsPtr qemuCaps,
if (qemuProcessQMPStart(proc) < 0)
goto cleanup;
+ if (qemuConnectCheckCPUModel(proc->mon, cpus[0]) < 0)
+ goto cleanup;
+
if (VIR_ALLOC(baseline) < 0)
goto cleanup;
@@ -13870,6 +13924,9 @@ qemuConnectCPUModelBaseline(virQEMUCapsPtr qemuCaps,
goto cleanup;
for (i = 1; i < ncpus; i++) {
+ if (qemuConnectCheckCPUModel(proc->mon, cpus[i]) < 0)
+ goto cleanup;
+
if (qemuMonitorGetCPUModelBaseline(proc->mon, baseline,
cpus[i], &result) < 0)
goto cleanup;
--
2.7.4
5 years, 2 months
[libvirt] [PATCH 1/1] qemu_hotplug: use VIR_AUTOUNREF() with virConnectPtr
by Daniel Henrique Barboza
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
Checked other pointer types that can be autounref as well,
just found these instances.
src/qemu/qemu_hotplug.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index e9285f0964..4cab132901 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1154,7 +1154,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
bool charDevPlugged = false;
bool netdevPlugged = false;
VIR_AUTOFREE(char *) netdev_name = NULL;
- virConnectPtr conn = NULL;
+ VIR_AUTOUNREF(virConnectPtr) conn = NULL;
virErrorPtr save_err = NULL;
/* preallocate new slot for device */
@@ -1497,7 +1497,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
}
VIR_FREE(vhostfd);
VIR_FREE(vhostfdName);
- virObjectUnref(conn);
virDomainCCWAddressSetFree(ccwaddrs);
VIR_FORCE_CLOSE(slirpfd);
@@ -3475,7 +3474,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
bool needVlanUpdate = false;
int ret = -1;
int changeidx = -1;
- virConnectPtr conn = NULL;
+ VIR_AUTOUNREF(virConnectPtr) conn = NULL;
virErrorPtr save_err = NULL;
if ((changeidx = virDomainNetFindIdx(vm->def, newdev)) < 0)
@@ -3919,7 +3918,6 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
*/
if (newdev && newdev->type == VIR_DOMAIN_NET_TYPE_NETWORK && conn)
virDomainNetReleaseActualDevice(conn, vm->def, newdev);
- virObjectUnref(conn);
virErrorRestore(&save_err);
return ret;
@@ -4535,13 +4533,11 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
if (net) {
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
- virConnectPtr conn = virGetConnectNetwork();
- if (conn) {
+ VIR_AUTOUNREF(virConnectPtr) conn = virGetConnectNetwork();
+ if (conn)
virDomainNetReleaseActualDevice(conn, vm->def, net);
- virObjectUnref(conn);
- } else {
+ else
VIR_WARN("Unable to release network device '%s'", NULLSTR(net->ifname));
- }
}
virDomainNetDefFree(net);
}
@@ -4641,13 +4637,11 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
qemuDomainNetDeviceVportRemove(net);
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
- virConnectPtr conn = virGetConnectNetwork();
- if (conn) {
+ VIR_AUTOUNREF(virConnectPtr) conn = virGetConnectNetwork();
+ if (conn)
virDomainNetReleaseActualDevice(conn, vm->def, net);
- virObjectUnref(conn);
- } else {
+ else
VIR_WARN("Unable to release network device '%s'", NULLSTR(net->ifname));
- }
}
virDomainNetDefFree(net);
return 0;
--
2.21.0
5 years, 2 months
[libvirt] [PATCH 00/30] storagefile, security: qcow2 data_file support
by Cole Robinson
This series is the first steps to teaching libvirt about qcow2
data_file support, aka external data files or qcow2 external metadata.
A bit about the feature: it was added in qemu 4.0. It essentially
creates a two part image file: a qcow2 layer that just tracks the
image metadata, and a separate data file which is stores the VM
disk contents. AFAICT the driving use case is to keep a fully coherent
raw disk image on disk, and only use qcow2 as an intermediate metadata
layer when necessary, for things like incremental backup support.
The original qemu patch posting is here:
https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg07496.html
For testing, you can create a new qcow2+raw data_file image from an
existing image, like:
qemu-img convert -O qcow2 \
-o data_file=NEW.raw,data_file_raw=yes
EXISTING.raw NEW.qcow2
The goal of this series is to teach libvirt enough about this case
so that we can correctly relabel the data_file on VM startup/shutdown.
The main functional changes are
* Teach storagefile how to parse out data_file from the qcow2 header
* Store the raw string as virStorageSource->externalDataStoreRaw
* Track that as its out virStorageSource in externalDataStore
* dac/selinux relabel externalDataStore as needed
>From libvirt's perspective, externalDataStore is conceptually pretty
close to a backingStore, but the main difference is its read/write
permissions should match its parent image, rather than being readonly
like backingStore.
This series has only been tested on top of the -blockdev enablement
series, but I don't think it actually interacts with that work at
the moment.
Future work:
* Exposing this in the runtime XML. We need to figure out an XML
schema. It will reuse virStorageSource obviously, but the main
thing to figure out is probably 1) what the top element name
should be ('dataFile' maybe?), 2) where it sits in the XML
hierarchy (under <disk> or under <source> I guess)
* Exposing this on the qemu -blockdev command line. Similar to how
in the blockdev world we are explicitly putting the disk backing
chain on the command line, we can do that for data_file too. Then
like persistent <backingStore> XML the user will have the power
to overwrite the data_file location for an individual VM run.
* Figure out how we expect ovirt/rhev to be using this at runtime.
Possibly taking a running VM using a raw image, doing blockdev-*
magic to pivot it to qcow2+raw data_file, so it can initiate
incremental backup on top of a previously raw only VM?
Known issues:
* In the qemu driver, the qcow2 image metadata is only parsed
in -blockdev world if no <backingStore> is specified in the
persistent XML. So basically if there's a <backingStore> listed,
we never parse the qcow2 header and detect the presence of
data_file. Fixable I'm sure but I didn't look into it much yet.
Most of this is cleanups and refactorings to simplify the actual
functional changes.
Cole Robinson (30):
storagefile: Make GetMetadataInternal static
storagefile: qcow1: Check for BACKING_STORE_OK
storagefile: qcow1: Fix check for empty backing file
storagefile: qcow1: Let qcowXGetBackingStore fill in format
storagefile: Check version to determine if qcow2 or not
storagefile: Drop now unused isQCow2 argument
storagefile: Use qcowXGetBackingStore directly
storagefile: Push 'start' into qcow2GetBackingStoreFormat
storagefile: Push extension_end calc to qcow2GetBackingStoreFormat
storagefile: Rename qcow2GetBackingStoreFormat
storagefile: Rename qcow2GetExtensions 'format' argument
storagefile: Fix backing format \0 check
storagefile: Add externalDataStoreRaw member
storagefile: Parse qcow2 external data file
storagefile: Fill in meta->externalDataStoreRaw
storagefile: Don't access backingStoreRaw directly in
FromBackingRelative
storagefile: Split out virStorageSourceNewFromChild
storagefile: Add externalDataStore member
storagefile: Fill in meta->externalDataStore
security: dac: Drop !parent handling in SetImageLabelInternal
security: dac: Add is_toplevel to SetImageLabelInternal
security: dac: Restore image label for externalDataStore
security: dac: break out SetImageLabelRelative
security: dac: Label externalDataStore
security: selinux: Simplify SetImageLabelInternal
security: selinux: Drop !parent handling in SetImageLabelInternal
security: selinux: Add is_toplevel to SetImageLabelInternal
security: selinux: Restore image label for externalDataStore
security: selinux: break out SetImageLabelRelative
security: selinux: Label externalDataStore
src/libvirt_private.syms | 1 -
src/security/security_dac.c | 63 +++++--
src/security/security_selinux.c | 97 +++++++----
src/util/virstoragefile.c | 281 ++++++++++++++++++++------------
src/util/virstoragefile.h | 11 +-
5 files changed, 290 insertions(+), 163 deletions(-)
--
2.23.0
5 years, 2 months
[libvirt] [PATCH 0/2] Fix build with musl libc
by casantos@redhat.com
From: Carlos Santos <casantos(a)redhat.com>
- Do not use 'stderr' as a field name, since it's a preprocessor macro
in stdio.h.
- Include paths.h for _PATH_MOUNTED, if it's not defined in mntent.h.
Found while porting libvirt to Buildroot (https://buildroot.org/).
Carlos Santos (2):
qemu: fix build with musl libc
storage: fix build with musl libc
src/qemu/qemu_process.c | 8 ++++----
src/qemu/qemu_process.h | 2 +-
src/storage/storage_backend_fs.c | 3 +++
src/storage/storage_backend_vstorage.c | 3 +++
4 files changed, 11 insertions(+), 5 deletions(-)
--
2.18.1
5 years, 2 months
[libvirt] [PATCH 0/3] docs: hacking: document removed macro replacements (glib chronicles)
by Ján Tomko
Make the GLib section more readable.
Ján Tomko (3):
docs: hacking: separate section about already deleted macros
docs: hacking: use <code> for functions/names
docs: hacking: add a conversion table for removed libvirt macros
docs/hacking.html.in | 71 +++++++++++++++++++++++++++++---------------
1 file changed, 47 insertions(+), 24 deletions(-)
--
2.21.0
5 years, 2 months
[libvirt] [PATCH] Drop needless @ret variable
by Michal Privoznik
In few places we have the following code pattern:
int ret;
... /* @ret is not accessed here */
ret = f(...);
return ret;
This pattern can be written less verbose:
...
return f(...);
This patch was generated with following coccinelle spatch:
@@
type T;
constant C;
expression f;
identifier ret;
@@
-T ret = C;
... when != ret
-ret = f;
-return ret;
+return f;
Afterwards I needed to fix a few places, e.g. comment in
virDomainNetIPParseXML() was removed too because coccinelle
thinks it refers to @ret while in fact it doesn't. Also in few
places it replaced @ret declaration with a few spaces instead of
removing the line. But nothing terribly wrong.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/bhyve/bhyve_driver.c | 38 +++++++++---------------
src/conf/checkpoint_conf.c | 5 +---
src/conf/domain_conf.c | 4 +--
src/conf/snapshot_conf.c | 5 +---
src/conf/storage_conf.c | 9 ++----
src/conf/virnwfilterbindingobj.c | 5 +---
src/libvirt-stream.c | 7 ++---
src/libxl/libxl_driver.c | 36 ++++++++---------------
src/lxc/lxc_driver.c | 36 ++++++++---------------
src/lxc/lxc_native.c | 5 +---
src/network/bridge_driver.c | 38 +++++++-----------------
src/nwfilter/nwfilter_driver.c | 10 ++-----
src/phyp/phyp_driver.c | 5 +---
src/qemu/qemu_command.c | 14 ++++-----
src/qemu/qemu_driver.c | 14 +++------
src/qemu/qemu_process.c | 16 ++++------
src/remote/remote_daemon_dispatch.c | 5 +---
src/storage/storage_backend_iscsi.c | 5 +---
src/test/test_driver.c | 28 +++++-------------
src/util/vircgroupv1.c | 6 +---
src/util/vircgroupv2.c | 6 +---
src/util/virdbus.c | 5 +---
src/vbox/vbox_storage.c | 18 ++++--------
src/vz/vz_driver.c | 45 ++++++++++-------------------
tools/virsh-completer-domain.c | 4 +--
tools/virsh-completer-nodedev.c | 4 +--
tools/virsh-completer-pool.c | 4 +--
tools/virsh-completer-secret.c | 4 +--
tools/virsh-network.c | 5 +---
tools/vsh.c | 5 +---
30 files changed, 115 insertions(+), 276 deletions(-)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 52e1895052..2e4f03d841 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -630,30 +630,24 @@ static int
bhyveConnectListDomains(virConnectPtr conn, int *ids, int maxids)
{
bhyveConnPtr privconn = conn->privateData;
- int n;
if (virConnectListDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListGetActiveIDs(privconn->domains, ids, maxids,
- virConnectListDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListGetActiveIDs(privconn->domains, ids, maxids,
+ virConnectListDomainsCheckACL, conn);
}
static int
bhyveConnectNumOfDomains(virConnectPtr conn)
{
bhyveConnPtr privconn = conn->privateData;
- int count;
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
return -1;
- count = virDomainObjListNumOfDomains(privconn->domains, true,
- virConnectNumOfDomainsCheckACL, conn);
-
- return count;
+ return virDomainObjListNumOfDomains(privconn->domains, true,
+ virConnectNumOfDomainsCheckACL, conn);
}
static int
@@ -661,31 +655,28 @@ bhyveConnectListDefinedDomains(virConnectPtr conn, char **const names,
int maxnames)
{
bhyveConnPtr privconn = conn->privateData;
- int n;
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
return -1;
memset(names, 0, sizeof(*names) * maxnames);
- n = virDomainObjListGetInactiveNames(privconn->domains, names,
- maxnames, virConnectListDefinedDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListGetInactiveNames(privconn->domains, names,
+ maxnames,
+ virConnectListDefinedDomainsCheckACL,
+ conn);
}
static int
bhyveConnectNumOfDefinedDomains(virConnectPtr conn)
{
bhyveConnPtr privconn = conn->privateData;
- int count;
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
return -1;
- count = virDomainObjListNumOfDomains(privconn->domains, false,
- virConnectNumOfDefinedDomainsCheckACL, conn);
-
- return count;
+ return virDomainObjListNumOfDomains(privconn->domains, false,
+ virConnectNumOfDefinedDomainsCheckACL,
+ conn);
}
static char *
@@ -771,17 +762,14 @@ bhyveConnectListAllDomains(virConnectPtr conn,
unsigned int flags)
{
bhyveConnPtr privconn = conn->privateData;
- int ret = -1;
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
if (virConnectListAllDomainsEnsureACL(conn) < 0)
return -1;
- ret = virDomainObjListExport(privconn->domains, conn, domains,
- virConnectListAllDomainsCheckACL, flags);
-
- return ret;
+ return virDomainObjListExport(privconn->domains, conn, domains,
+ virConnectListAllDomainsCheckACL, flags);
}
static virDomainPtr
diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c
index b254dce7fd..586528a974 100644
--- a/src/conf/checkpoint_conf.c
+++ b/src/conf/checkpoint_conf.c
@@ -73,13 +73,10 @@ virDomainCheckpointDiskDefClear(virDomainCheckpointDiskDefPtr disk)
virDomainCheckpointDefPtr
virDomainCheckpointDefNew(void)
{
- virDomainCheckpointDefPtr def;
-
if (virDomainCheckpointInitialize() < 0)
return NULL;
- def = virObjectNew(virDomainCheckpointDefClass);
- return def;
+ return virObjectNew(virDomainCheckpointDefClass);
}
static void
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2e6a113de3..d1c2ad5484 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8306,7 +8306,6 @@ static virNetDevIPAddrPtr
virDomainNetIPParseXML(xmlNodePtr node)
{
/* Parse the prefix in every case */
- virNetDevIPAddrPtr ret = NULL;
unsigned int prefixValue = 0;
int family = AF_UNSPEC;
g_autofree virNetDevIPAddrPtr ip = NULL;
@@ -8358,8 +8357,7 @@ virDomainNetIPParseXML(xmlNodePtr node)
return NULL;
}
- ret = g_steal_pointer(&ip);
- return ret;
+ return g_steal_pointer(&ip);
}
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 0e9d307321..1992cc1b08 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -113,13 +113,10 @@ virDomainSnapshotDiskDefFree(virDomainSnapshotDiskDefPtr disk)
virDomainSnapshotDefPtr
virDomainSnapshotDefNew(void)
{
- virDomainSnapshotDefPtr def;
-
if (virDomainSnapshotInitialize() < 0)
return NULL;
- def = virObjectNew(virDomainSnapshotDefClass);
- return def;
+ return virObjectNew(virDomainSnapshotDefClass);
}
static void
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 9e4978b560..c115729ec7 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1692,14 +1692,11 @@ virStoragePoolSaveXML(const char *path,
const char *xml)
{
char uuidstr[VIR_UUID_STRING_BUFLEN];
- int ret = -1;
virUUIDFormat(def->uuid, uuidstr);
- ret = virXMLSaveFile(path,
- virXMLPickShellSafeComment(def->name, uuidstr),
- "pool-edit", xml);
-
- return ret;
+ return virXMLSaveFile(path,
+ virXMLPickShellSafeComment(def->name, uuidstr),
+ "pool-edit", xml);
}
diff --git a/src/conf/virnwfilterbindingobj.c b/src/conf/virnwfilterbindingobj.c
index 48d53fafb1..24aafa99c3 100644
--- a/src/conf/virnwfilterbindingobj.c
+++ b/src/conf/virnwfilterbindingobj.c
@@ -91,10 +91,7 @@ virNWFilterBindingObjSetDef(virNWFilterBindingObjPtr obj,
virNWFilterBindingDefPtr
virNWFilterBindingObjStealDef(virNWFilterBindingObjPtr obj)
{
- virNWFilterBindingDefPtr def;
-
- def = g_steal_pointer(&obj->def);
- return def;
+ return g_steal_pointer(&obj->def);
}
diff --git a/src/libvirt-stream.c b/src/libvirt-stream.c
index fb646d0aef..6f6bb5df0b 100644
--- a/src/libvirt-stream.c
+++ b/src/libvirt-stream.c
@@ -520,11 +520,8 @@ virStreamInData(virStreamPtr stream,
virCheckNonNullArgReturn(data, -1);
virCheckNonNullArgReturn(length, -1);
- if (stream->driver->streamInData) {
- int ret;
- ret = (stream->driver->streamInData)(stream, data, length);
- return ret;
- }
+ if (stream->driver->streamInData)
+ return (stream->driver->streamInData)(stream, data, length);
virReportUnsupportedError();
return -1;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 64b21f2073..a1c752c25b 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1009,30 +1009,24 @@ static int
libxlConnectListDomains(virConnectPtr conn, int *ids, int nids)
{
libxlDriverPrivatePtr driver = conn->privateData;
- int n;
if (virConnectListDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListGetActiveIDs(driver->domains, ids, nids,
- virConnectListDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListGetActiveIDs(driver->domains, ids, nids,
+ virConnectListDomainsCheckACL, conn);
}
static int
libxlConnectNumOfDomains(virConnectPtr conn)
{
libxlDriverPrivatePtr driver = conn->privateData;
- int n;
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListNumOfDomains(driver->domains, true,
- virConnectNumOfDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListNumOfDomains(driver->domains, true,
+ virConnectNumOfDomainsCheckACL, conn);
}
static virDomainPtr
@@ -2777,29 +2771,26 @@ libxlConnectListDefinedDomains(virConnectPtr conn,
char **const names, int nnames)
{
libxlDriverPrivatePtr driver = conn->privateData;
- int n;
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListGetInactiveNames(driver->domains, names, nnames,
- virConnectListDefinedDomainsCheckACL, conn);
- return n;
+ return virDomainObjListGetInactiveNames(driver->domains, names, nnames,
+ virConnectListDefinedDomainsCheckACL,
+ conn);
}
static int
libxlConnectNumOfDefinedDomains(virConnectPtr conn)
{
libxlDriverPrivatePtr driver = conn->privateData;
- int n;
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListNumOfDomains(driver->domains, false,
- virConnectNumOfDefinedDomainsCheckACL,
- conn);
- return n;
+ return virDomainObjListNumOfDomains(driver->domains, false,
+ virConnectNumOfDefinedDomainsCheckACL,
+ conn);
}
static int
@@ -5717,17 +5708,14 @@ libxlConnectListAllDomains(virConnectPtr conn,
unsigned int flags)
{
libxlDriverPrivatePtr driver = conn->privateData;
- int ret = -1;
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
if (virConnectListAllDomainsEnsureACL(conn) < 0)
return -1;
- ret = virDomainObjListExport(driver->domains, conn, domains,
- virConnectListAllDomainsCheckACL, flags);
-
- return ret;
+ return virDomainObjListExport(driver->domains, conn, domains,
+ virConnectListAllDomainsCheckACL, flags);
}
/* Which features are supported by this driver? */
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 204a3ed522..4edbe6e299 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -347,59 +347,49 @@ static int lxcDomainIsUpdated(virDomainPtr dom)
static int lxcConnectListDomains(virConnectPtr conn, int *ids, int nids)
{
virLXCDriverPtr driver = conn->privateData;
- int n;
if (virConnectListDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListGetActiveIDs(driver->domains, ids, nids,
- virConnectListDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListGetActiveIDs(driver->domains, ids, nids,
+ virConnectListDomainsCheckACL, conn);
}
static int lxcConnectNumOfDomains(virConnectPtr conn)
{
virLXCDriverPtr driver = conn->privateData;
- int n;
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListNumOfDomains(driver->domains, true,
- virConnectNumOfDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListNumOfDomains(driver->domains, true,
+ virConnectNumOfDomainsCheckACL, conn);
}
static int lxcConnectListDefinedDomains(virConnectPtr conn,
char **const names, int nnames)
{
virLXCDriverPtr driver = conn->privateData;
- int n;
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListGetInactiveNames(driver->domains, names, nnames,
- virConnectListDefinedDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListGetInactiveNames(driver->domains, names, nnames,
+ virConnectListDefinedDomainsCheckACL,
+ conn);
}
static int lxcConnectNumOfDefinedDomains(virConnectPtr conn)
{
virLXCDriverPtr driver = conn->privateData;
- int n;
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListNumOfDomains(driver->domains, false,
- virConnectNumOfDefinedDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListNumOfDomains(driver->domains, false,
+ virConnectNumOfDefinedDomainsCheckACL,
+ conn);
}
@@ -3254,16 +3244,14 @@ lxcConnectListAllDomains(virConnectPtr conn,
unsigned int flags)
{
virLXCDriverPtr driver = conn->privateData;
- int ret = -1;
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
if (virConnectListAllDomainsEnsureACL(conn) < 0)
return -1;
- ret = virDomainObjListExport(driver->domains, conn, domains,
- virConnectListAllDomainsCheckACL, flags);
- return ret;
+ return virDomainObjListExport(driver->domains, conn, domains,
+ virConnectListAllDomainsCheckACL, flags);
}
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index 8ae3c7b006..3ac5e34ee1 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -718,7 +718,6 @@ static int
lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties)
{
int status;
- int result = -1;
size_t i;
lxcNetworkParseData data = {def, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, 0,
@@ -742,9 +741,7 @@ lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties)
/* When no network type is provided LXC only adds loopback */
def->features[VIR_DOMAIN_FEATURE_PRIVNET] = VIR_TRISTATE_SWITCH_ON;
}
- result = 0;
-
- return result;
+ return 0;
error:
for (i = 0; i < data.nips; i++)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 6862818698..e6881965c1 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3136,17 +3136,13 @@ static int
networkConnectNumOfNetworks(virConnectPtr conn)
{
virNetworkDriverStatePtr driver = networkGetDriver();
- int nactive;
if (virConnectNumOfNetworksEnsureACL(conn) < 0)
return -1;
- nactive = virNetworkObjListNumOfNetworks(driver->networks,
- true,
- virConnectNumOfNetworksCheckACL,
- conn);
-
- return nactive;
+ return virNetworkObjListNumOfNetworks(driver->networks, true,
+ virConnectNumOfNetworksCheckACL,
+ conn);
}
@@ -3156,17 +3152,12 @@ networkConnectListNetworks(virConnectPtr conn,
int maxnames)
{
virNetworkDriverStatePtr driver = networkGetDriver();
- int got = 0;
if (virConnectListNetworksEnsureACL(conn) < 0)
return -1;
- got = virNetworkObjListGetNames(driver->networks,
- true, names, maxnames,
- virConnectListNetworksCheckACL,
- conn);
-
- return got;
+ return virNetworkObjListGetNames(driver->networks, true, names, maxnames,
+ virConnectListNetworksCheckACL, conn);
}
@@ -3174,17 +3165,13 @@ static int
networkConnectNumOfDefinedNetworks(virConnectPtr conn)
{
virNetworkDriverStatePtr driver = networkGetDriver();
- int ninactive = 0;
if (virConnectNumOfDefinedNetworksEnsureACL(conn) < 0)
return -1;
- ninactive = virNetworkObjListNumOfNetworks(driver->networks,
- false,
- virConnectNumOfDefinedNetworksCheckACL,
- conn);
-
- return ninactive;
+ return virNetworkObjListNumOfNetworks(driver->networks, false,
+ virConnectNumOfDefinedNetworksCheckACL,
+ conn);
}
@@ -3194,16 +3181,13 @@ networkConnectListDefinedNetworks(virConnectPtr conn,
int maxnames)
{
virNetworkDriverStatePtr driver = networkGetDriver();
- int got = 0;
if (virConnectListDefinedNetworksEnsureACL(conn) < 0)
return -1;
- got = virNetworkObjListGetNames(driver->networks,
- false, names, maxnames,
- virConnectListDefinedNetworksCheckACL,
- conn);
- return got;
+ return virNetworkObjListGetNames(driver->networks, false, names, maxnames,
+ virConnectListDefinedNetworksCheckACL,
+ conn);
}
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index fbdf250934..2e906555b9 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -707,19 +707,13 @@ nwfilterConnectListAllNWFilterBindings(virConnectPtr conn,
virNWFilterBindingPtr **bindings,
unsigned int flags)
{
- int ret;
-
virCheckFlags(0, -1);
if (virConnectListAllNWFilterBindingsEnsureACL(conn) < 0)
return -1;
- ret = virNWFilterBindingObjListExport(driver->bindings,
- conn,
- bindings,
- virConnectListAllNWFilterBindingsCheckACL);
-
- return ret;
+ return virNWFilterBindingObjListExport(driver->bindings, conn, bindings,
+ virConnectListAllNWFilterBindingsCheckACL);
}
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 4527adc670..67193d6359 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -3174,7 +3174,6 @@ phypDomainLookupByName(virConnectPtr conn, const char *lpar_name)
{
phyp_driverPtr phyp_driver = conn->privateData;
LIBSSH2_SESSION *session = phyp_driver->session;
- virDomainPtr dom = NULL;
int lpar_id = 0;
char *managed_system = phyp_driver->managed_system;
unsigned char lpar_uuid[VIR_UUID_BUFLEN];
@@ -3186,9 +3185,7 @@ phypDomainLookupByName(virConnectPtr conn, const char *lpar_name)
if (phypGetLparUUID(lpar_uuid, lpar_id, conn) == -1)
return NULL;
- dom = virGetDomain(conn, lpar_name, lpar_uuid, lpar_id);
-
- return dom;
+ return virGetDomain(conn, lpar_name, lpar_uuid, lpar_id);
}
static virDomainPtr
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e98195b1d7..6886a07154 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -697,20 +697,16 @@ int
qemuBuildSecretInfoProps(qemuDomainSecretInfoPtr secinfo,
virJSONValuePtr *propsret)
{
- int ret = -1;
g_autofree char *keyid = NULL;
if (!(keyid = qemuDomainGetMasterKeyAlias()))
return -1;
- ret = qemuMonitorCreateObjectProps(propsret,
- "secret", secinfo->s.aes.alias,
- "s:data", secinfo->s.aes.ciphertext,
- "s:keyid", keyid,
- "s:iv", secinfo->s.aes.iv,
- "s:format", "base64", NULL);
-
- return ret;
+ return qemuMonitorCreateObjectProps(propsret, "secret",
+ secinfo->s.aes.alias, "s:data",
+ secinfo->s.aes.ciphertext, "s:keyid",
+ keyid, "s:iv", secinfo->s.aes.iv,
+ "s:format", "base64", NULL);
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index cafd5c0fc7..f93f987833 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1761,29 +1761,23 @@ static char *qemuConnectGetHostname(virConnectPtr conn)
static int qemuConnectListDomains(virConnectPtr conn, int *ids, int nids)
{
virQEMUDriverPtr driver = conn->privateData;
- int n;
if (virConnectListDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListGetActiveIDs(driver->domains, ids, nids,
- virConnectListDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListGetActiveIDs(driver->domains, ids, nids,
+ virConnectListDomainsCheckACL, conn);
}
static int qemuConnectNumOfDomains(virConnectPtr conn)
{
virQEMUDriverPtr driver = conn->privateData;
- int n;
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListNumOfDomains(driver->domains, true,
- virConnectNumOfDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListNumOfDomains(driver->domains, true,
+ virConnectNumOfDomainsCheckACL, conn);
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index aaca2fc7d6..b10fdc0379 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7316,8 +7316,6 @@ qemuProcessCreatePretendCmd(virQEMUDriverPtr driver,
int
qemuProcessKill(virDomainObjPtr vm, unsigned int flags)
{
- int ret;
-
VIR_DEBUG("vm=%p name=%s pid=%lld flags=0x%x",
vm, vm->def->name,
(long long)vm->pid, flags);
@@ -7338,11 +7336,9 @@ qemuProcessKill(virDomainObjPtr vm, unsigned int flags)
/* Request an extra delay of two seconds per current nhostdevs
* to be safe against stalls by the kernel freeing up the resources */
- ret = virProcessKillPainfullyDelay(vm->pid,
- !!(flags & VIR_QEMU_PROCESS_KILL_FORCE),
- vm->def->nhostdevs * 2);
-
- return ret;
+ return virProcessKillPainfullyDelay(vm->pid,
+ !!(flags & VIR_QEMU_PROCESS_KILL_FORCE),
+ vm->def->nhostdevs * 2);
}
@@ -7764,11 +7760,9 @@ int qemuProcessAutoDestroyAdd(virQEMUDriverPtr driver,
int qemuProcessAutoDestroyRemove(virQEMUDriverPtr driver,
virDomainObjPtr vm)
{
- int ret;
VIR_DEBUG("vm=%s", vm->def->name);
- ret = virCloseCallbacksUnset(driver->closeCallbacks, vm,
- qemuProcessAutoDestroy);
- return ret;
+ return virCloseCallbacksUnset(driver->closeCallbacks, vm,
+ qemuProcessAutoDestroy);
}
bool qemuProcessAutoDestroyActive(virQEMUDriverPtr driver,
diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index 56a46a13be..18b2e16a8f 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -7512,10 +7512,7 @@ get_nonnull_storage_pool(virConnectPtr conn, remote_nonnull_storage_pool pool)
static virStorageVolPtr
get_nonnull_storage_vol(virConnectPtr conn, remote_nonnull_storage_vol vol)
{
- virStorageVolPtr ret;
- ret = virGetStorageVol(conn, vol.pool, vol.name, vol.key,
- NULL, NULL);
- return ret;
+ return virGetStorageVol(conn, vol.pool, vol.name, vol.key, NULL, NULL);
}
static virSecretPtr
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index b11d1d6622..c754b5958c 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -227,7 +227,6 @@ virStorageBackendISCSICheckPool(virStoragePoolObjPtr pool,
bool *isActive)
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
- int ret = -1;
g_autofree char *session = NULL;
*isActive = false;
@@ -253,9 +252,7 @@ virStorageBackendISCSICheckPool(virStoragePoolObjPtr pool,
if ((session = virStorageBackendISCSISession(pool, true)))
*isActive = true;
- ret = 0;
-
- return ret;
+ return 0;
}
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index ab7e5fc02a..f81af5d629 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5270,11 +5270,8 @@ static int
testConnectNumOfNetworks(virConnectPtr conn)
{
testDriverPtr privconn = conn->privateData;
- int numActive;
-
- numActive = virNetworkObjListNumOfNetworks(privconn->networks,
- true, NULL, conn);
- return numActive;
+ return virNetworkObjListNumOfNetworks(privconn->networks, true, NULL,
+ conn);
}
@@ -5284,11 +5281,8 @@ testConnectListNetworks(virConnectPtr conn,
int maxnames)
{
testDriverPtr privconn = conn->privateData;
- int n;
-
- n = virNetworkObjListGetNames(privconn->networks,
- true, names, maxnames, NULL, conn);
- return n;
+ return virNetworkObjListGetNames(privconn->networks, true, names,
+ maxnames, NULL, conn);
}
@@ -5296,11 +5290,8 @@ static int
testConnectNumOfDefinedNetworks(virConnectPtr conn)
{
testDriverPtr privconn = conn->privateData;
- int numInactive;
-
- numInactive = virNetworkObjListNumOfNetworks(privconn->networks,
- false, NULL, conn);
- return numInactive;
+ return virNetworkObjListNumOfNetworks(privconn->networks, false, NULL,
+ conn);
}
@@ -5310,11 +5301,8 @@ testConnectListDefinedNetworks(virConnectPtr conn,
int maxnames)
{
testDriverPtr privconn = conn->privateData;
- int n;
-
- n = virNetworkObjListGetNames(privconn->networks,
- false, names, maxnames, NULL, conn);
- return n;
+ return virNetworkObjListGetNames(privconn->networks, false, names,
+ maxnames, NULL, conn);
}
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
index 6ab79a1897..4d09d84274 100644
--- a/src/util/vircgroupv1.c
+++ b/src/util/vircgroupv1.c
@@ -410,11 +410,7 @@ virCgroupV1ValidatePlacement(virCgroupPtr group,
static char *
virCgroupV1StealPlacement(virCgroupPtr group)
{
- char *ret = NULL;
-
- ret = g_steal_pointer(&group->legacy[VIR_CGROUP_CONTROLLER_SYSTEMD].placement);
-
- return ret;
+ return g_steal_pointer(&group->legacy[VIR_CGROUP_CONTROLLER_SYSTEMD].placement);
}
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 621ab71eb5..c89158d5d5 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -242,11 +242,7 @@ virCgroupV2ValidatePlacement(virCgroupPtr group,
static char *
virCgroupV2StealPlacement(virCgroupPtr group)
{
- char *ret;
-
- ret = g_steal_pointer(&group->unified.placement);
-
- return ret;
+ return g_steal_pointer(&group->unified.placement);
}
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
index f54c917c03..50a6bea05e 100644
--- a/src/util/virdbus.c
+++ b/src/util/virdbus.c
@@ -1178,15 +1178,12 @@ virDBusMessageEncodeArgs(DBusMessage* msg,
va_list args)
{
DBusMessageIter iter;
- int ret = -1;
memset(&iter, 0, sizeof(iter));
dbus_message_iter_init_append(msg, &iter);
- ret = virDBusMessageIterEncode(&iter, types, args);
-
- return ret;
+ return virDBusMessageIterEncode(&iter, types, args);
}
diff --git a/src/vbox/vbox_storage.c b/src/vbox/vbox_storage.c
index ba5b876ffb..3d221fa8d9 100644
--- a/src/vbox/vbox_storage.c
+++ b/src/vbox/vbox_storage.c
@@ -90,10 +90,9 @@ static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool)
PRUint32 hardDiskAccessible = 0;
nsresult rc;
size_t i;
- int ret = -1;
if (!data->vboxObj)
- return ret;
+ return -1;
rc = gVBoxAPI.UArray.vboxArrayGet(&hardDisks, data->vboxObj,
gVBoxAPI.UArray.handleGetHardDisks(data->vboxObj));
@@ -101,7 +100,7 @@ static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool)
virReportError(VIR_ERR_INTERNAL_ERROR,
_("could not get number of volumes in the pool: %s, rc=%08x"),
pool->name, (unsigned)rc);
- return ret;
+ return -1;
}
for (i = 0; i < hardDisks.count; ++i) {
@@ -118,9 +117,7 @@ static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool)
gVBoxAPI.UArray.vboxArrayRelease(&hardDisks);
- ret = hardDiskAccessible;
-
- return ret;
+ return hardDiskAccessible;
}
static int
@@ -131,10 +128,9 @@ vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, int nname
PRUint32 numActive = 0;
nsresult rc;
size_t i;
- int ret = -1;
if (!data->vboxObj)
- return ret;
+ return -1;
rc = gVBoxAPI.UArray.vboxArrayGet(&hardDisks, data->vboxObj,
gVBoxAPI.UArray.handleGetHardDisks(data->vboxObj));
@@ -142,7 +138,7 @@ vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, int nname
virReportError(VIR_ERR_INTERNAL_ERROR,
_("could not get the volume list in the pool: %s, rc=%08x"),
pool->name, (unsigned)rc);
- return ret;
+ return -1;
}
for (i = 0; i < hardDisks.count && numActive < nnames; ++i) {
@@ -174,9 +170,7 @@ vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, int nname
}
gVBoxAPI.UArray.vboxArrayRelease(&hardDisks);
- ret = numActive;
-
- return ret;
+ return numActive;
}
static virStorageVolPtr
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 21425346ac..69ec1a5377 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -210,13 +210,11 @@ static char *
vzConnectGetCapabilities(virConnectPtr conn)
{
vzConnPtr privconn = conn->privateData;
- char *xml;
if (virConnectGetCapabilitiesEnsureACL(conn) < 0)
return NULL;
- xml = virCapabilitiesFormatXML(privconn->driver->caps);
- return xml;
+ return virCapabilitiesFormatXML(privconn->driver->caps);
}
static int
@@ -470,63 +468,53 @@ static int
vzConnectListDomains(virConnectPtr conn, int *ids, int maxids)
{
vzConnPtr privconn = conn->privateData;
- int n;
if (virConnectListDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListGetActiveIDs(privconn->driver->domains, ids, maxids,
- virConnectListDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListGetActiveIDs(privconn->driver->domains, ids,
+ maxids, virConnectListDomainsCheckACL,
+ conn);
}
static int
vzConnectNumOfDomains(virConnectPtr conn)
{
vzConnPtr privconn = conn->privateData;
- int count;
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
return -1;
- count = virDomainObjListNumOfDomains(privconn->driver->domains, true,
- virConnectNumOfDomainsCheckACL, conn);
-
- return count;
+ return virDomainObjListNumOfDomains(privconn->driver->domains, true,
+ virConnectNumOfDomainsCheckACL, conn);
}
static int
vzConnectListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
{
vzConnPtr privconn = conn->privateData;
- int n;
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
return -1;
memset(names, 0, sizeof(*names) * maxnames);
- n = virDomainObjListGetInactiveNames(privconn->driver->domains, names,
- maxnames,
- virConnectListDefinedDomainsCheckACL,
- conn);
-
- return n;
+ return virDomainObjListGetInactiveNames(privconn->driver->domains, names,
+ maxnames,
+ virConnectListDefinedDomainsCheckACL,
+ conn);
}
static int
vzConnectNumOfDefinedDomains(virConnectPtr conn)
{
vzConnPtr privconn = conn->privateData;
- int count;
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
return -1;
- count = virDomainObjListNumOfDomains(privconn->driver->domains, false,
- virConnectNumOfDefinedDomainsCheckACL,
- conn);
- return count;
+ return virDomainObjListNumOfDomains(privconn->driver->domains, false,
+ virConnectNumOfDefinedDomainsCheckACL,
+ conn);
}
static int
@@ -535,17 +523,14 @@ vzConnectListAllDomains(virConnectPtr conn,
unsigned int flags)
{
vzConnPtr privconn = conn->privateData;
- int ret = -1;
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
if (virConnectListAllDomainsEnsureACL(conn) < 0)
return -1;
- ret = virDomainObjListExport(privconn->driver->domains, conn, domains,
- virConnectListAllDomainsCheckACL, flags);
-
- return ret;
+ return virDomainObjListExport(privconn->driver->domains, conn, domains,
+ virConnectListAllDomainsCheckACL, flags);
}
static virDomainPtr
diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c
index bb06f468d7..641b26d2c5 100644
--- a/tools/virsh-completer-domain.c
+++ b/tools/virsh-completer-domain.c
@@ -173,7 +173,6 @@ virshDomainEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
unsigned int flags)
{
size_t i = 0;
- char **ret = NULL;
VIR_AUTOSTRINGLIST tmp = NULL;
virCheckFlags(0, NULL);
@@ -186,8 +185,7 @@ virshDomainEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
return NULL;
}
- ret = g_steal_pointer(&tmp);
- return ret;
+ return g_steal_pointer(&tmp);
}
diff --git a/tools/virsh-completer-nodedev.c b/tools/virsh-completer-nodedev.c
index 899c199902..83f6d415a7 100644
--- a/tools/virsh-completer-nodedev.c
+++ b/tools/virsh-completer-nodedev.c
@@ -73,7 +73,6 @@ virshNodeDeviceEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
unsigned int flags)
{
size_t i = 0;
- char **ret = NULL;
VIR_AUTOSTRINGLIST tmp = NULL;
virCheckFlags(0, NULL);
@@ -86,8 +85,7 @@ virshNodeDeviceEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
return NULL;
}
- ret = g_steal_pointer(&tmp);
- return ret;
+ return g_steal_pointer(&tmp);
}
diff --git a/tools/virsh-completer-pool.c b/tools/virsh-completer-pool.c
index ceb73eed06..def2b95b6d 100644
--- a/tools/virsh-completer-pool.c
+++ b/tools/virsh-completer-pool.c
@@ -76,7 +76,6 @@ virshPoolEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
unsigned int flags)
{
size_t i = 0;
- char **ret = NULL;
VIR_AUTOSTRINGLIST tmp = NULL;
virCheckFlags(0, NULL);
@@ -89,8 +88,7 @@ virshPoolEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
return NULL;
}
- ret = g_steal_pointer(&tmp);
- return ret;
+ return g_steal_pointer(&tmp);
}
diff --git a/tools/virsh-completer-secret.c b/tools/virsh-completer-secret.c
index a533ac178f..4ebeaeeb65 100644
--- a/tools/virsh-completer-secret.c
+++ b/tools/virsh-completer-secret.c
@@ -73,7 +73,6 @@ virshSecretEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
unsigned int flags)
{
size_t i;
- char **ret = NULL;
VIR_AUTOSTRINGLIST tmp = NULL;
virCheckFlags(0, NULL);
@@ -86,6 +85,5 @@ virshSecretEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
return NULL;
}
- ret = g_steal_pointer(&tmp);
- return ret;
+ return g_steal_pointer(&tmp);
}
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index 64b733adcc..edd61f3217 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -1384,8 +1384,6 @@ static const vshCmdOptDef opts_network_dhcp_leases[] = {
static int
virshNetworkDHCPLeaseSorter(const void *a, const void *b)
{
- int rv = -1;
-
virNetworkDHCPLeasePtr *lease1 = (virNetworkDHCPLeasePtr *) a;
virNetworkDHCPLeasePtr *lease2 = (virNetworkDHCPLeasePtr *) b;
@@ -1395,8 +1393,7 @@ virshNetworkDHCPLeaseSorter(const void *a, const void *b)
if (!*lease1)
return *lease2 != NULL;
- rv = vshStrcasecmp((*lease1)->mac, (*lease2)->mac);
- return rv;
+ return vshStrcasecmp((*lease1)->mac, (*lease2)->mac);
}
static bool
diff --git a/tools/vsh.c b/tools/vsh.c
index ee675a63cc..ae94a724df 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -2910,10 +2910,7 @@ vshReadlineCompletion(const char *text,
int start G_GNUC_UNUSED,
int end G_GNUC_UNUSED)
{
- char **matches = (char **) NULL;
-
- matches = rl_completion_matches(text, vshReadlineParse);
- return matches;
+ return rl_completion_matches(text, vshReadlineParse);
}
--
2.21.0
5 years, 2 months