[libvirt] [PATCH] virstring: Unify string list function names
by Michal Privoznik
We have couple of functions that operate over NULL terminated
lits of strings. However, our naming sucks:
virStringJoin
virStringFreeList
virStringFreeListCount
virStringArrayHasString
virStringGetFirstWithPrefix
We can do better:
virStringListJoin
virStringListFree
virStringListFreeCount
virStringListHasString
virStringListGetFirstWithPrefix
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
daemon/remote.c | 2 +-
src/bhyve/bhyve_command.c | 2 +-
src/bhyve/bhyve_parse_command.c | 14 +++++++-------
src/conf/domain_capabilities.c | 2 +-
src/cpu/cpu_ppc64.c | 2 +-
src/cpu/cpu_x86.c | 2 +-
src/libvirt_private.syms | 10 +++++-----
src/lxc/lxc_container.c | 2 +-
src/lxc/lxc_native.c | 24 ++++++++++++------------
src/openvz/openvz_conf.c | 2 +-
src/qemu/qemu_agent.c | 4 ++--
src/qemu/qemu_capabilities.c | 20 ++++++++++----------
src/qemu/qemu_conf.c | 10 +++++-----
src/qemu/qemu_domain.c | 6 +++---
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_monitor_json.c | 18 +++++++++---------
src/qemu/qemu_monitor_text.c | 6 +++---
src/qemu/qemu_parse_command.c | 22 +++++++++++-----------
src/qemu/qemu_process.c | 8 ++++----
src/remote/remote_driver.c | 2 +-
src/storage/storage_backend_sheepdog.c | 6 +++---
src/storage/storage_backend_zfs.c | 12 ++++++------
src/storage/storage_driver.c | 2 +-
src/util/vircgroup.c | 8 ++++----
src/util/vircommand.c | 2 +-
src/util/virconf.c | 4 ++--
src/util/virfile.c | 6 +++---
src/util/virfirewall.c | 2 +-
src/util/virfirmware.c | 4 ++--
src/util/virlog.c | 8 ++++----
src/util/virpolkit.c | 2 +-
src/util/virprocess.c | 2 +-
src/util/virstoragefile.c | 16 ++++++++--------
src/util/virstring.c | 32 ++++++++++++++++----------------
src/util/virstring.h | 12 ++++++------
src/util/viruri.c | 2 +-
src/vbox/vbox_common.c | 10 +++++-----
src/vbox/vbox_snapshot_conf.c | 18 +++++++++---------
src/vz/vz_sdk.c | 2 +-
tests/domainsnapshotxml2xmltest.c | 2 +-
tests/qemumonitorjsontest.c | 14 +++++++-------
tests/qemuxml2argvtest.c | 2 +-
tests/vboxsnapshotxmltest.c | 2 +-
tests/virconftest.c | 2 +-
tests/virfiletest.c | 2 +-
tests/virpolkittest.c | 2 +-
tests/virstringtest.c | 14 +++++++-------
tools/virsh-domain.c | 12 ++++++------
tools/virsh-nodedev.c | 6 +++---
tools/virsh-pool.c | 4 ++--
tools/virsh-snapshot.c | 4 ++--
tools/virt-host-validate-common.c | 6 +++---
tools/virt-login-shell.c | 6 +++---
tools/vsh.c | 4 ++--
54 files changed, 196 insertions(+), 196 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index e414f92..46773da 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -5425,7 +5425,7 @@ remoteDispatchConnectGetCPUModelNames(virNetServerPtr server ATTRIBUTE_UNUSED,
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
- virStringFreeList(models);
+ virStringListFree(models);
return rv;
}
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index bb5c45c..8a29977 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -323,7 +323,7 @@ virAppendBootloaderArgs(virCommandPtr cmd, virDomainDefPtr def)
/* XXX: Handle quoted? */
blargs = virStringSplit(def->os.bootloaderArgs, " ", 0);
virCommandAddArgSet(cmd, (const char * const *)blargs);
- virStringFreeList(blargs);
+ virStringListFree(blargs);
}
static virCommandPtr
diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_command.c
index 0ae7a83..6190042 100644
--- a/src/bhyve/bhyve_parse_command.c
+++ b/src/bhyve/bhyve_parse_command.c
@@ -246,7 +246,7 @@ bhyveCommandLineToArgv(const char *nativeConfig,
} else {
/* To prevent a use-after-free here, only free the argument list
* when it is definitely not going to be used */
- virStringFreeList(arglist);
+ virStringListFree(arglist);
}
}
@@ -254,13 +254,13 @@ bhyveCommandLineToArgv(const char *nativeConfig,
if (!(*bhyve_argv = _bhyve_argv))
goto error;
- virStringFreeList(lines);
+ virStringListFree(lines);
return 0;
error:
VIR_FREE(_loader_argv);
VIR_FREE(_bhyve_argv);
- virStringFreeList(lines);
+ virStringListFree(lines);
return -1;
}
@@ -804,7 +804,7 @@ bhyveParseBhyveLoadCommandLine(virDomainDefPtr def,
if (VIR_STRDUP(def->os.bootloader, argv[0]) < 0)
goto error;
- def->os.bootloaderArgs = virStringJoin((const char**) &argv[1], " ");
+ def->os.bootloaderArgs = virStringListJoin((const char**) &argv[1], " ");
}
if (argc != parser->optind) {
@@ -841,7 +841,7 @@ bhyveParseCustomLoaderCommandLine(virDomainDefPtr def,
if (VIR_STRDUP(def->os.bootloader, argv[0]) < 0)
goto error;
- def->os.bootloaderArgs = virStringJoin((const char**) &argv[1], " ");
+ def->os.bootloaderArgs = virStringListJoin((const char**) &argv[1], " ");
return 0;
error:
@@ -893,8 +893,8 @@ bhyveParseCommandLineString(const char* nativeConfig,
}
cleanup:
- virStringFreeList(loader_argv);
- virStringFreeList(bhyve_argv);
+ virStringListFree(loader_argv);
+ virStringListFree(bhyve_argv);
return def;
error:
virDomainDefFree(def);
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index beedd70..fb2d696 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -185,7 +185,7 @@ virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
return NULL;
for (i = 0; i < old->nmodels; i++) {
- if (models && !virStringArrayHasString(models, old->models[i].name))
+ if (models && !virStringListHasString(models, old->models[i].name))
continue;
if (virDomainCapsCPUModelsAdd(cpuModels,
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index 225fb6d..180ad87 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -888,7 +888,7 @@ virCPUppc64DriverGetModels(char ***models)
error:
if (models) {
- virStringFreeList(*models);
+ virStringListFree(*models);
*models = NULL;
}
goto cleanup;
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index e91850f..c79308a 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2675,7 +2675,7 @@ virCPUx86GetModels(char ***models)
error:
if (models) {
- virStringFreeList(*models);
+ virStringListFree(*models);
*models = NULL;
}
return -1;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index a04ba23..7cc7bf8 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2453,16 +2453,16 @@ virSkipSpacesAndBackslash;
virSkipSpacesBackwards;
virStrcpy;
virStrdup;
-virStringArrayHasString;
virStringBufferIsPrintable;
virStringEncodeBase64;
-virStringFreeList;
-virStringFreeListCount;
-virStringGetFirstWithPrefix;
virStringHasControlChars;
virStringIsEmpty;
virStringIsPrintable;
-virStringJoin;
+virStringListFree;
+virStringListFreeCount;
+virStringListGetFirstWithPrefix;
+virStringListHasString;
+virStringListJoin;
virStringListLength;
virStringReplace;
virStringSearch;
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 5357df4..dd013df 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -607,7 +607,7 @@ static int lxcContainerUnmountSubtree(const char *prefix,
ret = 0;
cleanup:
- virStringFreeList(mounts);
+ virStringListFree(mounts);
return ret;
}
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index ce62df9..8f44168 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -129,13 +129,13 @@ static char ** lxcStringSplit(const char *string)
}
VIR_FREE(tmp);
- virStringFreeList(parts);
+ virStringListFree(parts);
return result;
error:
VIR_FREE(tmp);
- virStringFreeList(parts);
- virStringFreeList(result);
+ virStringListFree(parts);
+ virStringListFree(result);
return NULL;
}
@@ -160,13 +160,13 @@ lxcParseFstabLine(char *fstabLine)
VIR_STRDUP(fstab->options, parts[3]) < 0)
goto error;
- virStringFreeList(parts);
+ virStringListFree(parts);
return fstab;
error:
lxcFstabFree(fstab);
- virStringFreeList(parts);
+ virStringListFree(parts);
return NULL;
}
@@ -299,7 +299,7 @@ lxcAddFstabLine(virDomainDefPtr def, lxcFstabPtr fstab)
type = VIR_DOMAIN_FS_TYPE_BLOCK;
/* Do we have ro in options? */
- readonly = virStringArrayHasString((const char **) options, "ro");
+ readonly = virStringListHasString((const char **) options, "ro");
if (lxcAddFSDef(def, type, src, dst, readonly, usage) < 0)
goto cleanup;
@@ -308,7 +308,7 @@ lxcAddFstabLine(virDomainDefPtr def, lxcFstabPtr fstab)
cleanup:
VIR_FREE(dst);
- virStringFreeList(options);
+ virStringListFree(options);
return ret;
}
@@ -618,12 +618,12 @@ lxcNetworkWalkCallback(const char *name, virConfValuePtr value, void *data)
virReportError(VIR_ERR_INVALID_ARG,
_("Invalid CIDR address: '%s'"), value->str);
- virStringFreeList(ipparts);
+ virStringListFree(ipparts);
VIR_FREE(ip);
return -1;
}
- virStringFreeList(ipparts);
+ virStringListFree(ipparts);
if (VIR_APPEND_ELEMENT(parseData->ips, parseData->nips, ip) < 0) {
VIR_FREE(ip);
@@ -943,7 +943,7 @@ lxcBlkioDeviceWalkCallback(const char *name, virConfValuePtr value, void *data)
ret = 0;
cleanup:
- virStringFreeList(parts);
+ virStringListFree(parts);
VIR_FREE(path);
return ret;
@@ -982,13 +982,13 @@ lxcSetCapDrop(virDomainDefPtr def, virConfPtr properties)
for (i = 0; i < VIR_DOMAIN_CAPS_FEATURE_LAST; i++) {
capString = virDomainCapsFeatureTypeToString(i);
if (toDrop != NULL &&
- virStringArrayHasString((const char **) toDrop, capString))
+ virStringListHasString((const char **) toDrop, capString))
def->caps_features[i] = VIR_TRISTATE_SWITCH_OFF;
}
def->features[VIR_DOMAIN_FEATURE_CAPABILITIES] = VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW;
- virStringFreeList(toDrop);
+ virStringListFree(toDrop);
}
virDomainDefPtr
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 65c441e..b02e1aa 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -151,7 +151,7 @@ openvzParseBarrierLimit(const char* value,
ret = 0;
error:
- virStringFreeListCount(tmp, ntmp);
+ virStringListFreeCount(tmp, ntmp);
return ret;
}
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index ec8d47e..1d677f7 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -2115,7 +2115,7 @@ qemuAgentGetInterfaces(qemuAgentPtr mon,
}
/* Has to be freed for each interface. */
- virStringFreeList(ifname);
+ virStringListFree(ifname);
/* as well as IP address which - moreover -
* can be presented multiple times */
@@ -2201,7 +2201,7 @@ qemuAgentGetInterfaces(qemuAgentPtr mon,
virDomainInterfaceFree(ifaces_ret[i]);
}
VIR_FREE(ifaces_ret);
- virStringFreeList(ifname);
+ virStringListFree(ifname);
goto cleanup;
}
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index f9e39a3..8901e7b 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1842,7 +1842,7 @@ virQEMUCapsProcessProps(virQEMUCapsPtr qemuCaps,
for (j = 0; j < nvalues; j++) {
if (STREQ(values[j], props[i].prop)) {
- if (virStringArrayHasString(props[i].objects, object))
+ if (virStringListHasString(props[i].objects, object))
virQEMUCapsSet(qemuCaps, props[i].flag);
break;
}
@@ -2369,7 +2369,7 @@ virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps,
return 0;
error:
- virStringFreeListCount(models, i);
+ virStringListFreeCount(models, i);
return -1;
}
@@ -2777,12 +2777,12 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qemuCaps,
for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsTPMModelsToCaps); i++) {
const char *needle = virDomainTPMModelTypeToString(
virQEMUCapsTPMModelsToCaps[i].type);
- if (virStringArrayHasString((const char **) entries, needle))
+ if (virStringListHasString((const char **) entries, needle))
virQEMUCapsSet(qemuCaps,
virQEMUCapsTPMModelsToCaps[i].caps);
}
}
- virStringFreeList(entries);
+ virStringListFree(entries);
if ((nentries = qemuMonitorGetTPMTypes(mon, &entries)) < 0)
return -1;
@@ -2791,11 +2791,11 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qemuCaps,
for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsTPMTypesToCaps); i++) {
const char *needle = virDomainTPMBackendTypeToString(
virQEMUCapsTPMTypesToCaps[i].type);
- if (virStringArrayHasString((const char **) entries, needle))
+ if (virStringListHasString((const char **) entries, needle))
virQEMUCapsSet(qemuCaps, virQEMUCapsTPMTypesToCaps[i].caps);
}
}
- virStringFreeList(entries);
+ virStringListFree(entries);
return 0;
}
@@ -2887,7 +2887,7 @@ virQEMUCapsProbeQMPCommandLine(virQEMUCapsPtr qemuCaps,
break;
}
}
- virStringFreeList(values);
+ virStringListFree(values);
}
return 0;
@@ -3849,13 +3849,13 @@ virQEMUCapsQMPSchemaGetByPath(const char *query,
if (!*elems) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed query string"));
- virStringFreeList(elems);
+ virStringListFree(elems);
return -1;
}
*entry = virQEMUCapsQMPSchemaTraverse(*elems, elems + 1, schema);
- virStringFreeList(elems);
+ virStringListFree(elems);
return 0;
}
@@ -4644,7 +4644,7 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
if (virCPUGetModels(domCaps->arch, &models) >= 0) {
filtered = virDomainCapsCPUModelsFilter(qemuCaps->cpuDefinitions,
(const char **) models);
- virStringFreeList(models);
+ virStringListFree(models);
}
domCaps->cpu.custom = filtered;
}
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index fbac3ea..ccefbe8 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -350,7 +350,7 @@ static void virQEMUDriverConfigDispose(void *obj)
virQEMUDriverConfigPtr cfg = obj;
- virStringFreeList(cfg->cgroupDeviceACL);
+ virStringListFree(cfg->cgroupDeviceACL);
VIR_FREE(cfg->configBaseDir);
VIR_FREE(cfg->configDir);
@@ -392,7 +392,7 @@ static void virQEMUDriverConfigDispose(void *obj)
VIR_FREE(cfg->dumpImageFormat);
VIR_FREE(cfg->autoDumpPath);
- virStringFreeList(cfg->securityDriverNames);
+ virStringListFree(cfg->securityDriverNames);
VIR_FREE(cfg->lockManagerName);
@@ -801,9 +801,9 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
ret = 0;
cleanup:
- virStringFreeList(controllers);
- virStringFreeList(hugetlbfs);
- virStringFreeList(nvram);
+ virStringListFree(controllers);
+ virStringListFree(hugetlbfs);
+ virStringListFree(nvram);
VIR_FREE(corestr);
VIR_FREE(user);
VIR_FREE(group);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 137d4d5..47332a8 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1549,7 +1549,7 @@ qemuDomainObjPrivateFree(void *data)
VIR_FREE(priv->lockState);
VIR_FREE(priv->origname);
- virStringFreeList(priv->qemuDevices);
+ virStringListFree(priv->qemuDevices);
virChrdevFree(priv->devs);
/* This should never be non-NULL if we get here, but just in case... */
@@ -1963,7 +1963,7 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
priv->monConfig = NULL;
VIR_FREE(nodes);
VIR_FREE(tmp);
- virStringFreeList(priv->qemuDevices);
+ virStringListFree(priv->qemuDevices);
priv->qemuDevices = NULL;
virObjectUnref(qemuCaps);
virObjectUnref(caps);
@@ -5263,7 +5263,7 @@ qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
if (rc < 0)
return -1;
- virStringFreeList(priv->qemuDevices);
+ virStringListFree(priv->qemuDevices);
priv->qemuDevices = aliases;
return 0;
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fdfe912..76f965d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1383,7 +1383,7 @@ qemuGetSchedInfo(unsigned long long *cpuWait,
cleanup:
VIR_FREE(data);
VIR_FREE(proc);
- virStringFreeList(lines);
+ virStringListFree(lines);
return ret;
}
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 90d74d5..03a5e1e 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -4987,7 +4987,7 @@ int qemuMonitorJSONGetCommands(qemuMonitorPtr mon,
cleanup:
- virStringFreeList(commandlist);
+ virStringListFree(commandlist);
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
@@ -5051,7 +5051,7 @@ int qemuMonitorJSONGetEvents(qemuMonitorPtr mon,
eventlist = NULL;
cleanup:
- virStringFreeList(eventlist);
+ virStringListFree(eventlist);
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
@@ -5173,7 +5173,7 @@ qemuMonitorJSONGetCommandLineOptionParameters(qemuMonitorPtr mon,
if (!qemuMonitorGetOptions(mon))
qemuMonitorSetOptions(mon, virJSONValueNewArray());
- virStringFreeList(paramlist);
+ virStringListFree(paramlist);
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
@@ -5276,7 +5276,7 @@ int qemuMonitorJSONGetObjectTypes(qemuMonitorPtr mon,
typelist = NULL;
cleanup:
- virStringFreeList(typelist);
+ virStringListFree(typelist);
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
@@ -5577,7 +5577,7 @@ int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon,
proplist = NULL;
cleanup:
- virStringFreeList(proplist);
+ virStringListFree(proplist);
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
@@ -5683,7 +5683,7 @@ qemuMonitorJSONGetMigrationCapabilities(qemuMonitorPtr mon,
list = NULL;
cleanup:
- virStringFreeList(list);
+ virStringListFree(list);
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
@@ -5701,9 +5701,9 @@ qemuMonitorJSONGetMigrationCapability(qemuMonitorPtr mon,
if (qemuMonitorJSONGetMigrationCapabilities(mon, &capsList) < 0)
return -1;
- ret = virStringArrayHasString((const char **) capsList, cap);
+ ret = virStringListHasString((const char **) capsList, cap);
- virStringFreeList(capsList);
+ virStringListFree(capsList);
return ret;
}
@@ -6067,7 +6067,7 @@ qemuMonitorJSONGetStringArray(qemuMonitorPtr mon, const char *qmpCmd,
list = NULL;
cleanup:
- virStringFreeList(list);
+ virStringListFree(list);
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 4692d53..a2a5885 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -971,15 +971,15 @@ qemuMonitorTextGetAllBlockStatsInfo(qemuMonitorPtr mon,
goto cleanup;
stats = NULL;
- virStringFreeList(values);
+ virStringListFree(values);
values = NULL;
}
ret = maxstats;
cleanup:
- virStringFreeList(lines);
- virStringFreeList(values);
+ virStringListFree(lines);
+ virStringListFree(values);
VIR_FREE(stats);
VIR_FREE(info);
return ret;
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index cfebcc7..405e655 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -360,7 +360,7 @@ static int qemuStringToArgvEnv(const char *args,
error:
VIR_FREE(progenv);
VIR_FREE(progargv);
- virStringFreeList(arglist);
+ virStringListFree(arglist);
return -1;
}
@@ -1588,7 +1588,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
case VIR_DOMAIN_HYPERV_LAST:
break;
}
- virStringFreeList(hv_tokens);
+ virStringListFree(hv_tokens);
hv_tokens = NULL;
} else if (STREQ(tokens[i], "kvm=off")) {
dom->features[VIR_DOMAIN_FEATURE_KVM] = VIR_TRISTATE_SWITCH_ON;
@@ -1619,8 +1619,8 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
cleanup:
VIR_FREE(model);
- virStringFreeList(tokens);
- virStringFreeList(hv_tokens);
+ virStringListFree(tokens);
+ virStringListFree(hv_tokens);
return ret;
syntax:
@@ -2196,7 +2196,7 @@ qemuParseCommandLine(virCapsPtr caps,
def->keywrap->dea = VIR_TRISTATE_SWITCH_ABSENT;
}
}
- virStringFreeList(list);
+ virStringListFree(list);
list = NULL;
} else if (STREQ(arg, "-serial")) {
WANT_VALUE();
@@ -2658,7 +2658,7 @@ qemuParseCommandLine(virCapsPtr caps,
virDomainDiskDefFree(disk);
qemuDomainCmdlineDefFree(cmd);
virDomainDefFree(def);
- virStringFreeList(list);
+ virStringListFree(list);
VIR_FREE(nics);
if (monConfig) {
virDomainChrSourceDefFree(*monConfig);
@@ -2688,8 +2688,8 @@ virDomainDefPtr qemuParseCommandLineString(virCapsPtr caps,
pidfile, monConfig, monJSON);
cleanup:
- virStringFreeList(progargv);
- virStringFreeList(progenv);
+ virStringListFree(progargv);
+ virStringListFree(progenv);
return def;
}
@@ -2736,7 +2736,7 @@ static int qemuParseProcFileStrings(int pid_value,
cleanup:
if (ret < 0)
- virStringFreeList(str);
+ virStringListFree(str);
VIR_FREE(data);
VIR_FREE(path);
return ret;
@@ -2780,7 +2780,7 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps,
cleanup:
VIR_FREE(exepath);
- virStringFreeList(progargv);
- virStringFreeList(progenv);
+ virStringListFree(progargv);
+ virStringListFree(progenv);
return def;
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f8f379a..ab0c2c8 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3164,7 +3164,7 @@ qemuProcessUpdateDevices(virQEMUDriverPtr driver,
qemuDevices = (const char **) priv->qemuDevices;
if ((tmp = old)) {
while (*tmp) {
- if (!virStringArrayHasString(qemuDevices, *tmp) &&
+ if (!virStringListHasString(qemuDevices, *tmp) &&
virDomainDefFindDevice(vm->def, *tmp, &dev, false) == 0 &&
qemuDomainRemoveDevice(driver, vm, &dev) < 0) {
goto cleanup;
@@ -3175,7 +3175,7 @@ qemuProcessUpdateDevices(virQEMUDriverPtr driver,
ret = 0;
cleanup:
- virStringFreeList(old);
+ virStringListFree(old);
return ret;
}
@@ -5085,7 +5085,7 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def,
ret = 0;
cleanup:
- virStringFreeListCount(models, nmodels);
+ virStringListFreeCount(models, nmodels);
return ret;
}
@@ -6067,7 +6067,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
VIR_FREE(vm->def->seclabels[i]->imagelabel);
}
- virStringFreeList(priv->qemuDevices);
+ virStringListFree(priv->qemuDevices);
priv->qemuDevices = NULL;
qemuHostdevReAttachDomainDevices(driver, vm->def);
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index db2bdd4..8880520 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -6221,7 +6221,7 @@ remoteConnectGetCPUModelNames(virConnectPtr conn,
rv = ret.ret;
cleanup:
- virStringFreeList(retmodels);
+ virStringListFree(retmodels);
xdr_free((xdrproc_t) xdr_remote_connect_get_cpu_model_names_ret, (char *) &ret);
diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
index 001d16f..ad2d756 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -173,7 +173,7 @@ virStorageBackendSheepdogRefreshAllVol(virConnectPtr conn ATTRIBUTE_UNUSED,
goto cleanup;
}
- virStringFreeList(cells);
+ virStringListFree(cells);
cells = NULL;
}
@@ -181,8 +181,8 @@ virStorageBackendSheepdogRefreshAllVol(virConnectPtr conn ATTRIBUTE_UNUSED,
cleanup:
virCommandFree(cmd);
- virStringFreeList(lines);
- virStringFreeList(cells);
+ virStringListFree(lines);
+ virStringListFree(cells);
VIR_FREE(output);
return ret;
}
diff --git a/src/storage/storage_backend_zfs.c b/src/storage/storage_backend_zfs.c
index a3477e2..3a43be4 100644
--- a/src/storage/storage_backend_zfs.c
+++ b/src/storage/storage_backend_zfs.c
@@ -168,8 +168,8 @@ virStorageBackendZFSParseVol(virStoragePoolObjPtr pool,
ret = 0;
cleanup:
- virStringFreeList(tokens);
- virStringFreeList(name_tokens);
+ virStringListFree(tokens);
+ virStringListFree(name_tokens);
if (is_new_vol)
virStorageVolDefFree(volume);
return ret;
@@ -219,7 +219,7 @@ virStorageBackendZFSFindVols(virStoragePoolObjPtr pool,
cleanup:
virCommandFree(cmd);
- virStringFreeList(lines);
+ virStringListFree(lines);
VIR_FREE(volumes_list);
return 0;
@@ -264,7 +264,7 @@ virStorageBackendZFSRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
if (STREQ(lines[i], ""))
continue;
- virStringFreeList(tokens);
+ virStringListFree(tokens);
if (!(tokens = virStringSplitCount(lines[i], "\t", 0, &count)))
goto cleanup;
@@ -294,8 +294,8 @@ virStorageBackendZFSRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
cleanup:
virCommandFree(cmd);
- virStringFreeList(lines);
- virStringFreeList(tokens);
+ virStringListFree(lines);
+ virStringListFree(tokens);
VIR_FREE(zpool_props);
return 0;
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 9900596..df65807 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -3392,7 +3392,7 @@ virStorageAddISCSIPoolSourceHost(virDomainDiskDefPtr def,
ret = 0;
cleanup:
- virStringFreeList(tokens);
+ virStringListFree(tokens);
return ret;
}
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 9232994..f151193 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -863,14 +863,14 @@ virCgroupGetValueForBlkDev(virCgroupPtr group,
if (!(lines = virStringSplit(str, "\n", -1)))
goto error;
- if (VIR_STRDUP(*value, virStringGetFirstWithPrefix(lines, prefix)) < 0)
+ if (VIR_STRDUP(*value, virStringListGetFirstWithPrefix(lines, prefix)) < 0)
goto error;
ret = 0;
error:
VIR_FREE(str);
VIR_FREE(prefix);
- virStringFreeList(lines);
+ virStringListFree(lines);
return ret;
}
@@ -1275,13 +1275,13 @@ virCgroupSetPartitionSuffix(const char *path, char **res)
goto cleanup;
}
- if (!(*res = virStringJoin((const char **)tokens, "/")))
+ if (!(*res = virStringListJoin((const char **)tokens, "/")))
goto cleanup;
ret = 0;
cleanup:
- virStringFreeList(tokens);
+ virStringListFree(tokens);
return ret;
}
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 2a59bd1..e1bbc05 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -3026,7 +3026,7 @@ virCommandRunRegex(virCommandPtr cmd,
ret = 0;
cleanup:
- virStringFreeList(lines);
+ virStringListFree(lines);
VIR_FREE(outbuf);
if (groups) {
for (j = 0; j < totgroups; j++)
diff --git a/src/util/virconf.c b/src/util/virconf.c
index 3e49f41..a85a307 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -983,7 +983,7 @@ int virConfGetValueStringList(virConfPtr conf,
if (!cval)
return 0;
- virStringFreeList(*values);
+ virStringListFree(*values);
*values = NULL;
switch (cval->type) {
@@ -1003,7 +1003,7 @@ int virConfGetValueStringList(virConfPtr conf,
for (len = 0, eval = cval->list; eval; len++, eval = eval->next) {
if (VIR_STRDUP((*values)[len], eval->str) < 0) {
- virStringFreeList(*values);
+ virStringListFree(*values);
*values = NULL;
return -1;
}
diff --git a/src/util/virfile.c b/src/util/virfile.c
index f006abf..1fb89ce 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -1877,7 +1877,7 @@ virFileGetMountSubtreeImpl(const char *mtabpath,
cleanup:
if (ret < 0)
- virStringFreeList(mounts);
+ virStringListFree(mounts);
endmntent(procmnt);
return ret;
}
@@ -1906,7 +1906,7 @@ virFileGetMountSubtreeImpl(const char *mtabpath ATTRIBUTE_UNUSED,
* the path @prefix, sorted from shortest to longest path.
*
* The @mountsret array will be NULL terminated and should
- * be freed with virStringFreeList
+ * be freed with virStringListFree
*
* Returns 0 on success, -1 on error
*/
@@ -1930,7 +1930,7 @@ int virFileGetMountSubtree(const char *mtabpath,
* ie opposite order to which they appear in @mtabpath
*
* The @mountsret array will be NULL terminated and should
- * be freed with virStringFreeList
+ * be freed with virStringListFree
*
* Returns 0 on success, -1 on error
*/
diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c
index f26fd86..3f97618 100644
--- a/src/util/virfirewall.c
+++ b/src/util/virfirewall.c
@@ -878,7 +878,7 @@ virFirewallApplyRule(virFirewallPtr firewall,
ret = 0;
cleanup:
- virStringFreeList(lines);
+ virStringListFree(lines);
VIR_FREE(output);
return ret;
}
diff --git a/src/util/virfirmware.c b/src/util/virfirmware.c
index 6b20c06..86f8b68 100644
--- a/src/util/virfirmware.c
+++ b/src/util/virfirmware.c
@@ -87,7 +87,7 @@ virFirmwareParse(const char *str, virFirmwarePtr firmware)
ret = 0;
cleanup:
- virStringFreeList(token);
+ virStringListFree(token);
return ret;
}
@@ -132,6 +132,6 @@ virFirmwareParseList(const char *list,
ret = 0;
cleanup:
- virStringFreeList(token);
+ virStringListFree(token);
return ret;
}
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 8f831fc..77bc6b3 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -1530,7 +1530,7 @@ virLogParseOutput(const char *src)
}
cleanup:
- virStringFreeList(tokens);
+ virStringListFree(tokens);
return ret;
}
@@ -1607,7 +1607,7 @@ virLogParseFilter(const char *src)
goto cleanup;
cleanup:
- virStringFreeList(tokens);
+ virStringListFree(tokens);
return ret;
}
@@ -1667,7 +1667,7 @@ virLogParseOutputs(const char *src, virLogOutputPtr **outputs)
*outputs = list;
list = NULL;
cleanup:
- virStringFreeList(strings);
+ virStringListFree(strings);
return ret;
}
@@ -1717,7 +1717,7 @@ virLogParseFilters(const char *src, virLogFilterPtr **filters)
*filters = list;
list = NULL;
cleanup:
- virStringFreeList(strings);
+ virStringListFree(strings);
return ret;
}
diff --git a/src/util/virpolkit.c b/src/util/virpolkit.c
index e7e46b8..c735ca9 100644
--- a/src/util/virpolkit.c
+++ b/src/util/virpolkit.c
@@ -137,7 +137,7 @@ int virPolkitCheckAuth(const char *actionid,
}
cleanup:
- virStringFreeListCount(retdetails, nretdetails);
+ virStringListFreeCount(retdetails, nretdetails);
return ret;
}
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 3cacc89..7db97bc 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -1014,7 +1014,7 @@ int virProcessGetStartTime(pid_t pid,
ret = 0;
cleanup:
- virStringFreeList(tokens);
+ virStringListFree(tokens);
VIR_FREE(filename);
VIR_FREE(buf);
return ret;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index f6a1b5d..1011bd0 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1476,7 +1476,7 @@ virStorageFileParseChainIndex(const char *diskTarget,
*chainIndex = idx;
cleanup:
- virStringFreeList(strings);
+ virStringListFree(strings);
return ret;
}
@@ -2350,7 +2350,7 @@ virStorageSourceParseBackingURI(virStorageSourcePtr src,
cleanup:
virURIFree(uri);
- virStringFreeList(scheme);
+ virStringListFree(scheme);
return ret;
}
@@ -2385,8 +2385,8 @@ virStorageSourceRBDAddHost(virStorageSourcePtr src,
parts = virStringSplit(hostport, "\\:", 0);
if (!parts)
goto error;
- src->hosts[src->nhosts-1].name = virStringJoin((const char **)parts, ":");
- virStringFreeList(parts);
+ src->hosts[src->nhosts-1].name = virStringListJoin((const char **)parts, ":");
+ virStringListFree(parts);
if (!src->hosts[src->nhosts-1].name)
goto error;
@@ -2576,7 +2576,7 @@ virStorageSourceParseNBDColonString(const char *nbdstr,
ret = 0;
cleanup:
- virStringFreeList(backing);
+ virStringListFree(backing);
return ret;
}
@@ -3272,7 +3272,7 @@ virStorageFileCanonicalizeInjectSymlink(const char *path,
ret = 0;
cleanup:
- virStringFreeListCount(tmp, ntmp);
+ virStringListFreeCount(tmp, ntmp);
return ret;
}
@@ -3420,7 +3420,7 @@ virStorageFileCanonicalizePath(const char *path,
cleanup:
virHashFree(cycle);
- virStringFreeListCount(components, ncomponents);
+ virStringListFreeCount(components, ncomponents);
VIR_FREE(linkpath);
VIR_FREE(currentpath);
@@ -3534,6 +3534,6 @@ virStorageFileCheckCompat(const char *compat)
ret = 0;
cleanup:
- virStringFreeList(version);
+ virStringListFree(version);
return ret;
}
diff --git a/src/util/virstring.c b/src/util/virstring.c
index f93d6b1..479b19c 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -38,7 +38,7 @@
VIR_LOG_INIT("util.string");
/*
- * The following virStringSplit & virStringJoin methods
+ * The following virStringSplit & virStringListJoin methods
* are derived from g_strsplit / g_strjoin in glib2,
* also available under the LGPLv2+ license terms
*/
@@ -66,7 +66,7 @@ VIR_LOG_INIT("util.string");
* before calling virStringSplit().
*
* Return value: a newly-allocated NULL-terminated array of strings. Use
- * virStringFreeList() to free it.
+ * virStringListFree() to free it.
*/
char **
virStringSplitCount(const char *string,
@@ -137,7 +137,7 @@ virStringSplit(const char *string,
/**
- * virStringJoin:
+ * virStringListJoin:
* @strings: a NULL-terminated array of strings to join
* @delim: a string to insert between each of the strings
*
@@ -148,8 +148,8 @@ virStringSplit(const char *string,
* Returns: a newly-allocated string containing all of the strings joined
* together, with @delim between them
*/
-char *virStringJoin(const char **strings,
- const char *delim)
+char *virStringListJoin(const char **strings,
+ const char *delim)
{
char *ret;
virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -169,13 +169,13 @@ char *virStringJoin(const char **strings,
/**
- * virStringFreeList:
+ * virStringListFree:
* @str_array: a NULL-terminated array of strings to free
*
* Frees a NULL-terminated array of strings, and the array itself.
- * If called on a NULL value, virStringFreeList() simply returns.
+ * If called on a NULL value, virStringListFree() simply returns.
*/
-void virStringFreeList(char **strings)
+void virStringListFree(char **strings)
{
char **tmp = strings;
while (tmp && *tmp) {
@@ -187,14 +187,14 @@ void virStringFreeList(char **strings)
/**
- * virStringFreeListCount:
+ * virStringListFreeCount:
* @strings: array of strings to free
* @count: number of elements in the array
*
* Frees a string array of @count length.
*/
void
-virStringFreeListCount(char **strings,
+virStringListFreeCount(char **strings,
size_t count)
{
size_t i;
@@ -210,8 +210,8 @@ virStringFreeListCount(char **strings,
bool
-virStringArrayHasString(const char **strings,
- const char *needle)
+virStringListHasString(const char **strings,
+ const char *needle)
{
size_t i = 0;
@@ -227,7 +227,7 @@ virStringArrayHasString(const char **strings,
}
char *
-virStringGetFirstWithPrefix(char **strings, const char *prefix)
+virStringListGetFirstWithPrefix(char **strings, const char *prefix)
{
size_t i = 0;
@@ -814,7 +814,7 @@ int virStringSortRevCompare(const void *a, const void *b)
* @result: pointer to an array to be filled with NULL terminated list of matches
*
* Performs a POSIX extended regex search against a string and return all matching substrings.
- * The @result value should be freed with virStringFreeList() when no longer
+ * The @result value should be freed with virStringListFree() when no longer
* required.
*
* @code
@@ -834,7 +834,7 @@ int virStringSortRevCompare(const void *a, const void *b)
* // matches[2] == "bbb3c75c-d60f-43b0-b802-fd56b84a4222"
* // matches[3] == NULL;
*
- * virStringFreeList(matches);
+ * virStringListFree(matches);
* @endcode
*
* Returns: -1 on error, or number of matches
@@ -902,7 +902,7 @@ virStringSearch(const char *str,
cleanup:
regfree(&re);
if (ret < 0) {
- virStringFreeList(*matches);
+ virStringListFree(*matches);
*matches = NULL;
}
return ret;
diff --git a/src/util/virstring.h b/src/util/virstring.h
index 8854d5f..9826fc9 100644
--- a/src/util/virstring.h
+++ b/src/util/virstring.h
@@ -37,15 +37,15 @@ char **virStringSplit(const char *string,
size_t max_tokens)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-char *virStringJoin(const char **strings,
- const char *delim)
+char *virStringListJoin(const char **strings,
+ const char *delim)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-void virStringFreeList(char **strings);
-void virStringFreeListCount(char **strings, size_t count);
+void virStringListFree(char **strings);
+void virStringListFreeCount(char **strings, size_t count);
-bool virStringArrayHasString(const char **strings, const char *needle);
-char *virStringGetFirstWithPrefix(char **strings, const char *prefix)
+bool virStringListHasString(const char **strings, const char *needle);
+char *virStringListGetFirstWithPrefix(char **strings, const char *prefix)
ATTRIBUTE_NONNULL(2);
char *virArgvToString(const char *const *argv);
diff --git a/src/util/viruri.c b/src/util/viruri.c
index 2f252ac..b80d924 100644
--- a/src/util/viruri.c
+++ b/src/util/viruri.c
@@ -386,7 +386,7 @@ virURIResolveAlias(virConfPtr conf, const char *alias, char **uri)
if (aliases && *aliases) {
ret = virURIFindAliasMatch(aliases, alias, uri);
- virStringFreeList(aliases);
+ virStringListFree(aliases);
} else {
ret = 0;
}
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 7ae3dc7..af8a9f7 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -4933,7 +4933,7 @@ vboxSnapshotRedefine(virDomainPtr dom,
tmp = virStringReplace(newSnapshotPtr->storageController,
searchResultTab[it],
uuidReplacing);
- virStringFreeList(searchResultTab);
+ virStringListFree(searchResultTab);
searchResultTab = NULL;
VIR_FREE(newSnapshotPtr->storageController);
if (!tmp)
@@ -5341,9 +5341,9 @@ vboxSnapshotRedefine(virDomainPtr dom,
VIR_FREE(currentSnapshotXmlFilePath);
VBOX_UTF16_FREE(machineNameUtf16);
VBOX_UTF8_FREE(machineName);
- virStringFreeList(realReadOnlyDisksPath);
- virStringFreeList(realReadWriteDisksPath);
- virStringFreeList(searchResultTab);
+ virStringListFree(realReadOnlyDisksPath);
+ virStringListFree(realReadWriteDisksPath);
+ virStringListFree(searchResultTab);
VIR_FREE(newSnapshotPtr);
VIR_FREE(machineLocationPath);
VIR_FREE(nameTmpUse);
@@ -7187,7 +7187,7 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
VBOX_RELEASE(machine);
VBOX_UTF16_FREE(settingsFilePathUtf16);
VBOX_UTF8_FREE(settingsFilepath);
- virStringFreeList(searchResultTab);
+ virStringListFree(searchResultTab);
VIR_FREE(snapshotMachineDesc);
VBOX_UTF16_FREE(machineNameUtf16);
VBOX_UTF8_FREE(machineName);
diff --git a/src/vbox/vbox_snapshot_conf.c b/src/vbox/vbox_snapshot_conf.c
index e1307e1..8bf7ef3 100644
--- a/src/vbox/vbox_snapshot_conf.c
+++ b/src/vbox/vbox_snapshot_conf.c
@@ -107,7 +107,7 @@ virVBoxSnapshotConfCreateVBoxSnapshotConfHardDiskPtr(xmlNodePtr diskNode,
VIR_FREE(nodes);
VIR_FREE(location);
VIR_FREE(tmp);
- virStringFreeList(searchTabResult);
+ virStringListFree(searchTabResult);
if (result < 0) {
virVboxSnapshotConfHardDiskFree(hardDisk);
hardDisk = NULL;
@@ -276,7 +276,7 @@ virVBoxSnapshotConfRetrieveSnapshot(xmlNodePtr snapshotNode,
}
VIR_FREE(nodes);
VIR_FREE(uuid);
- virStringFreeList(searchTabResult);
+ virStringListFree(searchTabResult);
return snapshot;
}
@@ -458,8 +458,8 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node,
xmlUnlinkNode(snapshotsNode);
xmlFreeNode(snapshotsNode);
}
- virStringFreeList(firstRegex);
- virStringFreeList(secondRegex);
+ virStringListFree(firstRegex);
+ virStringListFree(secondRegex);
VIR_FREE(uuid);
VIR_FREE(timeStamp);
return result;
@@ -739,7 +739,7 @@ virVBoxSnapshotConfLoadVboxFile(const char *filePath,
VIR_FREE(currentStateModifiedString);
VIR_FREE(currentSnapshotAttribute);
- virStringFreeList(searchResultTab);
+ virStringListFree(searchResultTab);
if (ret < 0) {
virVBoxSnapshotConfMachineFree(machineDescription);
machineDescription = NULL;
@@ -1235,8 +1235,8 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachinePtr machine,
xmlFreeDoc(xml);
- virStringFreeList(firstRegex);
- virStringFreeList(secondRegex);
+ virStringListFree(firstRegex);
+ virStringListFree(secondRegex);
return ret;
}
@@ -1324,7 +1324,7 @@ virVBoxSnapshotConfGetRWDisksPathsFromLibvirtXML(const char *filePath,
xmlFreeDoc(xml);
xmlXPathFreeContext(xPathContext);
if (result < 0) {
- virStringFreeList(ret);
+ virStringListFree(ret);
nodeSize = -1;
} else {
*rwDisksPath = ret;
@@ -1385,7 +1385,7 @@ virVBoxSnapshotConfGetRODisksPathsFromLibvirtXML(const char *filePath,
xmlFreeDoc(xml);
xmlXPathFreeContext(xPathContext);
if (result < 0) {
- virStringFreeList(ret);
+ virStringListFree(ret);
nodeSize = -1;
} else {
*roDisksPath = ret;
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index d61bccf..d7b754e 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -730,7 +730,7 @@ prlsdkGetFSInfo(PRL_HANDLE prldisk,
cleanup:
VIR_FREE(buf);
- virStringFreeList(matches);
+ virStringListFree(matches);
return ret;
}
diff --git a/tests/domainsnapshotxml2xmltest.c b/tests/domainsnapshotxml2xmltest.c
index 650c565..f5fec47 100644
--- a/tests/domainsnapshotxml2xmltest.c
+++ b/tests/domainsnapshotxml2xmltest.c
@@ -65,7 +65,7 @@ testFilterXML(char *xml)
cleanup:
virBufferFreeAndReset(&buf);
- virStringFreeList(xmlLines);
+ virStringListFree(xmlLines);
return ret;
}
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index a7d4d5a..f729b2e 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -591,7 +591,7 @@ testQemuMonitorJSONGetTPMModels(const void *data)
cleanup:
qemuMonitorTestFree(test);
- virStringFreeList(tpmmodels);
+ virStringListFree(tpmmodels);
return ret;
}
@@ -651,7 +651,7 @@ testQemuMonitorJSONGetCommandLineOptionParameters(const void *data)
#undef CHECK
- virStringFreeList(params);
+ virStringListFree(params);
params = NULL;
/* present but empty */
@@ -677,7 +677,7 @@ testQemuMonitorJSONGetCommandLineOptionParameters(const void *data)
goto cleanup;
}
- virStringFreeList(params);
+ virStringListFree(params);
params = NULL;
/* no such option */
@@ -707,7 +707,7 @@ testQemuMonitorJSONGetCommandLineOptionParameters(const void *data)
cleanup:
qemuMonitorTestFree(test);
- virStringFreeList(params);
+ virStringListFree(params);
return ret;
}
@@ -1151,20 +1151,20 @@ testQemuMonitorJSONGetDeviceAliases(const void *data)
ret = 0;
for (alias = (const char **) aliases; *alias; alias++) {
- if (!virStringArrayHasString(expected, *alias)) {
+ if (!virStringListHasString(expected, *alias)) {
fprintf(stderr, "got unexpected device alias '%s'\n", *alias);
ret = -1;
}
}
for (alias = expected; *alias; alias++) {
- if (!virStringArrayHasString((const char **) aliases, *alias)) {
+ if (!virStringListHasString((const char **) aliases, *alias)) {
fprintf(stderr, "missing expected alias '%s'\n", *alias);
ret = -1;
}
}
cleanup:
- virStringFreeList(aliases);
+ virStringListFree(aliases);
qemuMonitorTestFree(test);
return ret;
}
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1954696..e0ef47f 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -160,7 +160,7 @@ fakeStorageVolLookupByName(virStoragePoolPtr pool,
NULL, NULL);
cleanup:
- virStringFreeList(volinfo);
+ virStringListFree(volinfo);
return ret;
fallback:
diff --git a/tests/vboxsnapshotxmltest.c b/tests/vboxsnapshotxmltest.c
index fa7bbfe..f84d199 100644
--- a/tests/vboxsnapshotxmltest.c
+++ b/tests/vboxsnapshotxmltest.c
@@ -47,7 +47,7 @@ testFilterXML(char *xml)
cleanup:
virBufferFreeAndReset(&buf);
- virStringFreeList(xmlLines);
+ virStringListFree(xmlLines);
return ret;
}
diff --git a/tests/virconftest.c b/tests/virconftest.c
index dbf6ed6..4fc7993 100644
--- a/tests/virconftest.c
+++ b/tests/virconftest.c
@@ -394,7 +394,7 @@ static int testConfParseStringList(const void *opaque ATTRIBUTE_UNUSED)
ret = 0;
cleanup:
- virStringFreeList(str);
+ virStringListFree(str);
virConfFree(conf);
return ret;
}
diff --git a/tests/virfiletest.c b/tests/virfiletest.c
index a6458df..05148e9 100644
--- a/tests/virfiletest.c
+++ b/tests/virfiletest.c
@@ -84,7 +84,7 @@ static int testFileGetMountSubtree(const void *opaque)
data->mounts, data->nmounts);
cleanup:
- virStringFreeList(gotmounts);
+ virStringListFree(gotmounts);
return ret;
}
#endif /* ! defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
diff --git a/tests/virpolkittest.c b/tests/virpolkittest.c
index 421ffee..a51dd1c 100644
--- a/tests/virpolkittest.c
+++ b/tests/virpolkittest.c
@@ -124,7 +124,7 @@ VIR_MOCK_WRAP_RET_ARGS(dbus_connection_send_with_reply_and_block,
VIR_FREE(uidkey);
VIR_FREE(actionid);
VIR_FREE(cancellationId);
- virStringFreeListCount(details, detailslen);
+ virStringListFreeCount(details, detailslen);
if (virDBusCreateReply(&reply,
"(bba&{ss})",
diff --git a/tests/virstringtest.c b/tests/virstringtest.c
index f7e1e92..a11d7c5 100644
--- a/tests/virstringtest.c
+++ b/tests/virstringtest.c
@@ -94,7 +94,7 @@ static int testSplit(const void *args)
ret = 0;
cleanup:
- virStringFreeList(got);
+ virStringListFree(got);
return ret;
}
@@ -106,7 +106,7 @@ static int testJoin(const void *args)
char *got;
int ret = -1;
- if (!(got = virStringJoin(data->tokens, data->delim))) {
+ if (!(got = virStringListJoin(data->tokens, data->delim))) {
VIR_DEBUG("Got no result");
return -1;
}
@@ -354,7 +354,7 @@ testStringSearch(const void *opaque)
ret = 0;
cleanup:
- virStringFreeList(matches);
+ virStringListFree(matches);
return ret;
}
@@ -502,7 +502,7 @@ testStringToLong(const void *opaque)
/* The point of this test is to check whether all members of the array are
* freed. The test has to be checked using valgrind. */
static int
-testVirStringFreeListCount(const void *opaque ATTRIBUTE_UNUSED)
+testVirStringListFreeCount(const void *opaque ATTRIBUTE_UNUSED)
{
char **list;
@@ -513,7 +513,7 @@ testVirStringFreeListCount(const void *opaque ATTRIBUTE_UNUSED)
ignore_value(VIR_STRDUP(list[2], "test2"));
ignore_value(VIR_STRDUP(list[3], "test3"));
- virStringFreeListCount(list, 4);
+ virStringListFreeCount(list, 4);
return 0;
}
@@ -779,8 +779,8 @@ mymain(void)
TEST_STRTOL("-18446744073709551616", NULL, 0, -1, 0U, -1,
0LL, -1, 0ULL, -1);
- /* test virStringFreeListCount */
- if (virTestRun("virStringFreeListCount", testVirStringFreeListCount,
+ /* test virStringListFreeCount */
+ if (virTestRun("virStringListFreeCount", testVirStringListFreeCount,
NULL) < 0)
ret = -1;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 242f15e..e359bfc 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -878,7 +878,7 @@ virshParseRateStr(vshControl *ctl,
ret = 0;
cleanup:
- virStringFreeList(tok);
+ virStringListFree(tok);
return ret;
}
@@ -4043,14 +4043,14 @@ cmdStartGetFDs(vshControl *ctl,
fds[nfds - 1] = fd;
}
- virStringFreeList(fdlist);
+ virStringListFree(fdlist);
*fdsret = fds;
*nfdsret = nfds;
return 0;
error:
- virStringFreeList(fdlist);
+ virStringListFree(fdlist);
VIR_FREE(fds);
return -1;
}
@@ -5570,7 +5570,7 @@ cmdShutdown(vshControl *ctl, const vshCmd *cmd)
cleanup:
if (dom)
virDomainFree(dom);
- virStringFreeList(modes);
+ virStringListFree(modes);
return ret;
}
@@ -5650,7 +5650,7 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd)
cleanup:
if (dom)
virDomainFree(dom);
- virStringFreeList(modes);
+ virStringListFree(modes);
return ret;
}
@@ -8827,7 +8827,7 @@ virshParseEventStr(const char *event,
ret = 0;
cleanup:
- virStringFreeList(tok);
+ virStringListFree(tok);
return ret;
}
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 9446664..f76cade 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -156,7 +156,7 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd)
ret = true;
cleanup:
- virStringFreeList(arr);
+ virStringListFree(arr);
if (dev)
virNodeDeviceFree(dev);
return ret;
@@ -498,7 +498,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
}
cleanup:
- virStringFreeList(caps);
+ virStringListFree(caps);
virshNodeDeviceListFree(list);
return ret;
}
@@ -567,7 +567,7 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cmd)
ret = true;
cleanup:
- virStringFreeList(arr);
+ virStringListFree(arr);
VIR_FREE(xml);
if (device)
virNodeDeviceFree(device);
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 7118a6c..8313be8 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -1125,7 +1125,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
for (i = 0; i < npoolTypes; i++) {
if ((poolType = virStoragePoolTypeFromString(poolTypes[i])) < 0) {
vshError(ctl, _("Invalid pool type '%s'"), poolTypes[i]);
- virStringFreeList(poolTypes);
+ virStringListFree(poolTypes);
return false;
}
@@ -1170,7 +1170,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
break;
}
}
- virStringFreeList(poolTypes);
+ virStringListFree(poolTypes);
}
if (!(list = virshStoragePoolListCollect(ctl, flags)))
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index e4d0df7..5c844a5 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -255,7 +255,7 @@ virshParseSnapshotMemspec(vshControl *ctl, virBufferPtr buf, const char *str)
cleanup:
if (ret < 0)
vshError(ctl, _("unable to parse memspec: %s"), str);
- virStringFreeList(array);
+ virStringListFree(array);
return ret;
}
@@ -306,7 +306,7 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBufferPtr buf, const char *str)
cleanup:
if (ret < 0)
vshError(ctl, _("unable to parse diskspec: %s"), str);
- virStringFreeList(array);
+ virStringListFree(array);
return ret;
}
diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index 4bfc52a..6faed04 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -245,7 +245,7 @@ virBitmapPtr virHostValidateGetCPUFlags(void)
ignore_value(virBitmapSetBit(flags, value));
}
- virStringFreeListCount(tokens, ntokens);
+ virStringListFreeCount(tokens, ntokens);
} while (1);
cleanup:
@@ -345,7 +345,7 @@ static int virHostValidateCGroupSupport(const char *hvname,
matched = true;
}
- virStringFreeListCount(cgroups, ncgroups);
+ virStringListFreeCount(cgroups, ncgroups);
}
VIR_FREE(line);
@@ -394,7 +394,7 @@ static int virHostValidateCGroupMount(const char *hvname,
matched = true;
}
- virStringFreeListCount(opts, nopts);
+ virStringListFreeCount(opts, nopts);
}
endmntent(fp);
if (!matched)
diff --git a/tools/virt-login-shell.c b/tools/virt-login-shell.c
index a2b32ac..016e2b6 100644
--- a/tools/virt-login-shell.c
+++ b/tools/virt-login-shell.c
@@ -90,7 +90,7 @@ static int virLoginShellAllowedUser(virConfPtr conf,
name, conf_file);
cleanup:
VIR_FREE(gname);
- virStringFreeList(users);
+ virStringListFree(users);
return ret;
}
@@ -308,7 +308,7 @@ main(int argc, char **argv)
if (autoshell) {
tmp = virGetUserShell(uid);
if (tmp) {
- virStringFreeList(shargv);
+ virStringListFree(shargv);
shargvlen = 1;
if (VIR_ALLOC_N(shargv[0], shargvlen + 1) < 0) {
VIR_FREE(tmp);
@@ -394,7 +394,7 @@ main(int argc, char **argv)
virDomainFree(dom);
if (conn)
virConnectClose(conn);
- virStringFreeList(shargv);
+ virStringListFree(shargv);
VIR_FREE(shcmd);
VIR_FREE(term);
VIR_FREE(name);
diff --git a/tools/vsh.c b/tools/vsh.c
index f94eaa3..c1fc041 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -179,7 +179,7 @@ vshNameSorter(const void *a, const void *b)
/*
* Convert the strings separated by ',' into array. The returned
* array is a NULL terminated string list. The caller has to free
- * the array using virStringFreeList or a similar method.
+ * the array using virStringListFree or a similar method.
*
* Returns the length of the filled array on success, or -1
* on error.
@@ -2835,7 +2835,7 @@ vshReadlineParse(const char *text, int state)
return res;
}
res = NULL;
- virStringFreeList(completed_list);
+ virStringListFree(completed_list);
completed_list_index = 0;
}
}
--
2.8.4
7 years, 12 months
[libvirt] [PATCH] NEWS: Add some missing entries
by Andrea Bolognani
Catch up with changes that have been pushed but didn't include
updates to the NEWS file themselves.
---
Pushed under the "this NEWS file thing will need some time
to catch on" rule.
docs/news.html.in | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/docs/news.html.in b/docs/news.html.in
index 54eb8ad..59bf20d 100644
--- a/docs/news.html.in
+++ b/docs/news.html.in
@@ -46,6 +46,11 @@
List user-visible changes instead of single commits for a better
high-level overview of differences between libvirt releases
</li>
+ <li>website: Modernize layout and branding<br/>
+ The libvirt website looked very cluttered and outdated; it has now
+ been completely overhauled, resulting in a design that's better
+ organized and more pleasant to look at
+ </li>
</ul>
</li>
<li><strong>Bug fixes</strong>
@@ -54,6 +59,8 @@
</li>
<li>Forbid newline character in names of some libvirt objects.
</li>
+ <li>Fix compilation on macOS
+ </li>
</ul>
</li>
</ul>
--
2.7.4
7 years, 12 months
[libvirt] [PATCH] virhostcpu: fix calculation of total CPU sockets
by Zhang Zhuoyu
CPU sockets calculation is inconsistent with physical sockets when
Host machine has more than one node. It only calculate the maximum
socket number of all CPU nodes instead of summing up.
For example:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 32
On-line CPU(s) list: 0-31
Thread(s) per core: 2
Core(s) per socket: 8
Socket(s): 2 <------ Host machine has 2 sockets
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 62
Model name: Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz
Stepping: 4
CPU MHz: 3074.296
BogoMIPS: 5205.76
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 20480K
NUMA node0 CPU(s): 0-7,16-23
NUMA node1 CPU(s): 8-15,24-31
CPU model: x86_64
CPU(s): 32
CPU frequency: 3021 MHz
CPU socket(s): 1 <----- Should be 2 sockets
Core(s) per socket: 8
Thread(s) per core: 2
NUMA cell(s): 2
Memory size: 131833636 KiB
"lscpu" shows host machine has 2 sockets, however "virsh nodeinfo"
only calculate the maximum socket number of all CPU nodes,
This patch fix it by summing sockets in all nodes up.
Signed-off-by: Zhang Zhuoyu <zhangzhuoyu(a)cmss.chinamobile.com>
Signed-off-by: Xiubo Li <lixiubo(a)cmss.chinamobile.com>
---
src/util/virhostcpu.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 42a52ca..f2e3b8c 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -699,9 +699,7 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo,
VIR_FREE(sysfs_cpudir);
*cpus += nodecpus;
-
- if (nodesockets > *sockets)
- *sockets = nodesockets;
+ *sockets += nodesockets;
if (nodecores > *cores)
*cores = nodecores;
@@ -760,8 +758,7 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo,
* the nodeinfo structure isn't designed to carry the full topology so
* we're going to lie about the detected topology to notify the user
* to check the host capabilities for the actual topology. */
- if ((*nodes *
- *sockets *
+ if ((*sockets *
*cores *
*threads) != (*cpus + offline)) {
*nodes = 1;
--
1.8.3.1
7 years, 12 months
[libvirt] [PATCH 1/2] qemu: fix internal error: NUMA isn't available on this host
by Boris Fiuczynski
If libvirt is compiled without NUMACTL support starting libvirtd
reports a libvirt internal error "NUMA isn't available on this host"
without checking if NUMA support is compiled into the libvirt binaries.
This patch adds the missing NUMA support check to prevent the internal error.
It also includes a check if the cgroup controller cpuset is available before
using it.
The error was noticed when libvirtd was restarted with running domains and
on libvirtd start the qemuConnectCgroup gets called during qemuProcessReconnect.
Signed-off-by: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk(a)linux.vnet.ibm.com>
---
src/qemu/qemu_cgroup.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 211d0b5..0baa2b3 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -939,6 +939,10 @@ qemuRestoreCgroupState(virDomainObjPtr vm)
virBitmapPtr all_nodes;
virCgroupPtr cgroup_temp = NULL;
+ if (!virNumaIsAvailable() ||
+ !virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET))
+ return;
+
if (!(all_nodes = virNumaGetHostMemoryNodeset()))
goto error;
--
2.5.5
7 years, 12 months
[libvirt] [RFC 00/15] qmp: Report supported device types on 'query-machines'
by Eduardo Habkost
The Problem
===========
Currently management software has no way to find out which device
types can be plugged in a machine, unless the machine is already
initialized.
Even after the machine is initialized, there's no way to map
existing bus types to supported device types unless management
software hardcodes the mapping between bus types and device
types.
Example: floppy support on q35 vs i440fx
----------------------------------------
There's no way for libvirt to find out that there's no floppy
controller on pc-q35-* machine-types by default.
With this series, pc-i440fx-* will report "floppy" as a supported
device type, but pc-q35-* will not.
Example: Legacy PCI vs vs PCIe devices
--------------------------------------
Some devices require a PCIe bus to be available, others work on
both legacy PCI and PCIe, while others work only on a legacy PCI
bus.
Currently management software has no way to know which devices
can be added to a given machine, unless it hardcodes machine-type
names and device-types names.
The Proposed Interface
======================
This series adds a new field to the output of 'query-machines':
'supported-device-types'. It will contain a list of QOM type
names, that can be used to find the list of device types that can
be plugged in the machine by default. The type names reported on
the new field can then be used as the 'implements' argument on
the 'qom-list-types' command, to find out which device types can
be plugged on the machine.
Example output
--------------
(QEMU) query-machines
{
"return": [
[...]
{
"supported-device-types": [
"sys-bus-device"
],
"cpu-max": 1,
"hotpluggable-cpus": false,
"name": "none"
},
[...]
{
"supported-device-types": [
"sys-bus-device"
],
"cpu-max": 1,
"hotpluggable-cpus": false,
"name": "xenpv"
},
[...]
{
"supported-device-types": [
"sys-bus-device",
"floppy",
"i2c-slave",
"pci-device",
"isa-device",
"ide-device"
],
"name": "pc-i440fx-2.8",
"alias": "pc",
"is-default": true,
"cpu-max": 255,
"hotpluggable-cpus": true
},
[...]
{
"supported-device-types": [
"sys-bus-device",
"floppy",
"isa-device",
"ide-device"
],
"cpu-max": 1,
"hotpluggable-cpus": true,
"name": "isapc"
},
[...]
{
"supported-device-types": [
"sys-bus-device",
"floppy",
"i2c-slave",
"pci-device",
"isa-device",
"ide-device"
],
"cpu-max": 128,
"hotpluggable-cpus": true,
"name": "xenfv"
},
[...]
{
"alias": "q35",
"supported-device-types": [
"sys-bus-device",
"i2c-slave",
"PCIE-device",
"isa-device",
"ide-device"
],
"cpu-max": 288,
"hotpluggable-cpus": true,
"name": "pc-q35-2.8"
},
[...]
]
}
Considered alternatives
=======================
Indirect mapping (machine => bus => device)
-------------------------------------------
This RFC implements a mechanism to implement ax
machine-type => supported-device-types
mapping. An alternative solution I considered was to expose an
indirect mapping:
machine-type => default-bus-types
followed by
bus-type => supported-device-types.
But exposing only the resulting supported device-types list
imposes less restrictions on how the device and bus type
hierarchy is implemented inside QEMU. There's still a
machine-type => bus-type => device-type
mapping implemented internally, but it is an implementation
detail on the current version, and not part of the
externally-visible interface.
The Implementation
==================
This add a new field to MachineClass: default_bus_types, and a
new field to BusClass: supported_device_type.
The two fields are used to build the list of supported device
types for a given machine. On most cases, the normal QOM type
hierarchy is used to define the set of supported devices for a
bus. On the case of PCIe buses, a INTERFACE_PCIE_DEVICE interface
name was introduced, to indicate PCIe-capable devices.
This means we are duplicating information in some cases:
* BusClass::supported_device_type duplicates knowlege that is
already encoded in DeviceClass::bus_type.
To make sure both fields agree with each other, a new
device_class_set_bus_type() wrapper was added, to perform
additional validation.
* MachineClass::default_bus_type duplicates knowledge that is
already encoded in the machine init function.
To make sure the information is correct, a qmp-machine-info.py
test case is added, that will validate the
supported-device-types field based on the buses created by the
machine.
* PCIDeviceClass::is_express and INTERFACE_PCIE_DEVICE
both encode the same information about a PCI device class.
A future version of this series may include a
class_base_post_init hook that will allow TYPE_PCI_DEVICE to
validate/update is_express and the interface list to ensure
both are always consistent.
Test Code
---------
qdev-based test code for the new field was implemented in a
Python script. Some extra support was implemented in
tests/Makefile.include, scripts/qemu.py and scripts/qtest.py to
allow the test to be implemented.
Limitations
===========
TYPE_SYS_BUS_DEVICE is too generic
----------------------------------
Currently all machines have a TYPE_SYS_BUS bus, meaning all
TYPE_SYS_BUS_DEVICE subclasses are reported as supported.
The current solution in this series is to report
TYPE_SYS_BUS_DEVICE as supported by all machines. But we could
gradually add arch-specific or machine-family-specific interface
names that can be used on devices that are meant to work with
only a subset of TYPE_SYS_BUS_DEVICE subclasses.
A future version of this series may remove TYPE_SYS_BUS_DEVICE
from the supported-device-types output, and return a
arch-specific or machine-family-specific interface name to
restrict management software to a subset of TYPE_SYS_BUS_DEVICE
subclasses.
PCI vs PCIe
-----------
Machines with PCIe buses will report INTERFACE_PCIE_DEVICE on
supported-device-types.
Machines with legacy PCI buses will report TYPE_PCI_DEVICE on
supported-device-types.
The problem with the current approach is that PCIe devices are
TYPE_PCI_DEVICE subclasses. The allows PCI device classes to
indicate they are PCIe-capable, but there's no obvious way to
indicate that a device is PCIe-only. This needs to be addressed
in a future version of this series.
Suggestions are welcome.
Incomplete bus lists on some machines
-------------------------------------
With this series, not all machines classes are changed to add the
full list of device types on the 'supported-device-types'. To
allow the code to be updated gradually, qmp-machine-info.py has a
STRICT_ARCHES variable, that will make the test code require a
complete device type list only on some architectures.
Out of scope: Configurable buses
--------------------------------
There's no way to map machine options like "usb=on|off" to
device-types or buses. I plan to propose a new interface that
allows machine options to be mapped to buses/device-types later.
Out of scope: Deciding where to plug devices
--------------------------------------------
Once management software discovers which devices can be plugged
to a machine, it still has to discover or define where devices
can/should/will be plugged. This is out of the scope of this
series.
Out of scope: Hotplug
---------------------
The proposed interface is supposed to help management software
find which device types can be used when creating the VM. Device
hotplug is out of the scope of this series. However, the new
'device-types' QOM property on bus objects could be used to find
out which device types can be plugged on the existing buses.
---
Cc: libvir-list(a)redhat.com
Cc: Laine Stump <laine(a)redhat.com>
Eduardo Habkost (15):
qemu.py: Make logging optional
qtest.py: Support QTEST_LOG environment variable
qtest.py: make logging optional
qtest.py: Make 'binary' parameter optional
tests: Add rules to non-gtester qtest test cases
qdev: Add device_type field to BusClass
machine: Add MachineClass::default_buses field
qmp: Add 'supported-device-types' field to 'query-machines'
pci: Introduce INTERFACE_PCIE_DEVICE interface name
pc: Initialize default bus lists
s390x: Initialize default bus lists
arm: Initialize default bus lists
mips: Initialize default bus lists
ppc: Initialize default bus lists
qdev: Add device_class_set_bus_type() function
hw/arm/aspeed.c | 2 +
hw/arm/collie.c | 1 +
hw/arm/cubieboard.c | 1 +
hw/arm/exynos4_boards.c | 5 ++
hw/arm/gumstix.c | 7 ++
hw/arm/highbank.c | 4 ++
hw/arm/imx25_pdk.c | 1 +
hw/arm/kzm.c | 1 +
hw/arm/musicpal.c | 1 +
hw/arm/nseries.c | 2 +
hw/arm/palm.c | 1 +
hw/arm/realview.c | 1 +
hw/arm/spitz.c | 10 +++
hw/arm/stellaris.c | 4 ++
hw/audio/intel-hda.c | 9 ++-
hw/block/fdc.c | 17 +++--
hw/block/nvme.c | 4 ++
hw/char/virtio-serial-bus.c | 3 +-
hw/core/bus.c | 9 +++
hw/core/machine.c | 18 ++++-
hw/core/qdev.c | 8 +++
hw/core/sysbus.c | 3 +-
hw/i2c/core.c | 9 ++-
hw/i386/pc_piix.c | 13 ++++
hw/i386/pc_q35.c | 4 ++
hw/ide/qdev.c | 3 +-
hw/input/adb.c | 9 ++-
hw/ipack/ipack.c | 9 ++-
hw/isa/isa-bus.c | 3 +-
hw/mips/mips_malta.c | 7 ++
hw/mips/mips_r4k.c | 2 +
hw/misc/auxbus.c | 3 +-
hw/net/e1000e.c | 4 ++
hw/net/vmxnet3.c | 4 ++
hw/pci-bridge/ioh3420.c | 4 ++
hw/pci-bridge/xio3130_downstream.c | 4 ++
hw/pci/pci.c | 16 ++++-
hw/ppc/e500plat.c | 3 +
hw/ppc/mac_newworld.c | 4 ++
hw/ppc/mac_oldworld.c | 3 +
hw/ppc/mpc8544ds.c | 4 ++
hw/ppc/ppc440_bamboo.c | 1 +
hw/ppc/prep.c | 4 ++
hw/ppc/spapr_vio.c | 3 +-
hw/s390x/css-bridge.c | 2 +
hw/s390x/event-facility.c | 3 +-
hw/s390x/s390-pci-bus.c | 9 ++-
hw/s390x/s390-virtio-ccw.c | 6 ++
hw/s390x/virtio-ccw.c | 2 +-
hw/scsi/megasas.c | 7 ++
hw/scsi/scsi-bus.c | 3 +-
hw/scsi/vmw_pvscsi.c | 1 +
hw/sd/core.c | 7 ++
hw/sd/sd.c | 2 +-
hw/ssi/ssi.c | 9 ++-
hw/usb/bus.c | 3 +-
hw/usb/dev-smartcard-reader.c | 9 ++-
hw/usb/hcd-xhci.c | 4 ++
hw/vfio/pci.c | 4 ++
hw/virtio/virtio-bus.c | 1 +
hw/virtio/virtio-pci.c | 4 ++
hw/virtio/virtio.c | 2 +-
include/hw/boards.h | 5 ++
include/hw/pci/pci.h | 3 +
include/hw/qdev-core.h | 4 ++
qapi-schema.json | 9 ++-
scripts/qemu.py | 25 +++++--
scripts/qtest.py | 15 +++-
tests/Makefile.include | 39 ++++++++++-
tests/qmp-machine-info.py | 138 +++++++++++++++++++++++++++++++++++++
vl.c | 11 +++
71 files changed, 518 insertions(+), 37 deletions(-)
create mode 100755 tests/qmp-machine-info.py
--
2.7.4
7 years, 12 months
[libvirt] [PATCH v3] storage_backend_rbd: check the return value of rados_conf_set
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
We forget to check the return value of some rados_conf_set.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
v2: add another missing return value check
v3: fix a copy-paste error
src/storage/storage_backend_rbd.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 718c4d6..a286af0 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -159,13 +159,28 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr ptr,
* Operations in librados will return -ETIMEDOUT when the timeout is reached.
*/
VIR_DEBUG("Setting RADOS option client_mount_timeout to %s", client_mount_timeout);
- rados_conf_set(ptr->cluster, "client_mount_timeout", client_mount_timeout);
+ if (rados_conf_set(ptr->cluster, "client_mount_timeout", client_mount_timeout) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to set RADOS option: %s"),
+ "client_mount_timeout");
+ goto cleanup;
+ }
VIR_DEBUG("Setting RADOS option rados_mon_op_timeout to %s", mon_op_timeout);
- rados_conf_set(ptr->cluster, "rados_mon_op_timeout", mon_op_timeout);
+ if (rados_conf_set(ptr->cluster, "rados_mon_op_timeout", mon_op_timeout) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to set RADOS option: %s"),
+ "rados_mon_op_timeout");
+ goto cleanup;
+ }
VIR_DEBUG("Setting RADOS option rados_osd_op_timeout to %s", osd_op_timeout);
- rados_conf_set(ptr->cluster, "rados_osd_op_timeout", osd_op_timeout);
+ if (rados_conf_set(ptr->cluster, "rados_osd_op_timeout", osd_op_timeout) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to set RADOS option: %s"),
+ "rados_osd_op_timeout");
+ goto cleanup;
+ }
/*
* Librbd supports creating RBD format 2 images. We no longer have to invoke
@@ -173,7 +188,12 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr ptr,
* This leaves us to simply use rbd_create() and use the default behavior of librbd
*/
VIR_DEBUG("Setting RADOS option rbd_default_format to %s", rbd_default_format);
- rados_conf_set(ptr->cluster, "rbd_default_format", rbd_default_format);
+ if (rados_conf_set(ptr->cluster, "rbd_default_format", rbd_default_format) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to set RADOS option: %s"),
+ "rbd_default_format");
+ goto cleanup;
+ }
ptr->starttime = time(0);
if ((r = rados_connect(ptr->cluster)) < 0) {
--
1.8.3.1
7 years, 12 months
[libvirt] [PATCH 0/2] fix build on macOS
by Roman Bogorodskiy
This series fixes too issues.
- rpcgen issue. rpcgen(1) that comes with macOS is too old. I've grabbed
rpcgen from FreeBSD and created a brew formula for it[1]. I configure it like:
./configure ac_cv_path_RPCGEN=/usr/local/bin/bsdrpcgen
It still requires darwin to be added to the fixup list in genprotocol.pl
- macOS doesn't support clock_gettime(3), so use its own routnes
1: https://gist.github.com/novel/0d74cdbc7b71f60640a42b52c9cc1459
Roman Bogorodskiy (2):
genprotocol.pl: add darwing to fixup list
tests: fix eventtest build on macOS
configure.ac | 9 +++++++++
src/rpc/genprotocol.pl | 2 +-
tests/Makefile.am | 2 +-
tests/eventtest.c | 16 ++++++++++++++++
4 files changed, 27 insertions(+), 2 deletions(-)
--
2.10.2
7 years, 12 months
[libvirt] [PATCH 0/4] introduce virCheckControllerGoto to simplify cgroup controller check
by Chen Hanxiao
We had a lot of codes use the same style of cgroup controller check.
This series introduce macro virCheckControllerGoto
to simplify these kinds of check.
Chen Hanxiao (4):
internal: introduce macro virCheckControllerGoto
lxc_driver: use virCheckControllerGoto to simplify cgroup controller
check
qemu_driver: use virCheckControllerGoto to simplify cgroup controller
check
qemu_process: use virCheckControllerGoto to simplify cgroup controller
check
src/internal.h | 19 ++++++++
src/lxc/lxc_driver.c | 115 ++++++++++++++----------------------------------
src/qemu/qemu_driver.c | 70 +++++++++--------------------
src/qemu/qemu_process.c | 9 ++--
4 files changed, 77 insertions(+), 136 deletions(-)
--
1.8.3.1
7 years, 12 months
[libvirt] [PATCH] qemu: Allow use of hot plugged host CPUs if no affinity set
by Viktor Mihajlovski
Running VMs couldn't use newly hot plugged host CPUs even if the VMs
had no CPU pinning defined AND the cpuset controller was disabled in
the libvirt qemu configuration.
This was because in this case the process affinity was set by libvirt
to all currently present host CPUs in order to avoid situations, where
libvirtd was deliberately running on a CPU subset and thus the spawned
VMs would be involuntarily restricted to the CPU subset inherited by
libvirtd.
That however prevents new host CPUs to be utilized when they show up.
With this change we will NOT set the VM's affinity mask if it
matches the online host CPU mask.
There's still the chance that for some reason the deliberately chosen
libvirtd affinity matches the online host CPU mask by accident. In this
case the behavior remains as it was before (CPUs offline while setting
the affinity will not be used if they show up later on).
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
Tested-by: Matthew Rosato <mjrosato(a)linux.vnet.ibm.com>
---
src/qemu/qemu_process.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1b67aee..76f9210 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2202,6 +2202,7 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
int ret = -1;
virBitmapPtr cpumap = NULL;
virBitmapPtr cpumapToSet = NULL;
+ virBitmapPtr hostcpumap = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
if (!vm->pid) {
@@ -2223,6 +2224,16 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
* the spawned QEMU instance to all pCPUs if no map is given in
* its config file */
int hostcpus;
+ hostcpumap = virHostCPUGetOnlineBitmap();
+ cpumap = virProcessGetAffinity(vm->pid);
+
+ if (hostcpumap && cpumap && virBitmapEqual(hostcpumap, cpumap)) {
+ /* we're using all available CPUs, no reason to set
+ * mask. If libvirtd is running without explicit
+ * affinity, we can use hotplugged CPUs for this VM */
+ ret = 0;
+ goto cleanup;
+ }
/* setaffinity fails if you set bits for CPUs which
* aren't present, so we have to limit ourselves */
@@ -2248,6 +2259,7 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
cleanup:
virBitmapFree(cpumap);
+ virBitmapFree(hostcpumap);
return ret;
}
--
1.9.1
7 years, 12 months
[libvirt] [PATCH V2] qemu: Allow use of hot plugged host CPUs if no affinity set
by Viktor Mihajlovski
If the cpuset cgroup controller is disabled in /etc/libvirt/qemu.conf
QEMU virtual machines can in principle use all host CPUs, even if they
are hot plugged, if they have no explicit CPU affinity defined.
However, there's libvirt code supposed to handle the situation where
the libvirt daemon itself is not using all host CPUs. The code in
qemuProcessInitCpuAffinity attempts to set an affinity mask including
all defined host CPUs. Unfortunately, the resulting affinity mask for
the process will not contain the offline CPUs. See also the
sched_setaffinity(2) man page.
That means that even if the host CPUs come online again, they won't be
used by the QEMU process anymore. The same is true for newly hot
plugged CPUs. So we are effectively preventing that QEMU uses all
processors instead of enabling it to use them.
It only makes sense to set the QEMU process affinity if we're able
to actually grow the set of usable CPUs, i.e. if the process affinity
is a subset of the online host CPUs.
There's still the chance that for some reason the deliberately chosen
libvirtd affinity matches the online host CPU mask by accident. In this
case the behavior remains as it was before (CPUs offline while setting
the affinity will not be used if they show up later on).
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
Tested-by: Matthew Rosato <mjrosato(a)linux.vnet.ibm.com>
---
V2:
- Avoid memory leak by freeing cpumap if the affinity has
to be set.
- Made an attempt to better describe the issue at hand
src/qemu/qemu_process.c | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 4758c49..7e55086 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2202,6 +2202,7 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
int ret = -1;
virBitmapPtr cpumap = NULL;
virBitmapPtr cpumapToSet = NULL;
+ virBitmapPtr hostcpumap = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
if (!vm->pid) {
@@ -2223,21 +2224,32 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
* the spawned QEMU instance to all pCPUs if no map is given in
* its config file */
int hostcpus;
-
- /* setaffinity fails if you set bits for CPUs which
- * aren't present, so we have to limit ourselves */
- if ((hostcpus = virHostCPUGetCount()) < 0)
+ hostcpumap = virHostCPUGetOnlineBitmap();
+ cpumap = virProcessGetAffinity(vm->pid);
+
+ if (hostcpumap && cpumap && virBitmapEqual(hostcpumap, cpumap)) {
+ /* we're using all available CPUs, no reason to set
+ * mask. If libvirtd is running without explicit
+ * affinity, we can use hotplugged CPUs for this VM */
+ ret = 0;
goto cleanup;
+ } else {
+ /* setaffinity fails if you set bits for CPUs which
+ * aren't present, so we have to limit ourselves */
+ if ((hostcpus = virHostCPUGetCount()) < 0)
+ goto cleanup;
- if (hostcpus > QEMUD_CPUMASK_LEN)
- hostcpus = QEMUD_CPUMASK_LEN;
+ if (hostcpus > QEMUD_CPUMASK_LEN)
+ hostcpus = QEMUD_CPUMASK_LEN;
- if (!(cpumap = virBitmapNew(hostcpus)))
- goto cleanup;
+ virBitmapFree(cpumap);
+ if (!(cpumap = virBitmapNew(hostcpus)))
+ goto cleanup;
- virBitmapSetAll(cpumap);
+ virBitmapSetAll(cpumap);
- cpumapToSet = cpumap;
+ cpumapToSet = cpumap;
+ }
}
}
@@ -2248,6 +2260,7 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
cleanup:
virBitmapFree(cpumap);
+ virBitmapFree(hostcpumap);
return ret;
}
--
1.9.1
7 years, 12 months