[PATCH] ci: regenerate container from manifest
by Daniel P. Berrangé
This removes the libnetcf-dev package from Debian Sid, as it is no
longer available in that distro stream.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
* Pushed as a CI build fix
ci/containers/debian-sid.Dockerfile | 1 -
1 file changed, 1 deletion(-)
diff --git a/ci/containers/debian-sid.Dockerfile b/ci/containers/debian-sid.Dockerfile
index d8667c5f1b..16dd6cc587 100644
--- a/ci/containers/debian-sid.Dockerfile
+++ b/ci/containers/debian-sid.Dockerfile
@@ -46,7 +46,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libglusterfs-dev \
libgnutls28-dev \
libiscsi-dev \
- libnetcf-dev \
libnl-3-dev \
libnl-route-3-dev \
libnuma-dev \
--
2.31.1
3 years, 1 month
[PATCH 00/13] qemu_monitor_json: Use g_auto* more
by Michal Privoznik
*** BLURB HERE ***
Michal Prívozník (13):
qemu_monitor_json: Don't check for qemuMonitorNextCommandID() retval
qemu_monitor_json: Don't transfer ownership to @msg
qemuMonitorJSONHumanCommand: Require @reply_str
qemuMonitorJSONGetMigrationStats: Don't clear @stats on failure
qemuMonitorJSONQueryRxFilterParse: Set *filter only on success
qemu_monitor: Declare and use g_autoptr for qemuMonitorEventPanicInfo
qemu_monitor_json: Use g_autoptr() for virCPUData
qemu_monitor_json: Use g_autoptr() for qemuMonitorCPUModelInfo
qemuMonitorJSONExtractPRManagerInfo: Declare @entry inside the loop
qemu_monitor_json: Use g_autoptr() for virJSONValue
qemu_monitor_json: Use g_autofree
qemu_monitor_json: Drop pointless cleanup labels
qemu_monitor_json: Drop pointless error labels
src/qemu/qemu_monitor.c | 2 +-
src/qemu/qemu_monitor.h | 3 +-
src/qemu/qemu_monitor_json.c | 1803 ++++++++++++----------------------
3 files changed, 641 insertions(+), 1167 deletions(-)
--
2.32.0
3 years, 1 month
[PATCH] lib: Drop intermediary return variables
by Michal Privoznik
In a few places we declare a variable (which is optionally
followed by a code not touching it) then set the variable to a
value and return the variable immediately. It's obvious that the
variable is needless and the value can be returned directly
instead.
This patch was generated using this semantic patch:
@@
type T;
identifier ret;
expression E;
@@
- T ret;
... when != ret
when strict
- ret = E;
- return ret;
+ return E;
After that I fixed couple of formatting issues because coccinelle
formatted some lines differently than our coding style.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/bhyve/bhyve_domain.c | 6 +-----
src/conf/domain_addr.c | 6 +-----
src/conf/domain_conf.c | 5 +----
src/conf/virnetworkobj.c | 4 +---
src/conf/virnwfilterbindingobj.c | 5 +----
src/conf/virnwfilterobj.c | 5 +----
src/esx/esx_driver.c | 5 +----
src/esx/esx_storage_backend_iscsi.c | 5 +----
src/esx/esx_storage_backend_vmfs.c | 5 +----
src/hyperv/hyperv_driver.c | 5 +----
src/locking/lock_daemon.c | 5 +----
src/locking/lock_driver_sanlock.c | 6 ++----
src/logging/log_daemon.c | 5 +----
src/network/bridge_driver.c | 27 +++++----------------------
src/qemu/qemu_alias.c | 24 ++++--------------------
src/qemu/qemu_command.c | 15 ++++++---------
src/qemu/qemu_domain.c | 10 +++-------
src/qemu/qemu_monitor.c | 5 +----
src/security/security_apparmor.c | 5 +----
src/security/security_nop.c | 5 +----
src/test/test_driver.c | 9 ++-------
src/util/viraudit.c | 4 +---
src/util/virfirewall.c | 6 +-----
src/util/virmacmap.c | 6 +-----
src/util/virnetdev.c | 5 +----
src/util/virpci.c | 10 ++--------
src/vbox/vbox_common.c | 7 +++----
tests/bhyvexml2argvmock.c | 5 +----
tests/qemumonitortestutils.c | 5 +----
tests/qemusecuritymock.c | 6 +-----
tests/qemuxml2argvmock.c | 5 +----
tests/virnetserverclienttest.c | 6 +-----
tests/virpcimock.c | 8 ++------
tests/virusbmock.c | 4 +---
34 files changed, 54 insertions(+), 190 deletions(-)
diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c
index 33e74e2e25..b526235a4e 100644
--- a/src/bhyve/bhyve_domain.c
+++ b/src/bhyve/bhyve_domain.c
@@ -36,11 +36,7 @@ VIR_LOG_INIT("bhyve.bhyve_domain");
static void *
bhyveDomainObjPrivateAlloc(void *opaque G_GNUC_UNUSED)
{
- bhyveDomainObjPrivate *priv;
-
- priv = g_new0(bhyveDomainObjPrivate, 1);
-
- return priv;
+ return g_new0(bhyveDomainObjPrivate, 1);
}
static void
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index fe6520cf3a..a06721c35d 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -1862,11 +1862,7 @@ virDomainUSBAddressPortFormat(unsigned int *port)
virDomainUSBAddressSet *
virDomainUSBAddressSetCreate(void)
{
- virDomainUSBAddressSet *addrs;
-
- addrs = g_new0(virDomainUSBAddressSet, 1);
-
- return addrs;
+ return g_new0(virDomainUSBAddressSet, 1);
}
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 15228d1e38..1b36699761 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -28879,10 +28879,7 @@ char
*virDomainConfigFile(const char *dir,
const char *name)
{
- char *ret;
-
- ret = g_strdup_printf("%s/%s.xml", dir, name);
- return ret;
+ return g_strdup_printf("%s/%s.xml", dir, name);
}
/* Translates a device name of the form (regex) "[fhv]d[a-z]+" into
diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index aa629af6f6..f1baffc516 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -1601,9 +1601,7 @@ char *
virNetworkObjGetPortStatusDir(virNetworkObj *net,
const char *stateDir)
{
- char *ret;
- ret = g_strdup_printf("%s/%s/ports", stateDir, net->def->name);
- return ret;
+ return g_strdup_printf("%s/%s/ports", stateDir, net->def->name);
}
int
diff --git a/src/conf/virnwfilterbindingobj.c b/src/conf/virnwfilterbindingobj.c
index 29fbb63b5f..acea240b5d 100644
--- a/src/conf/virnwfilterbindingobj.c
+++ b/src/conf/virnwfilterbindingobj.c
@@ -138,10 +138,7 @@ char *
virNWFilterBindingObjConfigFile(const char *dir,
const char *name)
{
- char *ret;
-
- 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/virnwfilterobj.c b/src/conf/virnwfilterobj.c
index c3b2eb048c..6bbdf6e6fa 100644
--- a/src/conf/virnwfilterobj.c
+++ b/src/conf/virnwfilterobj.c
@@ -117,10 +117,7 @@ virNWFilterObjListFree(virNWFilterObjList *nwfilters)
virNWFilterObjList *
virNWFilterObjListNew(void)
{
- virNWFilterObjList *nwfilters;
-
- nwfilters = g_new0(virNWFilterObjList, 1);
- return nwfilters;
+ return g_new0(virNWFilterObjList, 1);
}
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 5d9687733f..ee752662ec 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1800,10 +1800,7 @@ esxDomainDestroy(virDomainPtr dom)
static char *
esxDomainGetOSType(virDomainPtr domain G_GNUC_UNUSED)
{
- char *osType;
-
- osType = g_strdup("hvm");
- return osType;
+ return g_strdup("hvm");
}
diff --git a/src/esx/esx_storage_backend_iscsi.c b/src/esx/esx_storage_backend_iscsi.c
index d89b5a4ba8..043de1690d 100644
--- a/src/esx/esx_storage_backend_iscsi.c
+++ b/src/esx/esx_storage_backend_iscsi.c
@@ -766,10 +766,7 @@ esxStorageVolWipe(virStorageVolPtr volume G_GNUC_UNUSED,
static char *
esxStorageVolGetPath(virStorageVolPtr volume)
{
- char *path;
-
- path = g_strdup(volume->name);
- return path;
+ return g_strdup(volume->name);
}
diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backend_vmfs.c
index cb2be59a33..5dba813111 100644
--- a/src/esx/esx_storage_backend_vmfs.c
+++ b/src/esx/esx_storage_backend_vmfs.c
@@ -1392,10 +1392,7 @@ esxStorageVolGetXMLDesc(virStorageVolPtr volume,
static char *
esxStorageVolGetPath(virStorageVolPtr volume)
{
- char *path;
-
- path = g_strdup_printf("[%s] %s", volume->pool, volume->name);
- return path;
+ return g_strdup_printf("[%s] %s", volume->pool, volume->name);
}
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index a672901a81..3e6360f2a7 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -2234,10 +2234,7 @@ hypervDomainDestroy(virDomainPtr domain)
static char *
hypervDomainGetOSType(virDomainPtr domain G_GNUC_UNUSED)
{
- char *osType;
-
- osType = g_strdup("hvm");
- return osType;
+ return g_strdup("hvm");
}
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index fa08acbc76..faca4a2485 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -616,10 +616,7 @@ virLockDaemonExecRestartStatePath(bool privileged,
static char *
virLockDaemonGetExecRestartMagic(void)
{
- char *ret;
-
- ret = g_strdup_printf("%lld", (long long int)getpid());
- return ret;
+ return g_strdup_printf("%lld", (long long int)getpid());
}
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 46e2cbc4f0..2dceb1eefc 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -174,13 +174,11 @@ static int
virLockManagerSanlockInitLockspace(virLockManagerSanlockDriver *driver,
struct sanlk_lockspace *ls)
{
- int ret;
-
const int max_hosts = 0; /* defaults used in sanlock_init() implementation */
const unsigned int lockspaceFlags = 0;
- ret = sanlock_write_lockspace(ls, max_hosts, lockspaceFlags, driver->io_timeout);
- return ret;
+ return sanlock_write_lockspace(ls, max_hosts, lockspaceFlags,
+ driver->io_timeout);
}
/* How many times try adding a lockspace? */
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 1b04fbdae8..cc7889399b 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -423,10 +423,7 @@ virLogDaemonExecRestartStatePath(bool privileged,
static char *
virLogDaemonGetExecRestartMagic(void)
{
- char *ret;
-
- ret = g_strdup_printf("%lld", (long long int)getpid());
- return ret;
+ return g_strdup_printf("%lld", (long long int)getpid());
}
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 7027dc636c..498c45d0a7 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -365,10 +365,7 @@ static char *
networkDnsmasqLeaseFileNameDefault(virNetworkDriverState *driver,
const char *netname)
{
- char *leasefile;
-
- leasefile = g_strdup_printf("%s/%s.leases", driver->dnsmasqStateDir, netname);
- return leasefile;
+ return g_strdup_printf("%s/%s.leases", driver->dnsmasqStateDir, netname);
}
@@ -376,10 +373,7 @@ static char *
networkDnsmasqLeaseFileNameCustom(virNetworkDriverState *driver,
const char *bridge)
{
- char *leasefile;
-
- leasefile = g_strdup_printf("%s/%s.status", driver->dnsmasqStateDir, bridge);
- return leasefile;
+ return g_strdup_printf("%s/%s.status", driver->dnsmasqStateDir, bridge);
}
@@ -387,21 +381,13 @@ static char *
networkDnsmasqConfigFileName(virNetworkDriverState *driver,
const char *netname)
{
- char *conffile;
-
- conffile = g_strdup_printf("%s/%s.conf", driver->dnsmasqStateDir, netname);
- return conffile;
+ return g_strdup_printf("%s/%s.conf", driver->dnsmasqStateDir, netname);
}
static char *
networkRadvdPidfileBasename(const char *netname)
-{
- /* this is simple but we want to be sure it's consistently done */
- char *pidfilebase;
-
- pidfilebase = g_strdup_printf("%s-radvd", netname);
- return pidfilebase;
+{return g_strdup_printf("%s-radvd", netname);
}
@@ -409,10 +395,7 @@ static char *
networkRadvdConfigFileName(virNetworkDriverState *driver,
const char *netname)
{
- char *configfile;
-
- configfile = g_strdup_printf("%s/%s-radvd.conf", driver->radvdStateDir, netname);
- return configfile;
+ return g_strdup_printf("%s/%s-radvd.conf", driver->radvdStateDir, netname);
}
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index 276a03cb56..a36f346592 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -804,11 +804,7 @@ qemuAliasFromHostdev(const virDomainHostdevDef *hostdev)
char *
qemuDomainGetMasterKeyAlias(void)
{
- char *alias;
-
- alias = g_strdup("masterKey0");
-
- return alias;
+ return g_strdup("masterKey0");
}
@@ -837,11 +833,7 @@ qemuAliasForSecret(const char *parentalias,
char *
qemuAliasTLSObjFromSrcAlias(const char *srcAlias)
{
- char *ret;
-
- ret = g_strdup_printf("obj%s_tls0", srcAlias);
-
- return ret;
+ return g_strdup_printf("obj%s_tls0", srcAlias);
}
@@ -853,11 +845,7 @@ qemuAliasTLSObjFromSrcAlias(const char *srcAlias)
char *
qemuAliasChardevFromDevAlias(const char *devAlias)
{
- char *ret;
-
- ret = g_strdup_printf("char%s", devAlias);
-
- return ret;
+ return g_strdup_printf("char%s", devAlias);
}
@@ -871,11 +859,7 @@ qemuDomainGetManagedPRAlias(void)
char *
qemuDomainGetUnmanagedPRAlias(const char *parentalias)
{
- char *ret;
-
- ret = g_strdup_printf("pr-helper-%s", parentalias);
-
- return ret;
+ return g_strdup_printf("pr-helper-%s", parentalias);
}
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d6df50ec73..335bad5616 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3811,18 +3811,15 @@ qemuBuildMemoryDeviceProps(const virDomainDef *def,
static char *
qemuBuildLegacyNicStr(virDomainNetDef *net)
{
- char *str;
char macaddr[VIR_MAC_STRING_BUFLEN];
const char *netmodel = virDomainNetGetModelString(net);
- str = g_strdup_printf("nic,macaddr=%s,netdev=host%s%s%s%s%s",
- virMacAddrFormat(&net->mac, macaddr),
- net->info.alias,
- netmodel ? ",model=" : "",
- NULLSTR_EMPTY(netmodel),
- (net->info.alias ? ",id=" : ""),
- NULLSTR_EMPTY(net->info.alias));
- return str;
+ return g_strdup_printf("nic,macaddr=%s,netdev=host%s%s%s%s%s",
+ virMacAddrFormat(&net->mac, macaddr),
+ net->info.alias, netmodel ? ",model=" : "",
+ NULLSTR_EMPTY(netmodel),
+ (net->info.alias ? ",id=" : ""),
+ NULLSTR_EMPTY(net->info.alias));
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index e719c7b8c7..d0cb2eebed 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5944,13 +5944,9 @@ qemuDomainDefFromXML(virQEMUDriver *driver,
virQEMUCaps *qemuCaps,
const char *xml)
{
- virDomainDef *def;
-
- def = virDomainDefParseString(xml, driver->xmlopt, qemuCaps,
- VIR_DOMAIN_DEF_PARSE_INACTIVE |
- VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE);
-
- return def;
+ return virDomainDefParseString(xml, driver->xmlopt, qemuCaps,
+ VIR_DOMAIN_DEF_PARSE_INACTIVE |
+ VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE);
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 6b6d6cd613..81d9087839 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -920,10 +920,7 @@ qemuMonitorClose(qemuMonitor *mon)
char *
qemuMonitorNextCommandID(qemuMonitor *mon)
{
- char *id;
-
- id = g_strdup_printf("libvirt-%d", ++mon->nextSerial);
- return id;
+ return g_strdup_printf("libvirt-%d", ++mon->nextSerial);
}
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 2cc15ba6af..dadcfd67db 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -1169,10 +1169,7 @@ static char *
AppArmorGetMountOptions(virSecurityManager *mgr G_GNUC_UNUSED,
virDomainDef *vm G_GNUC_UNUSED)
{
- char *opts;
-
- opts = g_strdup("");
- return opts;
+ return g_strdup("");
}
static const char *
diff --git a/src/security/security_nop.c b/src/security/security_nop.c
index a634e7f3fe..0b3d37142a 100644
--- a/src/security/security_nop.c
+++ b/src/security/security_nop.c
@@ -178,10 +178,7 @@ static char *
virSecurityDomainGetMountOptionsNop(virSecurityManager *mgr G_GNUC_UNUSED,
virDomainDef *vm G_GNUC_UNUSED)
{
- char *opts;
-
- opts = g_strdup("");
- return opts;
+ return g_strdup("");
}
static const char *
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index b5413cc03d..fd7486b8ca 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1666,7 +1666,6 @@ static char *
testConnectGetSysinfo(virConnectPtr conn G_GNUC_UNUSED,
unsigned int flags)
{
- char *ret;
const char *sysinfo = "<sysinfo type='smbios'>\n"
" <bios>\n"
" <entry name='vendor'>LENOVO</entry>\n"
@@ -1678,8 +1677,7 @@ testConnectGetSysinfo(virConnectPtr conn G_GNUC_UNUSED,
virCheckFlags(0, NULL);
- ret = g_strdup(sysinfo);
- return ret;
+ return g_strdup(sysinfo);
}
static const char *
@@ -2706,10 +2704,7 @@ testDomainCoreDump(virDomainPtr domain,
static char *
testDomainGetOSType(virDomainPtr dom G_GNUC_UNUSED)
{
- char *ret;
-
- ret = g_strdup("linux");
- return ret;
+ return g_strdup("linux");
}
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index bbd2462897..76ad3a73ed 100644
--- a/src/util/viraudit.c
+++ b/src/util/viraudit.c
@@ -140,8 +140,6 @@ char *virAuditEncode(const char *key, const char *value)
#if WITH_AUDIT
return audit_encode_nv_string(key, value, 0);
#else
- char *str;
- str = g_strdup_printf("%s=%s", key, value);
- return str;
+ return g_strdup_printf("%s=%s", key, value);
#endif
}
diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c
index fb02992912..1a546335f6 100644
--- a/src/util/virfirewall.c
+++ b/src/util/virfirewall.c
@@ -157,11 +157,7 @@ virFirewallSetBackend(virFirewallBackend backend)
static virFirewallGroup *
virFirewallGroupNew(void)
{
- virFirewallGroup *group;
-
- group = g_new0(virFirewallGroup, 1);
-
- return group;
+ return g_new0(virFirewallGroup, 1);
}
diff --git a/src/util/virmacmap.c b/src/util/virmacmap.c
index 297d57a931..fb16062cd1 100644
--- a/src/util/virmacmap.c
+++ b/src/util/virmacmap.c
@@ -267,11 +267,7 @@ char *
virMacMapFileName(const char *dnsmasqStateDir,
const char *bridge)
{
- char *filename;
-
- filename = g_strdup_printf("%s/%s.macs", dnsmasqStateDir, bridge);
-
- return filename;
+ return g_strdup_printf("%s/%s.macs", dnsmasqStateDir, bridge);
}
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 5b4c585716..58f7360a0f 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -2803,10 +2803,7 @@ static int virNetDevGetMulticastTable(const char *ifname,
virNetDevRxFilter *
virNetDevRxFilterNew(void)
{
- virNetDevRxFilter *filter;
-
- filter = g_new0(virNetDevRxFilter, 1);
- return filter;
+ return g_new0(virNetDevRxFilter, 1);
}
diff --git a/src/util/virpci.c b/src/util/virpci.c
index e746a2b25b..2d12e28004 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1438,14 +1438,8 @@ void virPCIDeviceAddressCopy(virPCIDeviceAddress *dst,
char *
virPCIDeviceAddressAsString(const virPCIDeviceAddress *addr)
{
- char *str;
-
- str = g_strdup_printf(VIR_PCI_DEVICE_ADDRESS_FMT,
- addr->domain,
- addr->bus,
- addr->slot,
- addr->function);
- return str;
+ return g_strdup_printf(VIR_PCI_DEVICE_ADDRESS_FMT, addr->domain,
+ addr->bus, addr->slot, addr->function);
}
bool
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 7334254a36..45e7225ae1 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -2699,16 +2699,15 @@ static int vboxDomainDestroy(virDomainPtr dom)
return vboxDomainDestroyFlags(dom, 0);
}
-static char *vboxDomainGetOSType(virDomainPtr dom G_GNUC_UNUSED) {
+static char *vboxDomainGetOSType(virDomainPtr dom G_GNUC_UNUSED)
+{
/* Returning "hvm" always as suggested on list, cause
* this functions seems to be badly named and it
* is supposed to pass the ABI name and not the domain
* operating system driver as I had imagined ;)
*/
- char *osType;
- osType = g_strdup("hvm");
- return osType;
+ return g_strdup("hvm");
}
static int vboxDomainSetMemory(virDomainPtr dom, unsigned long memory)
diff --git a/tests/bhyvexml2argvmock.c b/tests/bhyvexml2argvmock.c
index f3820ef032..9b77f97e5f 100644
--- a/tests/bhyvexml2argvmock.c
+++ b/tests/bhyvexml2argvmock.c
@@ -74,10 +74,7 @@ int virNetDevTapCreateInBridgePort(const char *brname G_GNUC_UNUSED,
char *virNetDevTapGetRealDeviceName(char *name G_GNUC_UNUSED)
{
- char *fakename;
-
- fakename = g_strdup("faketapdev");
- return fakename;
+ return g_strdup("faketapdev");
}
int virNetDevSetOnline(const char *ifname G_GNUC_UNUSED,
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 35a1bce071..75a6a76b92 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -1282,13 +1282,10 @@ qemuMonitorTestFullAddItem(qemuMonitorTest *test,
size_t line)
{
g_autofree char *cmderr = NULL;
- int ret;
cmderr = g_strdup_printf("wrong expected command in %s:%zu: ", filename, line);
- ret = qemuMonitorTestAddItemVerbatim(test, command, cmderr, response);
-
- return ret;
+ return qemuMonitorTestAddItemVerbatim(test, command, cmderr, response);
}
diff --git a/tests/qemusecuritymock.c b/tests/qemusecuritymock.c
index 87aadf564e..f092383b62 100644
--- a/tests/qemusecuritymock.c
+++ b/tests/qemusecuritymock.c
@@ -128,11 +128,7 @@ static char *
get_key(const char *path,
const char *name)
{
- char *ret;
-
- ret = g_strdup_printf("%s:%s", path, name);
-
- return ret;
+ return g_strdup_printf("%s:%s", path, name);
}
diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index 2265492f1e..f4e2f52680 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -107,12 +107,9 @@ virNumaNodesetIsAvailable(virBitmap *nodeset)
char *
virTPMCreateCancelPath(const char *devpath)
{
- char *path;
(void)devpath;
- path = g_strdup("/sys/class/misc/tpm0/device/cancel");
-
- return path;
+ return g_strdup("/sys/class/misc/tpm0/device/cancel");
}
/**
diff --git a/tests/virnetserverclienttest.c b/tests/virnetserverclienttest.c
index 942901bf60..d3c817f70d 100644
--- a/tests/virnetserverclienttest.c
+++ b/tests/virnetserverclienttest.c
@@ -30,11 +30,7 @@ static void *
testClientNew(virNetServerClient *client G_GNUC_UNUSED,
void *opaque G_GNUC_UNUSED)
{
- char *dummy;
-
- dummy = g_new0(char, 1);
-
- return dummy;
+ return g_new0(char, 1);
}
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 0f8d5ad54f..f65ae7c0c5 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -351,12 +351,8 @@ remove_fd(int fd)
static char *
pci_address_format(struct pciDeviceAddress const *addr)
{
- char *ret;
-
- ret = g_strdup_printf(ADDR_STR_FMT,
- addr->domain, addr->bus,
- addr->device, addr->function);
- return ret;
+ return g_strdup_printf(ADDR_STR_FMT, addr->domain, addr->bus,
+ addr->device, addr->function);
}
static int
diff --git a/tests/virusbmock.c b/tests/virusbmock.c
index a1f539b8b1..5b09895197 100644
--- a/tests/virusbmock.c
+++ b/tests/virusbmock.c
@@ -64,14 +64,12 @@ static char *get_fake_path(const char *real_path)
DIR *opendir(const char *name)
{
g_autofree char *path = NULL;
- DIR* ret;
init_syms();
path = get_fake_path(name);
- ret = realopendir(path);
- return ret;
+ return realopendir(path);
}
int open(const char *pathname, int flags, ...)
--
2.32.0
3 years, 1 month
[PATCH v3 0/5] qapi: Add feature flags to enum members
by Markus Armbruster
PATCH 1+2 add feature flags to enum members. Awkward due to an
introspection design mistake; see PATCH 1 for details.
PATCH 3+4 implement policy deprecated-input={reject,crash} for enum
values.
Policy deprecated-output=hide is not implemented, because we can't
hide a value without hiding the entire member, which is almost
certainly more than the requester of this policy bargained for.
Perhaps we want a new policy deprecated-output=hide-or-else-crash to
help us catch unwanted use of deprecated enum values. Perhaps we want
deprecated-output=hide to behave that way together with
deprecated-input=crash. Or even always. Thoughts?
PATCH 5 puts the new feature flags to use. It's RFC because it makes
sense only on top of Vladimir's deprecation of drive-backup. See its
commit message for a reference.
I prefer to commit new features together with a use outside tests/.
PATCH 5 adds such a use, but it's RFC, because it depends on
Vladimir's work. Perhaps another use pops up. I can delay this work
in the hope of a use becoming ready, but the feature flags work I have
in the pipeline will eventually force my hand.
v3:
* PATCH 1+2: Update qapi-code-gen.rst [Kevin, Eric]
* PATCH 4: Commit message typo [Eric], doc update moved to PATCH 2
* PATCH 5: Doc comment FIXME resolved [Kevin]
v2:
* Rebased with straightforward conflicts.
* PATCH 1-4: No longer RFC.
* PATCH 1: "Since" information fixed [Eric]. Commit message updated
to reflect feedback.
* PATCH 2: Commit message amended to point out special feature flag
'deprecated' is ignored at this stage.
* PATCH 4: Documentation updated. Commit message tweaked.
Markus Armbruster (5):
qapi: Enable enum member introspection to show more than name
qapi: Add feature flags to enum members
qapi: Move compat policy from QObject to generic visitor
qapi: Implement deprecated-input={reject,crash} for enum values
block: Deprecate transaction type drive-backup
docs/devel/qapi-code-gen.rst | 29 ++++++++++++++-----
qapi/compat.json | 3 ++
qapi/introspect.json | 24 +++++++++++++--
qapi/transaction.json | 6 +++-
include/qapi/qobject-input-visitor.h | 4 ---
include/qapi/qobject-output-visitor.h | 4 ---
include/qapi/util.h | 6 +++-
include/qapi/visitor-impl.h | 3 ++
include/qapi/visitor.h | 9 ++++++
qapi/qapi-visit-core.c | 27 +++++++++++++++--
qapi/qmp-dispatch.c | 4 +--
qapi/qobject-input-visitor.c | 14 +--------
qapi/qobject-output-visitor.c | 14 +--------
scripts/qapi/expr.py | 3 +-
scripts/qapi/introspect.py | 19 +++++++++---
scripts/qapi/schema.py | 22 ++++++++++++--
scripts/qapi/types.py | 17 ++++++++++-
tests/qapi-schema/doc-good.json | 5 +++-
tests/qapi-schema/doc-good.out | 3 ++
tests/qapi-schema/doc-good.txt | 3 ++
.../qapi-schema/enum-dict-member-unknown.err | 2 +-
tests/qapi-schema/qapi-schema-test.json | 3 +-
tests/qapi-schema/qapi-schema-test.out | 1 +
tests/qapi-schema/test-qapi.py | 1 +
24 files changed, 164 insertions(+), 62 deletions(-)
--
2.31.1
3 years, 1 month
[libvirt PATCH 0/1] [RFC] Ignore EPERM on attempts to clear a VF VLAN ID
by Dmitrii Shcherbakov
SmartNIC DPUs may not expose some privileged eswitch operations
to the hypervisor hosts. For example, this happens with Bluefield
devices running in the ECPF (default) mode [1] for security reasons.
While VF MAC address programming is possible via an RTM_SETLINK
operation, trying to set a VLAN ID in the same operation will fail with
EPERM.
The equivalent ip link commands below provide an illustration:
1. This works (ECPF mode):
sudo ip link set enp130s0f0 vf 2 mac de:ad:be:ef:ca:fe
2. Setting (or clearing) a VLAN fails with EPERM:
sudo ip link set enp130s0f0 vf 2 vlan 0
RTNETLINK answers: Operation not permitted
3. This is what Libvirt attempts to do today (when trying to clear a
VF VLAN at the same time as programming a VF MAC).
sudo ip link set enp130s0f0 vf 2 vlan 0 mac de:ad:be:ef:ca:fe
RTNETLINK answers: Operation not permitted
If setting an explicit VLAN ID results in an EPERM, clearing a VLAN
(setting a VLAN ID to 0) can be handled gracefully by ignoring the
EPERM error with the rationale being that if we cannot set this state
in the first place, we cannot clear it either. The downside is that we
do not know if the VLAN setting operation failed previously with the
same error or if it succeded and it is just clearing that fails with
EPERM but this seems like a very unlikely scenario.
Thus, virNetDevSetVfConfig is split into two distinct functions. If
clearing a VLAN ID fails with EPERM, the error is simply ignored.
An alternative to this could be providing a higher level control plane
mechanism that would provide metadata about a device being remotely
managed in which case Libvirt would avoid trying to set or clear a
VLAN ID. This would be more complicated since other software (like Nova
in the OpenStack case) would have to annotate every guest device with an
attribute indicating whether a device is remotely managed or not based
on operator provided configuration so that Libvirt can act on this and
avoid VLAN programming.
Note: this is an RFC to get some feedback before going into adding
additional test cases and possibly reducing duplication in how the
requests are formed.
[1] https://docs.mellanox.com/display/BlueFieldSWv35111601/Modes+of+Operation...
Dmitrii Shcherbakov (1):
Ignore EPERM on attempts to clear VF VLAN ID
src/util/virnetdev.c | 144 +++++++++++++++++++++++++++++++++++++------
1 file changed, 124 insertions(+), 20 deletions(-)
--
2.32.0
3 years, 1 month
[libvirt PATCH 00/13] cgroup and thread management in ch driver.
by Vineeth Pillai
This patchset adds support for cgroup management of ch threads. This version
correctly manages cgroups for vcpu and emulator threads created by ch. cgroup
management for iothreads is not yet supported.
Along with cgroup management, this patchset also enables support for pinning
vcpu and emulator threads to selected host cpus.
Praveen K Paladugu (2):
ch_process: Setup emulator and iothread settings
ch_driver: emulator threadinfo & pinning callbacks
Vineeth Pillai (11):
util: Helper functions to get process info
ch: Explicitly link to virt_util_lib
ch_domain: add virCHDomainGetMonitor helper method
ch_domain: add methods to manage private vcpu data
ch_driver,ch_domain: vcpu info getter callbacks
ch_driver: domainGetVcpuPinInfo and nodeGetCPUMap
ch_monitor: Get nicindexes in prep for cgroup mgmt
ch_cgroup: methods for cgroup mgmt in ch driver
ch_driver,ch_domain: vcpupin callback in ch driver
ch_driver: enable typed param string for numatune
ch_driver: add numatune callbacks for CH driver
po/POTFILES.in | 1 +
src/ch/ch_cgroup.c | 457 ++++++++++++++++++++++++
src/ch/ch_cgroup.h | 45 +++
src/ch/ch_conf.c | 2 +
src/ch/ch_conf.h | 9 +-
src/ch/ch_domain.c | 170 ++++++++-
src/ch/ch_domain.h | 32 +-
src/ch/ch_driver.c | 810 +++++++++++++++++++++++++++++++++++++++++-
src/ch/ch_monitor.c | 254 ++++++++++++-
src/ch/ch_monitor.h | 60 +++-
src/ch/ch_process.c | 368 ++++++++++++++++++-
src/ch/ch_process.h | 3 +
src/ch/meson.build | 6 +
src/util/virprocess.c | 136 +++++++
src/util/virprocess.h | 5 +
15 files changed, 2329 insertions(+), 29 deletions(-)
create mode 100644 src/ch/ch_cgroup.c
create mode 100644 src/ch/ch_cgroup.h
--
2.27.0
3 years, 1 month
[PATCH 0/4] virt-aa-helper: Add new option to remove corrupted
by Ioanna Alifieraki
This patch-series aims to address the bug reported in [1] and [2].
Bug description :
Some times libvirt fails to start a vm with the following error :
libvirt: error : unable to set AppArmor profile 'libvirt-b05b297f-952f-42d6-b04e-f9a13767db54' for '/usr/bin/kvm-spice': No such file or directory
This happens because file /etc/apparmor.d/libvirt/libvirt-<vm-uuid> has 0 size.
During the vm start-up virt-aa-helper tries to load the profile and because it is 0 it fails.
When file /etc/apparmor.d/libvirt/libvirt-<vm-uuid> is removed the vm can start without problems.
To address this issue this patch-series suggests the following.
On the vm start-up check if the profile has 0 size and if this is the case
remove it and create it again.
To do so a new option (-P) is introduced and also create and remove profile
fuctionalities are placed into separate functions.
The first commit moves create and remove functionlites into functinos for later
reuse from different places.
The second commit adds a new option (-P) to remove the profile file.
The thid commit implements the actual fix (check if the profile has 0 size and if
so remove it and create it again).
The fourth patch adds a test for the above fix.
[1] https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1927519
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=890084
Ioanna Alifieraki (4):
virt-aa-helper: Move create and remove profile into separate functions
virt-aa-helper: Add new purge (-P) option
virt-aa-helper: Purge profile if corrupted
virt-aa-helper: test: add test for new option -P
src/security/virt-aa-helper.c | 87 ++++++++++++++++++++++++++---------
tests/meson.build | 1 +
tests/virt-aa-helper-test | 29 ++++++++++++
3 files changed, 96 insertions(+), 21 deletions(-)
--
2.17.1
3 years, 1 month
[libvirt PATCH v7 0/5] Add a PCI/PCIe device VPD Capability
by Dmitrii Shcherbakov
Add support for deserializing the binary PCI/PCIe VPD format and
exposing VPD resources as XML elements in a new nested capability
of PCI/PCIe devices called 'vpd'.
The series contains the following incremental changes:
* The PCI VPD parser module, in-memory resource representation
and tests;
* VPD-related helpers added to the virpci module;
* VPD capability support: XML serialization/deserialization from/into
VPD resource data structures;
* Documentation.
The VPD format is specified in "I.3. VPD Definitions" in PCI specs
(2.2+) and "6.28.1 VPD Format" PCIe 4.0. As section 6.28 in PCIe 4.0
notes, the PCI Local Bus and PCIe VPD formats are binary compatible
and PCIe 4.0 merely started incorporating what was already present in
PCI specs.
Linux kernel exposes a binary blob in the VPD format via sysfs since
v2.6.26 (commit 94e6108803469a37ee1e3c92dafdd1d59298602f) which requires
a parser to interpret.
There are usage scenarios where information such as the board serial
number needs to be retrieved from PCI(e) VPD. Projects like Nova can
utilize this information for cases which involve virtual interface
plugging on SmartNIC DPUs but there may be other scenarios and types of
information useful to retrieve from VPD. The fact that the format is
binary requires proper parsing instead of substring searching hence the
full parser is proposed. Likewise, checksum validation requires proper
parsing as well.
A usage example is present here:
https://review.opendev.org/c/openstack/nova/+/808199
The patch follows a prior discussion on the mailing list which has
additional context about the use-case but a narrower proposal:
https://listman.redhat.com/archives/libvir-list/2021-May/msg00873.html
https://www.mail-archive.com/libvir-list@redhat.com/msg218165.html
The new functionality is mostly contained in virpcivpd with a
couple of new functions added to virpci. Additionally, the necessary XML
serialization/deserialization and glue code is added to expose the VPD
capability to external clients as XML.
A new capability flag is added along with a new capability in order to
allow for filtering of PCI devices with the VPD capability using virsh:
virsh nodedev-list --cap vpd
sudo virsh nodedev-dumpxml --device pci_dddd_bb_ss_f
In this example having the root uid is required in order to access the
vpd sysfs entry, therefore, the nodedev XML output will only contain
the VPD capability if virsh is run as root.
The capability is treated as dynamic due to the presence of read-write
sections in the VPD format per PCI/PCIe specs (the idea being that
read-write resource fields may potentially be altered by the DPU OS
over time independently from the host OS).
Unit tests cover the parser functionality (including many possible
invalid cases), in-memory representation as well as XML serialization
and deserialization.
Manual functional testing was performed with 2 DPUs and several other
NIC models which expose PCI(e) VPD. Testing have also been performed
for devices that do not have VPD or those that expose a VPD capability
but exhibit invalid behavior (I/O errors while reading a sysfs entry).
v7 changes:
* Fixed a number of memleaks in virpcivpd.c, virpcivpdtest.c,
node_device_conf.c (see the test results in a paste below);
* Moved some preprocessor definitions and virPCIVPDResourceFieldValueFormat
to virpcivpdpriv.h (not the .c file since those are used in unit tests);
* virPCIVPDResourceUpdateKeyword now prints a warning and returns true for
unexpected keywords, whereas virPCIVPDParseVPDLargeResourceFields fails
on errors returned from virPCIVPDResourceUpdateKeyword;
* Updates to static fields now free the memory allocated to old values.
Build & test results for targets in ci/manifest.yaml:
ci/helper test --meson-args='-Dexpensive_tests=enabled' <target>
as well as valgrind results for the following:
valgrind --leak-check=full build/tests/virpcivpdtest
valgrind --leak-check=full build/tests/nodedevxml2xmltest
valgrind --leak-check=full build/tests/virpcitest
https://gist.github.com/dshcherb/b2c92f8d0eabab818ea1e2113d585ab4
Dmitrii Shcherbakov (5):
Add a PCI/PCIe device VPD Parser
Add PCI VPD-related helper functions to virpci
Add PCI VPD Capability Support
Add PCI VPD Capability Documentation
news: Add PCI VPD parser & capability notes
NEWS.rst | 22 +
build-aux/syntax-check.mk | 4 +-
docs/drvnodedev.html.in | 69 ++
docs/formatnode.html.in | 63 +-
docs/schemas/nodedev.rng | 96 +++
include/libvirt/libvirt-nodedev.h | 1 +
po/POTFILES.in | 1 +
src/conf/node_device_conf.c | 309 +++++++
src/conf/node_device_conf.h | 7 +-
src/conf/virnodedeviceobj.c | 7 +-
src/libvirt_private.syms | 20 +
src/node_device/node_device_driver.c | 2 +
src/node_device/node_device_udev.c | 2 +
src/util/meson.build | 1 +
src/util/virpci.c | 70 ++
src/util/virpci.h | 4 +
src/util/virpcivpd.c | 754 ++++++++++++++++
src/util/virpcivpd.h | 76 ++
src/util/virpcivpdpriv.h | 83 ++
tests/meson.build | 1 +
.../pci_0000_42_00_0_vpd.xml | 42 +
.../pci_0000_42_00_0_vpd.xml | 1 +
tests/nodedevxml2xmltest.c | 1 +
tests/testutils.c | 35 +
tests/testutils.h | 4 +
tests/virpcimock.c | 32 +
tests/virpcitest.c | 39 +
tests/virpcivpdtest.c | 809 ++++++++++++++++++
tools/virsh-nodedev.c | 3 +
29 files changed, 2553 insertions(+), 5 deletions(-)
create mode 100644 src/util/virpcivpd.c
create mode 100644 src/util/virpcivpd.h
create mode 100644 src/util/virpcivpdpriv.h
create mode 100644 tests/nodedevschemadata/pci_0000_42_00_0_vpd.xml
create mode 120000 tests/nodedevxml2xmlout/pci_0000_42_00_0_vpd.xml
create mode 100644 tests/virpcivpdtest.c
--
2.32.0
3 years, 1 month
[PATCH v2 0/6] qemu_monitor_json: Assume existence of some commands
by Michal Privoznik
Technically a v2 of:
https://listman.redhat.com/archives/libvir-list/2021-October/msg00825.html
but I've cancelled sending in the middle of v1. Anyway, patch 1/6 is new
(yeah, I've noticed a test failing so I've cancelled sending v1).
Michal Prívozník (6):
qemumigparamstest: Drop "unsupported" test case
qemuMonitorJSONGetMigrationParams: Don't return early on
CommandNotFound
qemuMonitorJSONGetDumpGuestMemoryCapability: Don't return early on
CommandNotFound
qemuMonitorJSONGetKVMState: Don't return early on CommandNotFound
qemuMonitorJSONGetMemoryDeviceInfo: Don't return early on
CommandNotFound
qemuMonitorJSONGetMigrationCapabilities: Don't return early on
CommandNotFound
src/qemu/qemu_monitor_json.c | 23 -----------------------
tests/qemumigparamsdata/unsupported.json | 3 ---
tests/qemumigparamsdata/unsupported.reply | 7 -------
tests/qemumigparamsdata/unsupported.xml | 4 ----
tests/qemumigparamstest.c | 1 -
5 files changed, 38 deletions(-)
delete mode 100644 tests/qemumigparamsdata/unsupported.json
delete mode 100644 tests/qemumigparamsdata/unsupported.reply
delete mode 100644 tests/qemumigparamsdata/unsupported.xml
--
2.32.0
3 years, 1 month
[PATCH v4 0/5] Add support for librbd encryption
by Or Ozeri
v4:
- added disk post parse to image creation flow in qemublocktest (since more tests failed after adding engine validation)
- removed symlink changes
- added luks2 and engine documentation
- switched to using enum engine instead of int
- added validation for encryption engine and formats
v3: rebased on master
v2: addressed (hopefully) all of Peter's v1 comments (thanks Peter!)
Or Ozeri (5):
qemu: add disk post parse to qemublocktest
qemu: capablities: Detect presence of 'rbd-encryption' as
QEMU_CAPS_RBD_ENCRYPTION
conf: add encryption engine property
qemu: add librbd encryption engine
conf: add luks2 encryption format
docs/formatstorageencryption.html.in | 23 ++++-
docs/schemas/domainbackup.rng | 7 ++
docs/schemas/storagecommon.rng | 9 ++
src/conf/storage_encryption_conf.c | 29 ++++++-
src/conf/storage_encryption_conf.h | 11 +++
src/qemu/qemu_block.c | 33 ++++++++
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_domain.c | 61 +++++++++++++-
src/qemu/qemu_domain.h | 3 +
tests/qemublocktest.c | 29 +++----
.../caps_6.1.0.x86_64.xml | 1 +
tests/qemustatusxml2xmldata/upgrade-out.xml | 6 +-
...sk-network-rbd-encryption.x86_64-6.0.0.err | 1 +
...-network-rbd-encryption.x86_64-latest.args | 49 +++++++++++
.../disk-network-rbd-encryption.xml | 75 +++++++++++++++++
tests/qemuxml2argvdata/disk-nvme.xml | 2 +-
.../qemuxml2argvdata/encrypted-disk-usage.xml | 2 +-
tests/qemuxml2argvdata/luks-disks.xml | 4 +-
tests/qemuxml2argvdata/user-aliases.xml | 2 +-
tests/qemuxml2argvtest.c | 2 +
...k-network-rbd-encryption.x86_64-latest.xml | 83 +++++++++++++++++++
.../disk-slices.x86_64-latest.xml | 4 +-
tests/qemuxml2xmloutdata/encrypted-disk.xml | 2 +-
.../luks-disks-source-qcow2.x86_64-latest.xml | 14 ++--
.../qemuxml2xmloutdata/luks-disks-source.xml | 10 +--
tests/qemuxml2xmltest.c | 1 +
27 files changed, 421 insertions(+), 45 deletions(-)
create mode 100644 tests/qemuxml2argvdata/disk-network-rbd-encryption.x86_64-6.0.0.err
create mode 100644 tests/qemuxml2argvdata/disk-network-rbd-encryption.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-network-rbd-encryption.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-network-rbd-encryption.x86_64-latest.xml
--
2.25.1
3 years, 1 month