[libvirt-python PATCH] setup: post-release version bump to 6.4.0
by Daniel P. Berrangé
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
Pushed as trivial
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index 71a2a7f..cb24f30 100755
--- a/setup.py
+++ b/setup.py
@@ -339,7 +339,7 @@ class my_clean(clean):
_c_modules, _py_modules = get_module_lists()
setup(name = 'libvirt-python',
- version = '6.3.0',
+ version = '6.4.0',
url = 'http://www.libvirt.org',
maintainer = 'Libvirt Maintainers',
maintainer_email = 'libvir-list(a)redhat.com',
--
2.26.2
4 years, 6 months
[libvirt PATCH] remote: fix driver name check for libxl driver
by Daniel P. Berrangé
The virConnectGetType() returns "xenlight" for libxl, not "LIBXL".
This prevents users opening a connection to the libxl driver when using
the modular daemons.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/remote/remote_daemon_dispatch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index 5d1c6971c0..a8ac795d71 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -2111,7 +2111,7 @@ remoteDispatchConnectOpen(virNetServerPtr server G_GNUC_UNUSED,
VIR_DEBUG("Primary driver type is '%s'", type);
if (STREQ(type, "QEMU") ||
- STREQ(type, "LIBXL") ||
+ STREQ(type, "xenlight") ||
STREQ(type, "LXC") ||
STREQ(type, "VBOX") ||
STREQ(type, "bhyve") ||
--
2.26.2
4 years, 6 months
[libvirt-python PATCH v2] gitlab: add CONTRIBUTING.rst file to indicate use of merge requests
by Daniel P. Berrangé
With the introduction of automated CI pipelines, we are now ready to switch
to using merge requests for the project. With this switch we longer wish
to have patches sent to the mailing list, and thus the git-publish
config is removed.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
.gitpublish | 4 ----
CONTRIBUTING.rst | 28 ++++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 4 deletions(-)
delete mode 100644 .gitpublish
create mode 100644 CONTRIBUTING.rst
diff --git a/.gitpublish b/.gitpublish
deleted file mode 100644
index dced716..0000000
--- a/.gitpublish
+++ /dev/null
@@ -1,4 +0,0 @@
-[gitpublishprofile "default"]
-base = master
-to = libvir-list(a)redhat.com
-prefix = libvirt-python PATCH
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
new file mode 100644
index 0000000..3472318
--- /dev/null
+++ b/CONTRIBUTING.rst
@@ -0,0 +1,28 @@
+==============================
+Contributing to libvirt-python
+==============================
+
+The libvirt Python API binding accepts code contributions via merge requests
+on the GitLab project:
+
+https://gitlab.com/libvirt/libvirt-python/-/merge_requests
+
+It is required that automated CI pipelines succeed before a merge request
+will be accepted. The global pipeline status for the ``master`` branch is
+visible at:
+
+https://gitlab.com/libvirt/libvirt-python/pipelines
+
+CI pipeline results for merge requests will be visible via the contributors'
+own private repository fork:
+
+https://gitlab.com/yourusername/libvirt-python/pipelines
+
+Contributions submitted to the project must be in compliance with the
+Developer Certificate of Origin Version 1.1. This is documented at:
+
+https://developercertificate.org/
+
+To indicate compliance, each commit in a series must have a "Signed-off-by"
+tag with the submitter's name and email address. This can be added by passing
+the ``-s`` flag to ``git commit`` when creating the patches.
--
2.26.2
4 years, 6 months
[PATCH] Drop needless variable
by Michal Privoznik
Instead of the following pattern:
type ret;
...
ret = func();
return ret;
we can use:
return func()
directly.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/conf/domain_addr.c | 8 +-------
src/conf/domain_conf.c | 8 +++-----
src/conf/network_conf.c | 5 +----
src/conf/virnetworkportdef.c | 5 +----
src/qemu/qemu_capabilities.c | 5 +----
src/qemu/qemu_command.c | 8 ++------
src/qemu/qemu_conf.c | 9 ++-------
src/qemu/qemu_domain.c | 12 +++---------
src/qemu/qemu_driver.c | 18 ++++++------------
src/qemu/qemu_tpm.c | 11 ++---------
src/security/security_apparmor.c | 5 +----
src/security/security_util.c | 9 +++------
src/storage/storage_driver.c | 7 ++-----
src/util/vircgroup.c | 5 +----
src/util/virmdev.c | 10 ++--------
src/util/virresctrl.c | 6 +-----
src/util/virsocketaddr.c | 5 +----
src/util/virutil.c | 8 +++-----
tests/qemuxml2argvtest.c | 6 +-----
19 files changed, 37 insertions(+), 113 deletions(-)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 5652bc9a33..8623e79daf 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -1392,13 +1392,7 @@ virDomainPCIAddressSetAllMulti(virDomainDefPtr def)
static char*
virDomainCCWAddressAsString(virDomainDeviceCCWAddressPtr addr)
{
- char *addrstr = NULL;
-
- addrstr = g_strdup_printf("%x.%x.%04x",
- addr->cssid,
- addr->ssid,
- addr->devno);
- return addrstr;
+ return g_strdup_printf("%x.%x.%04x", addr->cssid, addr->ssid, addr->devno);
}
static int
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8a87586936..83748354b0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -31316,54 +31316,52 @@ char *
virDomainDefGetShortName(const virDomainDef *def)
{
wchar_t wshortname[VIR_DOMAIN_SHORT_NAME_MAX + 1] = {0};
size_t len = 0;
- char *ret = NULL;
g_autofree char *shortname = NULL;
/* No need to do the whole conversion thing when there are no multibyte
* characters. The same applies for illegal sequences as they can occur
* with incompatible locales. */
len = mbstowcs(NULL, def->name, 0);
if ((len == (size_t) -1 && errno == EILSEQ) ||
len == strlen(def->name)) {
- ret = g_strdup_printf("%d-%.*s", def->id, VIR_DOMAIN_SHORT_NAME_MAX, def->name);
- return ret;
+ return g_strdup_printf("%d-%.*s", def->id, VIR_DOMAIN_SHORT_NAME_MAX,
+ def->name);
}
if (len == (size_t) -1) {
virReportSystemError(errno, "%s",
_("Cannot convert domain name to "
"wide character string"));
return NULL;
}
if (mbstowcs(wshortname, def->name, VIR_DOMAIN_SHORT_NAME_MAX) == (size_t) -1) {
virReportSystemError(errno, "%s",
_("Cannot convert domain name to "
"wide character string"));
return NULL;
}
len = wcstombs(NULL, wshortname, 0);
if (len == (size_t) -1) {
virReportSystemError(errno, "%s",
_("Cannot convert wide character string "
"back to multi-byte domain name"));
return NULL;
}
if (VIR_ALLOC_N(shortname, len + 1) < 0)
return NULL;
if (wcstombs(shortname, wshortname, len) == (size_t) -1) {
virReportSystemError(errno, "%s",
_("Cannot convert wide character string "
"back to multi-byte domain name"));
return NULL;
}
- ret = g_strdup_printf("%d-%s", def->id, shortname);
- return ret;
+ return g_strdup_printf("%d-%s", def->id, shortname);
}
#undef VIR_DOMAIN_SHORT_NAME_MAX
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index a7c177f8db..dc64ce6959 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2892,10 +2892,7 @@ char *
virNetworkConfigFile(const char *dir,
const char *name)
{
- char *ret = NULL;
-
- ret = g_strdup_printf("%s/%s.xml", dir, name);
- return ret;
+ return g_strdup_printf("%s/%s.xml", dir, name);
}
diff --git a/src/conf/virnetworkportdef.c b/src/conf/virnetworkportdef.c
index a4cffea8b6..2013e11dff 100644
--- a/src/conf/virnetworkportdef.c
+++ b/src/conf/virnetworkportdef.c
@@ -432,10 +432,7 @@ static char *
virNetworkPortDefConfigFile(const char *dir,
const char *name)
{
- char *ret = NULL;
-
- ret = g_strdup_printf("%s/%s.xml", dir, name);
- return ret;
+ return g_strdup_printf("%s/%s.xml", dir, name);
}
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 47f88481c8..c7e58f92ae 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4467,79 +4467,76 @@ char *
virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
- char *ret = NULL;
size_t i;
virBufferAddLit(&buf, "<qemuCaps>\n");
virBufferAdjustIndent(&buf, 2);
virBufferEscapeString(&buf, "<emulator>%s</emulator>\n",
qemuCaps->binary);
virBufferAsprintf(&buf, "<qemuctime>%llu</qemuctime>\n",
(long long)qemuCaps->ctime);
virBufferAsprintf(&buf, "<selfctime>%llu</selfctime>\n",
(long long)qemuCaps->libvirtCtime);
virBufferAsprintf(&buf, "<selfvers>%lu</selfvers>\n",
(unsigned long)qemuCaps->libvirtVersion);
for (i = 0; i < QEMU_CAPS_LAST; i++) {
if (virQEMUCapsGet(qemuCaps, i)) {
virBufferAsprintf(&buf, "<flag name='%s'/>\n",
virQEMUCapsTypeToString(i));
}
}
virBufferAsprintf(&buf, "<version>%d</version>\n",
qemuCaps->version);
virBufferAsprintf(&buf, "<kvmVersion>%d</kvmVersion>\n",
qemuCaps->kvmVersion);
virBufferAsprintf(&buf, "<microcodeVersion>%u</microcodeVersion>\n",
qemuCaps->microcodeVersion);
if (qemuCaps->package)
virBufferAsprintf(&buf, "<package>%s</package>\n",
qemuCaps->package);
if (qemuCaps->kernelVersion)
virBufferAsprintf(&buf, "<kernelVersion>%s</kernelVersion>\n",
qemuCaps->kernelVersion);
virBufferAsprintf(&buf, "<arch>%s</arch>\n",
virArchToString(qemuCaps->arch));
virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_KVM);
virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_QEMU);
for (i = 0; i < qemuCaps->ngicCapabilities; i++) {
virGICCapabilityPtr cap;
bool kernel;
bool emulated;
cap = &qemuCaps->gicCapabilities[i];
kernel = (cap->implementation & VIR_GIC_IMPLEMENTATION_KERNEL);
emulated = (cap->implementation & VIR_GIC_IMPLEMENTATION_EMULATED);
virBufferAsprintf(&buf,
"<gic version='%d' kernel='%s' emulated='%s'/>\n",
cap->version,
kernel ? "yes" : "no",
emulated ? "yes" : "no");
}
if (qemuCaps->sevCapabilities)
virQEMUCapsFormatSEVInfo(qemuCaps, &buf);
if (qemuCaps->kvmSupportsNesting)
virBufferAddLit(&buf, "<kvmSupportsNesting/>\n");
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</qemuCaps>\n");
- ret = virBufferContentAndReset(&buf);
-
- return ret;
+ return virBufferContentAndReset(&buf);
}
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6acfc0b19d..269bdbaf56 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -251,44 +251,40 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd,
static char *
qemuVirCommandGetFDSet(virCommandPtr cmd, int fd)
{
- char *result = NULL;
int idx = virCommandPassFDGetFDIndex(cmd, fd);
if (idx < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("file descriptor %d has not been transferred"), fd);
return NULL;
}
- result = g_strdup_printf("set=%d,fd=%d", idx, fd);
- return result;
+ return g_strdup_printf("set=%d,fd=%d", idx, fd);
}
/**
* qemuVirCommandGetDevSet:
* @cmd: the command to modify
* @fd: fd to reassign to the child
*
* Get the parameters for the QEMU path= parameter where a file
* descriptor is accessed via a file descriptor set, for example
* /dev/fdset/10. The file descriptor must previously have been
* 'transferred' in a virCommandPassFD() call.
*/
static char *
qemuVirCommandGetDevSet(virCommandPtr cmd, int fd)
{
- char *result = NULL;
int idx = virCommandPassFDGetFDIndex(cmd, fd);
if (idx < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("file descriptor %d has not been transferred"), fd);
return NULL;
}
- result = g_strdup_printf("/dev/fdset/%d", idx);
- return result;
+ return g_strdup_printf("/dev/fdset/%d", idx);
}
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index c59824006c..2d5e527b47 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1429,29 +1429,26 @@ char *
qemuGetSharedDeviceKey(const char *device_path)
{
int maj, min;
- char *key = NULL;
int rc;
if ((rc = virGetDeviceID(device_path, &maj, &min)) < 0) {
virReportSystemError(-rc,
_("Unable to get minor number of device '%s'"),
device_path);
return NULL;
}
- key = g_strdup_printf("%d:%d", maj, min);
-
- return key;
+ return g_strdup_printf("%d:%d", maj, min);
}
/*
* Make necessary checks for the need to check and for the current setting
* of the 'unpriv_sgio' value for the device_path passed.
*
* Returns:
* 0 - Success
* -1 - Some failure which would already have been messaged
* -2 - Mismatch with the "shared" sgio setting - needs to be messaged
* by caller since it has context of which type of disk resource is
* being used and in the future the hostdev information.
*/
@@ -1704,19 +1701,17 @@ static char *
qemuGetHostdevPath(virDomainHostdevDefPtr hostdev)
{
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
g_autofree char *dev_name = NULL;
- char *dev_path = NULL;
if (!(dev_name = virSCSIDeviceGetDevName(NULL,
scsihostsrc->adapter,
scsihostsrc->bus,
scsihostsrc->target,
scsihostsrc->unit)))
return NULL;
- dev_path = g_strdup_printf("/dev/%s", dev_name);
- return dev_path;
+ return g_strdup_printf("/dev/%s", dev_name);
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d63ec2313b..9c629c31a3 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6835,17 +6835,14 @@ virDomainDefPtr
qemuDomainDefCopy(virQEMUDriverPtr driver,
virQEMUCapsPtr qemuCaps,
virDomainDefPtr src,
unsigned int flags)
{
- virDomainDefPtr ret = NULL;
g_autofree char *xml = NULL;
if (!(xml = qemuDomainDefFormatXML(driver, qemuCaps, src, flags)))
return NULL;
- ret = qemuDomainDefFromXML(driver, qemuCaps, xml);
-
- return ret;
+ return qemuDomainDefFromXML(driver, qemuCaps, xml);
}
@@ -13364,17 +13361,14 @@ qemuProcessEventFree(struct qemuProcessEvent *event)
char *
qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv)
{
- char *ret = NULL;
-
- ret = g_strdup_printf("%s/%s.sock", priv->libDir, qemuDomainGetManagedPRAlias());
-
- return ret;
+ return g_strdup_printf("%s/%s.sock", priv->libDir,
+ qemuDomainGetManagedPRAlias());
}
/**
* qemuDomainStorageIdNew:
* @priv: qemu VM private data object.
*
* Generate a new unique id for a storage object. Useful for node name generation.
*/
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d5aeeac66d..1c7c87128d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7439,31 +7439,25 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
static int qemuConnectListDefinedDomains(virConnectPtr conn,
char **const names, int nnames) {
virQEMUDriverPtr driver = conn->privateData;
- int ret = -1;
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
return -1;
- ret = virDomainObjListGetInactiveNames(driver->domains, names, nnames,
- virConnectListDefinedDomainsCheckACL,
- conn);
-
- return ret;
+ return virDomainObjListGetInactiveNames(driver->domains, names, nnames,
+ virConnectListDefinedDomainsCheckACL,
+ conn);
}
static int qemuConnectNumOfDefinedDomains(virConnectPtr conn)
{
virQEMUDriverPtr driver = conn->privateData;
- int ret = -1;
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
return -1;
- ret = virDomainObjListNumOfDomains(driver->domains, false,
- virConnectNumOfDefinedDomainsCheckACL,
- conn);
-
- return ret;
+ return virDomainObjListNumOfDomains(driver->domains, false,
+ virConnectNumOfDefinedDomainsCheckACL,
+ conn);
}
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 58dfdf689a..fe567f440c 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -171,19 +171,15 @@ static char *
qemuTPMCreateEmulatorSocket(const char *swtpmStateDir,
const char *shortName)
{
- char *path = NULL;
-
- path = g_strdup_printf("%s/%s-swtpm.sock", swtpmStateDir, shortName);
-
- return path;
+ return g_strdup_printf("%s/%s-swtpm.sock", swtpmStateDir, shortName);
}
/*
* qemuTPMEmulatorInitPaths:
*
* @tpm: TPM definition for an emulator type
* @swtpmStorageDir: the general swtpm storage dir which is used as a base
* directory for creating VM specific directories
* @uuid: the UUID of the VM
*/
@@ -213,25 +209,22 @@ static char *
qemuTPMEmulatorCreatePidFilename(const char *swtpmStateDir,
const char *shortName)
{
- char *pidfile = NULL;
g_autofree char *devicename = NULL;
devicename = g_strdup_printf("%s-swtpm", shortName);
- pidfile = virPidFileBuildPath(swtpmStateDir, devicename);
-
- return pidfile;
+ return virPidFileBuildPath(swtpmStateDir, devicename);
}
/*
* qemuTPMEmulatorGetPid
*
* @swtpmStateDir: the directory where swtpm writes the pidfile into
* @shortName: short name of the domain
* @pid: pointer to pid
*
* Return -1 upon error, or zero on successful reading of the pidfile.
* If the PID was not still alive, zero will be returned, and @pid will be
* set to -1;
*/
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 3bc200ffb3..7c8fd39584 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -213,15 +213,12 @@ static char *
get_profile_name(virDomainDefPtr def)
{
char uuidstr[VIR_UUID_STRING_BUFLEN];
- char *name = NULL;
virUUIDFormat(def->uuid, uuidstr);
- name = g_strdup_printf("%s%s", AA_PREFIX, uuidstr);
-
- return name;
+ return g_strdup_printf("%s%s", AA_PREFIX, uuidstr);
}
/* returns -1 on error or profile for libvirtd is unconfined, 0 if complain
* mode and 1 if enforcing. This is required because at present you cannot
* aa_change_profile() from a process that is unconfined.
*/
diff --git a/src/security/security_util.c b/src/security/security_util.c
index 4f661fd75e..7fa5163fe4 100644
--- a/src/security/security_util.c
+++ b/src/security/security_util.c
@@ -92,9 +92,8 @@ virSecurityGetRefCountAttrName(const char *name G_GNUC_UNUSED)
static char *
virSecurityGetTimestampAttrName(const char *name)
{
- char *ret = NULL;
- ret = g_strdup_printf(XATTR_NAMESPACE ".libvirt.security.timestamp_%s", name);
- return ret;
+ return g_strdup_printf(XATTR_NAMESPACE ".libvirt.security.timestamp_%s",
+ name);
}
#else /* !XATTR_NAMESPACE */
static char *
@@ -112,49 +111,47 @@ static char *
virSecurityGetTimestamp(void)
{
unsigned long long boottime = 0;
- char *ret = NULL;
if (virHostGetBootTime(&boottime) < 0) {
virReportSystemError(errno, "%s",
_("Unable to get host boot time"));
return NULL;
}
- ret = g_strdup_printf("%llu", boottime);
- return ret;
+ return g_strdup_printf("%llu", boottime);
}
/**
* virSecurityValidateTimestamp:
* @name: security driver name
* @path: file name
*
* Check if remembered label on @path for security driver @name
* is valid, i.e. the label has been set since the last boot. If
* the label was set in previous runs, all XATTRs related to
* @name are removed so that clean slate is restored.
*
* This is done having extra attribute timestamp_$SECDRIVER which
* contains the host boot time. Its value is then compared to
* actual host boot time. If these two values don't match then
* XATTRs are considered as stale and thus invalid.
*
* In ideal world, where there network file systems have XATTRs
* using plain host boot time is not enough as it may lead to a
* situation where a freshly started host sees XATTRs, sees the
* timestamp put there by some longer running host and considers
* the XATTRs invalid. Well, there is not an easy way out. We
* would need to somehow check if the longer running host is
* still there and uses the @path (how?).
* Fortunately, there is only one network file system which
* supports XATTRs currently (GlusterFS via FUSE) and it is used
* so rarely that it's almost a corner case.
* The worst thing that happens there is that we remove XATTRs
* and thus return @path to the default label for $SECDRIVER.
*
* Returns: 0 if remembered label is valid,
* 1 if remembered label was not valid,
* -2 if underlying file system doesn't support XATTRs,
* -1 otherwise.
*/
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 2db763caa5..7e82c09be5 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -2837,13 +2837,10 @@ char *
virStoragePoolObjBuildTempFilePath(virStoragePoolObjPtr obj,
virStorageVolDefPtr voldef)
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(obj);
- char *tmp = NULL;
-
- tmp = g_strdup_printf("%s/%s.%s.secret.XXXXXX",
- driver->stateDir, def->name, voldef->name);
- return tmp;
+ return g_strdup_printf("%s/%s.%s.secret.XXXXXX", driver->stateDir,
+ def->name, voldef->name);
}
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 70d85200cb..bb535df4f2 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -423,28 +423,25 @@ virCgroupDetect(virCgroupPtr group,
char *
virCgroupGetBlockDevString(const char *path)
{
- char *ret = NULL;
struct stat sb;
if (stat(path, &sb) < 0) {
virReportSystemError(errno,
_("Path '%s' is not accessible"),
path);
return NULL;
}
if (!S_ISBLK(sb.st_mode)) {
virReportSystemError(EINVAL,
_("Path '%s' must be a block device"),
path);
return NULL;
}
/* Automatically append space after the string since all callers
* use it anyway */
- ret = g_strdup_printf("%d:%d ", major(sb.st_rdev), minor(sb.st_rdev));
-
- return ret;
+ return g_strdup_printf("%d:%d ", major(sb.st_rdev), minor(sb.st_rdev));
}
diff --git a/src/util/virmdev.c b/src/util/virmdev.c
index c2499c0a20..51a88a91d7 100644
--- a/src/util/virmdev.c
+++ b/src/util/virmdev.c
@@ -206,31 +206,28 @@ char *
virMediatedDeviceGetIOMMUGroupDev(const char *uuidstr)
{
g_autofree char *result_path = NULL;
g_autofree char *result_file = NULL;
g_autofree char *iommu_path = NULL;
g_autofree char *dev_path = virMediatedDeviceGetSysfsPath(uuidstr);
- char *vfio_path = NULL;
if (!dev_path)
return NULL;
iommu_path = g_strdup_printf("%s/iommu_group", dev_path);
if (!virFileExists(iommu_path)) {
virReportSystemError(errno, _("failed to access '%s'"), iommu_path);
return NULL;
}
if (virFileResolveLink(iommu_path, &result_path) < 0) {
virReportSystemError(errno, _("failed to resolve '%s'"), iommu_path);
return NULL;
}
result_file = g_path_get_basename(result_path);
- vfio_path = g_strdup_printf("/dev/vfio/%s", result_file);
-
- return vfio_path;
+ return g_strdup_printf("/dev/vfio/%s", result_file);
}
@@ -422,10 +419,7 @@ virMediatedDeviceIsUsed(virMediatedDevicePtr dev,
char *
virMediatedDeviceGetSysfsPath(const char *uuidstr)
{
- char *ret = NULL;
-
- ret = g_strdup_printf(MDEV_SYSFS_DEVICES "%s", uuidstr);
- return ret;
+ return g_strdup_printf(MDEV_SYSFS_DEVICES "%s", uuidstr);
}
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index c537d606cc..e17f6bd1bd 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -2307,19 +2307,15 @@ static char *
virResctrlDeterminePath(const char *parentpath,
const char *prefix,
const char *id)
{
- char *path = NULL;
-
if (!id) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Resctrl ID must be set before determining resctrl "
"parentpath='%s' prefix='%s'"), parentpath, prefix);
return NULL;
}
- path = g_strdup_printf("%s/%s-%s", parentpath, prefix, id);
-
- return path;
+ return g_strdup_printf("%s/%s-%s", parentpath, prefix, id);
}
diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index 4c9f124e88..a858a69204 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -578,35 +578,32 @@ char *
virSocketAddrGetPath(virSocketAddrPtr addr G_GNUC_UNUSED)
{
#ifndef WIN32
- char *path = NULL;
if (addr == NULL) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("No socket address provided"));
return NULL;
}
if (addr->data.sa.sa_family != AF_UNIX) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("UNIX socket address is required"));
return NULL;
}
- path = g_strndup(addr->data.un.sun_path, sizeof(addr->data.un.sun_path));
-
- return path;
+ return g_strndup(addr->data.un.sun_path, sizeof(addr->data.un.sun_path));
#else
virReportError(VIR_ERR_NO_SUPPORT, "%s",
_("UNIX sockets not supported on this platform"));
return NULL;
#endif
}
/**
* virSocketAddrIsNetmask:
* @netmask: the netmask address
*
* Check that @netmask is a proper network mask
*
* Returns 0 in case of success and -1 in case of error
*/
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 5b52e4e6d4..fb46501142 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1419,21 +1419,19 @@ char *
virGetUnprivSGIOSysfsPath(const char *path,
const char *sysfs_dir)
{
int maj, min;
- char *sysfs_path = NULL;
int rc;
if ((rc = virGetDeviceID(path, &maj, &min)) < 0) {
virReportSystemError(-rc,
_("Unable to get device ID '%s'"),
path);
return NULL;
}
- sysfs_path = g_strdup_printf("%s/%d:%d/queue/unpriv_sgio",
- sysfs_dir ? sysfs_dir : SYSFS_DEV_BLOCK_PATH,
- maj, min);
- return sysfs_path;
+ return g_strdup_printf("%s/%d:%d/queue/unpriv_sgio",
+ sysfs_dir ? sysfs_dir : SYSFS_DEV_BLOCK_PATH, maj,
+ min);
}
int
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 4a303c0185..04febd1b0c 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -185,11 +185,7 @@ fakeStorageVolGetInfo(virStorageVolPtr vol,
static char *
fakeStorageVolGetPath(virStorageVolPtr vol)
{
- char *ret = NULL;
-
- ret = g_strdup_printf("/some/%s/device/%s", vol->key, vol->name);
-
- return ret;
+ return g_strdup_printf("/some/%s/device/%s", vol->key, vol->name);
}
--
2.26.2
4 years, 6 months
libvirt-devaddr: a new library for device address assignment
by Daniel P. Berrangé
We've been doing alot of refactoring of code in recent times, and also
have plans for significant infrastructure changes. We still need to
spend time delivering interesting features to users / applications.
This mail is to introduce an idea for a solution to an specific
area applications have had long term pain with libvirt's current
"mechanism, not policy" approach - device addressing. This is a way
for us to show brand new ideas & approaches for what the libvirt
project can deliver in terms of management APIs.
To set expectations straight: I have written no code for this yet,
merely identified the gap & conceptual solution.
The device addressing problem
=============================
One of the key jobs libvirt does when processing a new domain XML
configuration is to assign addresses to all devices that are present.
This involves adding various device controllers (PCI bridges, PCI root
ports, IDE/SCSI buses, USB controllers, etc) if they are not already
present, and then assigning PCI, USB, IDE, SCSI, etc, addresses to each
device so they are associated with controllers. When libvirt spawns a
QEMU guest, it will pass full address information to QEMU.
Libvirt, as a general rule, aims to avoid defining and implementing
policy around expansion of guest configuration / defaults, however, it
is inescapable in the case of device addressing due to the need to
guarantee a stable hardware ABI to make live migration and save/restore
to disk work. The policy that libvirt has implemented for device
addressing is, as much as possible, the same as the addressing scheme
QEMU would apply itself.
While libvirt succeeds in its goal of providing a stable hardware API,
the addressing scheme used is not well suited to all deployment
scenarios of QEMU. This is an inevitable result of having a specific
assignment policy implemented in libvirt which has to trade off mutually
incompatible use cases/goals.
When the libvirt addressing policy is not been sufficient, management
applications are forced to take on address assignment themselves,
which is a massive non-trivial job with many subtle problems to
consider.
Places where libvirt's addressing is insufficient for PCI include
* Setting up multiple guest NUMA nodes and associating devices to
specific nodes
* Pre-emptive creation of extra PCIe root ports, to allow for later
device hotplug on PCIe topologies
* Determining whether to place a device on a PCI or PCIe bridge
* Controlling whether a device is placed into a hotpluggable slot
* Controlling whether a PCIe root port supports hotplug or not
* Determining whether to places all devices on distinct slots or
buses, vs grouping them all into functions on the same slot
* Ability to expand the device addressing without being on the
hypervisor host
Libvirt wishes to avoid implementing many different address assignment
policies. It also wishes to keep the domain XML as a representation
of the virtual hardware, not add a bunch of properties to it which
merely serve as tunable input parameters for device addressing
algorithms.
There is thus a dilemma here. Management applications increasingly
need fine grained control over device addressing, while libvirt
doesn't want to expose fine grained policy controls via the XML.
The new libvirt-devaddr API
===========================
The way out of this is to define a brand new virt management API
which tackles this specific problem in a way that addresses all the
problems mgmt apps have with device addressing and explicitly
provides a variety of policy impls with tunable behaviour.
By "new API", I actually mean an entirely new library, completely
distinct from libvirt.so, or anything else we've delivered so
far. The closest we've come to delivering something at this kind
of conceptual level, would be the abortive attempt we made with
"libvirt-builder" to deliver a policy-driven API instead of mechanism
based. This proposal is still quite different from that attempt.
At a high level
* The new API is "libvirt-devaddr" - short for "libvirt device addressing"
* As input it will take
1. The guest CPU architecture and machine type
2. A list of global tunables specifying desired behaviour of the
address assignment policy
3. A minimal list of devices needed in the virtual machine, with
optional addresses and optional per-device tunables to override
the global tunables
* As output it will emit
1. fully expanded list of devices needed in the virtual machine,
with addressing information sufficient to ensure stable hardware ABI
Initially the API would implement something that behaves the same
way as libvirt's current address assignment API.
The intended usage would be
* Mgmt application makes a minimal list of devices they want in
their guest
* List of devices is fed into libvirt-devaddr API
* Mgmt application gets back a full list of devices & addresses
* Mgmt application writes a libvirt XML doc using this full list &
addresses
* Mgmt application creates the guest in libvirt
IOW, this new "libvirt-devaddr" API is intended to be used prior to
creating the XML that is used by libvirt. The API could also be used
prior to needing to hotplug a new device to an existing guest.
This API is intended to be a deliverable of the libvirt project, but
it would be completely independent of the current libvirt API. Most
especially note that it would NOT use the domain XML in any way.
This gives applications maximum flexibility in how they consume this
functionality, not trying to force a way to build domain XML.
It would have greater freedom in its API design, making different
choices from libvirt.so on topics such as programming language (C vs
Go vs Python etc), API stability timeframe (forever stable vs sometimes
changing API), data formats (structs, vs YAML/JSON vs XML etc), and of
course the conceptual approach (policy vs mechanism)
The expectation is that this new API would be most likely to be
consumed by KubeVirt, OpenStack, Kata, as the list of problems shown
earlier is directly based on issues seen working with KubeVirt &
OpenStack in particular. It is not limited to these applications and
is broadly useful as conceptual thing.
It would be a goal that this API should also be used by libvirt
itself to replace its current internal device addressing impl.
Essentially the new API should be seen as a way to expose/extract
the current libvirt internal algorithm, making it available to
applications in a flexible manner. I don't anticipate actually copying
the current addressing code in libvirt as-is, but it would certainly
serve as reference for the kind of logic we need to implement, so you
might consider it a "port" or "rewrite" in some very rough sense.
I think this new API concept is a good way for the project make a start
in using Go for libvirt. The functionality covered has a clearly defined
scope limit, making it practical to deliver a real impl in a reasonably
short time frame. Extracting this will provide a real world benefit to
our application consumers, solving many long standing problems they have
with libvirt, and thus justify the effort in doing this work in libvirt
in a non-C language. The main question mark would be about how we might
make this functionality available to Python apps if we chose Go. It is
possible to expose a C API from Go, and we would need this to consume it
from libvirt. There is then the need to manually write a Python API binding
which is tedious work.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
4 years, 6 months
[PATCH 0/3] Xen: Improve the naming mess
by Jim Fehlig
Let's hope it's an improvement :-). See individual patches for details.
Jim Fehlig (3):
libxl: Use the name 'Xen' in driver tables
libxl: Clarify that 'xenlight' should only be used internally
docs: Xen improvements
docs/aclpolkit.html.in | 4 ++--
docs/formatdomain.html.in | 6 +++---
src/libxl/libxl_conf.h | 8 +++++++-
src/libxl/libxl_domain.c | 4 ++--
src/libxl/libxl_driver.c | 20 ++++++++++----------
5 files changed, 24 insertions(+), 18 deletions(-)
--
2.26.0
4 years, 6 months
[libvirt PATCH v2] remote: fix driver name check for libxl driver
by Daniel P. Berrangé
The virConnectGetType() returns "Xen" for libxl, not "LIBXL".
This prevents users opening a connection to the libxl driver when using
the modular daemons.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/remote/remote_daemon_dispatch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index 5d1c6971c0..6f67d2fb30 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -2111,7 +2111,7 @@ remoteDispatchConnectOpen(virNetServerPtr server G_GNUC_UNUSED,
VIR_DEBUG("Primary driver type is '%s'", type);
if (STREQ(type, "QEMU") ||
- STREQ(type, "LIBXL") ||
+ STREQ(type, "Xen") ||
STREQ(type, "LXC") ||
STREQ(type, "VBOX") ||
STREQ(type, "bhyve") ||
--
2.26.2
4 years, 6 months
[libvirt-python PATCH] gitlab: add CONTRIBUTING.rst file to indicate use of merge requests
by Daniel P. Berrangé
With the introduce of automated CI pipelines, we are now ready to switch
to using merge requests for the project. With this switch we longer wish
to have patches sent to the mailing list, and thus the git-publish
config is removed.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
.gitpublish | 4 ----
CONTRIBUTING.rst | 28 ++++++++++++++++++++++++++++
This CONTRIBUTING.rst is intentionally fairly generic, as I intend to
reuse it for most other projects too (libvirt.git being the exception
which has far more details).
2 files changed, 28 insertions(+), 4 deletions(-)
delete mode 100644 .gitpublish
create mode 100644 CONTRIBUTING.rst
diff --git a/.gitpublish b/.gitpublish
deleted file mode 100644
index dced716..0000000
--- a/.gitpublish
+++ /dev/null
@@ -1,4 +0,0 @@
-[gitpublishprofile "default"]
-base = master
-to = libvir-list(a)redhat.com
-prefix = libvirt-python PATCH
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
new file mode 100644
index 0000000..11e3c41
--- /dev/null
+++ b/CONTRIBUTING.rst
@@ -0,0 +1,28 @@
+==============================
+Contributing to libvirt-python
+==============================
+
+The libvirt Python API binding accepts code contributions via merge requests
+on the GitLab project:
+
+ https://gitlab.com/libvirt/libvirt-python/-/merge_requests
+
+It is required that automated CI pipelines succeed before a merge request
+will be accepted. The global pipeline status for the ``master`` branch is
+visible at:
+
+ https://gitlab.com/libvirt/libvirt-python/pipelines
+
+CI pipline results for merge requests will be visible via the contributors'
+own private repository fork:
+
+ https://gitlab.com/::YOUR-USER-NAME::/libvirt-python/pipelines
+
+Contributions submitted to the project must be in compliance with the
+Developer Certificate of Origin Version 1.1. This is documented at:
+
+ https://developercertificate.org/
+
+In indicate compliance, each commit in a series must have a "Signed-off-by"
+tag with the submittor's name and email address. This can be added by passing
+the ``-s`` flag to ``git commit`` when creating the patches.
--
2.26.2
4 years, 6 months
[libvirt PATCH 0/2] CONTRIBUTING: Clean up and improve
by Andrea Bolognani
Andrea Bolognani (2):
CONTRIBUTING: Indent command by three spaces
CONTRIBUTING: Include note about build system tools
CONTRIBUTING.rst | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
--
2.25.4
4 years, 6 months
[libvirt PATCH] gitlab: update list of distros used to use latest versions
by Daniel P. Berrangé
Replace Fedora 30 with Fedora 32
Replace Ubuntu 16.04 with Ubuntu 20.04
Switch generic jobs from Fedora 31 to Fedora 32
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
.gitlab-ci.yml | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 99e7b510c7..d4df2a02cd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -85,14 +85,14 @@ x64-centos-8:
<<: *native_build_extra_job_definition
image: quay.io/libvirt/buildenv-libvirt-centos-8:latest
-x64-fedora-30:
- <<: *native_build_default_job_definition
- image: quay.io/libvirt/buildenv-libvirt-fedora-30:latest
-
x64-fedora-31:
<<: *native_build_extra_job_definition
image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
+x64-fedora-32:
+ <<: *native_build_default_job_definition
+ image: quay.io/libvirt/buildenv-libvirt-fedora-32:latest
+
x64-fedora-rawhide:
<<: *native_build_default_job_definition
image: quay.io/libvirt/buildenv-libvirt-fedora-rawhide:latest
@@ -101,14 +101,14 @@ x64-opensuse-151:
<<: *native_build_default_job_definition
image: quay.io/libvirt/buildenv-libvirt-opensuse-151:latest
-x64-ubuntu-1604:
- <<: *native_build_default_job_definition
- image: quay.io/libvirt/buildenv-libvirt-ubuntu-1604:latest
-
x64-ubuntu-1804:
<<: *native_build_extra_job_definition
image: quay.io/libvirt/buildenv-libvirt-ubuntu-1804:latest
+x64-ubuntu-2004:
+ <<: *native_build_default_job_definition
+ image: quay.io/libvirt/buildenv-libvirt-ubuntu-2004:latest
+
# Cross compiled build jobs
@@ -148,13 +148,13 @@ mipsel-debian-sid:
<<: *cross_build_extra_job_definition
image: quay.io/libvirt/buildenv-libvirt-debian-sid-cross-mipsel:latest
-mingw32-fedora-30:
+mingw32-fedora-rawhide:
<<: *cross_build_default_job_definition
- image: quay.io/libvirt/buildenv-libvirt-fedora-30-cross-mingw32:latest
+ image: quay.io/libvirt/buildenv-libvirt-fedora-rawhide-cross-mingw32:latest
-mingw64-fedora-30:
+mingw64-fedora-rawhide:
<<: *cross_build_default_job_definition
- image: quay.io/libvirt/buildenv-libvirt-fedora-30-cross-mingw64:latest
+ image: quay.io/libvirt/buildenv-libvirt-fedora-rawhide-cross-mingw64:latest
# This artifact published by this job is downloaded by libvirt.org to
@@ -172,7 +172,7 @@ website:
- $MAKE -C docs install
- cd ..
- mv vroot/share/doc/libvirt/html/ website
- image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
+ image: quay.io/libvirt/buildenv-libvirt-fedora-32:latest
artifacts:
expose_as: 'Website'
name: 'website'
@@ -191,7 +191,7 @@ codestyle:
- cd build
- ../autogen.sh || (cat config.log && exit 1)
- $MAKE syntax-check
- image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
+ image: quay.io/libvirt/buildenv-libvirt-fedora-32:latest
# This artifact published by this job is downloaded to push to Weblate
@@ -211,7 +211,7 @@ potfile:
- $MAKE -C po libvirt.pot
- cd ..
- mv build/po/libvirt.pot libvirt.pot
- image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
+ image: quay.io/libvirt/buildenv-libvirt-fedora-32:latest
artifacts:
expose_as: 'Potfile'
name: 'potfile'
@@ -226,7 +226,7 @@ potfile:
# to test developer's personal branches.
dco:
stage: prebuild
- image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
+ image: quay.io/libvirt/buildenv-libvirt-fedora-32:latest
before_script:
- *script_variables
script:
--
2.26.2
4 years, 6 months