[PATCH] esx: Bump minimal version of curl
by Michal Privoznik
According to meson.build the minimal version of curl needed is
7.18.0 which was released in January 2008. If the minimal version
is bumped to 7.19.1 (released in November 2008) we can drop some
workarounds because this newer version provides APIs we need.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Since the new version is still ~12 years old, I did not check whether it
is available in all supported distros. If it isn't then we should
re-evaluate support of running libvirt from git on that distro.
meson.build | 2 +-
src/esx/esx_stream.c | 8 --------
src/esx/esx_vi.c | 7 -------
3 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/meson.build b/meson.build
index 766bc06b61..369548f127 100644
--- a/meson.build
+++ b/meson.build
@@ -1001,7 +1001,7 @@ if capng_dep.found()
conf.set('WITH_CAPNG', 1)
endif
-curl_version = '7.18.0'
+curl_version = '7.19.1'
curl_dep = dependency('libcurl', version: '>=' + curl_version, required: get_option('curl'))
if curl_dep.found()
# XXX as of libcurl-devel-7.20.1-3.fc13.x86_64, curl ships a version
diff --git a/src/esx/esx_stream.c b/src/esx/esx_stream.c
index 131fbc100b..e4e67a01bb 100644
--- a/src/esx/esx_stream.c
+++ b/src/esx/esx_stream.c
@@ -396,7 +396,6 @@ esxStreamOpen(virStreamPtr stream, esxPrivate *priv, const char *url,
int result = -1;
esxStreamPrivate *streamPriv;
g_autofree char *range = NULL;
- g_autofree char *userpwd = NULL;
esxVI_MultiCURL *multi = NULL;
/* FIXME: Although there is already some code in place to deal with
@@ -438,17 +437,10 @@ esxStreamOpen(virStreamPtr stream, esxPrivate *priv, const char *url,
curl_easy_setopt(streamPriv->curl->handle, CURLOPT_URL, url);
curl_easy_setopt(streamPriv->curl->handle, CURLOPT_RANGE, range);
-#if LIBCURL_VERSION_NUM >= 0x071301 /* 7.19.1 */
curl_easy_setopt(streamPriv->curl->handle, CURLOPT_USERNAME,
priv->primary->username);
curl_easy_setopt(streamPriv->curl->handle, CURLOPT_PASSWORD,
priv->primary->password);
-#else
- userpwd = g_strdup_printf("%s:%s", priv->primary->username,
- priv->primary->password);
-
- curl_easy_setopt(streamPriv->curl->handle, CURLOPT_USERPWD, userpwd);
-#endif
if (esxVI_MultiCURL_Alloc(&multi) < 0 ||
esxVI_MultiCURL_Add(multi, streamPriv->curl) < 0)
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index e1c1a15ab6..e535b28484 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -230,9 +230,7 @@ esxVI_CURL_Perform(esxVI_CURL *curl, const char *url)
{
CURLcode errorCode;
long responseCode = 0;
-#if LIBCURL_VERSION_NUM >= 0x071202 /* 7.18.2 */
const char *redirectUrl = NULL;
-#endif
errorCode = curl_easy_perform(curl->handle);
@@ -262,7 +260,6 @@ esxVI_CURL_Perform(esxVI_CURL *curl, const char *url)
}
if (responseCode == 301) {
-#if LIBCURL_VERSION_NUM >= 0x071202 /* 7.18.2 */
errorCode = curl_easy_getinfo(curl->handle, CURLINFO_REDIRECT_URL,
&redirectUrl);
@@ -277,10 +274,6 @@ esxVI_CURL_Perform(esxVI_CURL *curl, const char *url)
_("The server redirects from '%s' to '%s'"), url,
redirectUrl);
}
-#else
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("The server redirects from '%s'"), url);
-#endif
return -1;
}
--
2.26.2
3 years, 9 months
[libvirt PATCH v2 0/3] qemu: add support for VNC power control options
by Daniel P. Berrangé
Daniel P. Berrang=C3=A9 (3):
conf: add support for VNC power control setting
qemu: probe for -vnc power-control option support
qemu: wire up support for VNC power control options
docs/formatdomain.rst | 5 +++
docs/schemas/domaincommon.rng | 5 +++
src/conf/domain_conf.c | 15 +++++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 6 +++
src/qemu/qemu_validate.c | 21 ++++++++++
.../caps_6.0.0.x86_64.xml | 1 +
.../graphics-vnc-power.x86_64-latest.args | 40 +++++++++++++++++++
tests/qemuxml2argvdata/graphics-vnc-power.xml | 36 +++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
12 files changed, 134 insertions(+)
create mode 100644 tests/qemuxml2argvdata/graphics-vnc-power.x86_64-latest.a=
rgs
create mode 100644 tests/qemuxml2argvdata/graphics-vnc-power.xml
--=20
2.29.2
3 years, 9 months
[libvirt PATCH 0/9] eliminate (almost) all VIR_FREE in esx directory
by Laine Stump
142 more down, 3084 to go :-)
This goes through all the standard methods of eliminating VIR_FREE -
first converting as many pointers as possible to g_autofree, then
converting a few more *Free* functions (that were more questionable
than previous Frees) to use g_free, then some trivial refactoring. And
finally at the end a few stragglers that really do need the pointers
cleared were changed to g_clear_pointer(x, g_free).
A couple of issues:
1) There are two definitions of a macro called ESX_VI__TEMPLATE__FREE
that generate functions with names in the form of
"esxVI_.*_Free". These generated functions were doing
"VIR_FREE(*ptrptr)" at the end; because of the "*", the caller's
pointer would be cleared out (not just the local copy). There are
something over 400 calls to these functions, and all but 10 or so that
I audited will never reference the pointer after return from
esxVI_Blah_Free(). But there are several that do. Since I'm unfamiliar
with this code and don't want to risk breaking it, I opted to just use
g_clear_pointer(ptrptr, g_free), thus preserving current behavior
exactly.
2) There are still 7 instances of VIR_FREE in the esx directory. All 7
of them are in loops that are clearing out an array of names prior to
returning failure, and from a quick glance it looks like there are at
least a few places where it is important to clear the array entries. But rather than brute force convert to using g_clear_pointer in the loop, I figured someone may come up with an elegant translation to use GArray or GPtrArray instead, so I'm leaving them for now.
Laine Stump (9):
esx: use g_autofree for char* where it is trivially possible
esx: use g_autofree when made possible by reducing scope
esx: fix memory leak by switching to g_autofree
esx: switch VIR_FREE->g_free in esx*Free*()
esx: use g_steal_pointer+g_autofree on return value
esx: reorder code to avoid need to VIR_FREE mimeType
esx: switch VIR_FREE->g_free when the pointer will immediately go out
of scope
esx: eliminate unnecessary cleanup: labels and result variables
esx: replace some VIR_FREE with g_clear_pointer(x, g_free)
src/esx/esx_driver.c | 189 +++++++++-------------------
src/esx/esx_network_driver.c | 4 +-
src/esx/esx_storage_backend_iscsi.c | 16 +--
src/esx/esx_storage_backend_vmfs.c | 150 +++++++---------------
src/esx/esx_stream.c | 11 +-
src/esx/esx_util.c | 41 +++---
src/esx/esx_vi.c | 111 ++++++----------
src/esx/esx_vi_methods.c | 3 +-
src/esx/esx_vi_types.c | 18 +--
9 files changed, 179 insertions(+), 364 deletions(-)
--
2.29.2
3 years, 9 months
[PATCH] libxl: Use g_autofree for char* where easily possible
by Jim Fehlig
All of these strings are allocated once, freed once, and are never
returned out of the function where they are declared.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_capabilities.c | 3 +--
src/libxl/libxl_domain.c | 17 +++++------------
src/libxl/libxl_driver.c | 32 +++++++++++---------------------
src/libxl/libxl_logger.c | 21 ++++++---------------
src/libxl/libxl_migration.c | 15 +++++----------
src/libxl/xen_common.c | 17 ++++++-----------
src/libxl/xen_xl.c | 6 ++----
7 files changed, 36 insertions(+), 75 deletions(-)
diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index 2f3ed5bc83..10e5d46cdd 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -769,7 +769,7 @@ libxlDomainGetEmulatorType(const virDomainDef *def)
{
int ret = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN;
virCommandPtr cmd = NULL;
- char *output = NULL;
+ g_autofree char *output = NULL;
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
if (def->emulator) {
@@ -790,7 +790,6 @@ libxlDomainGetEmulatorType(const virDomainDef *def)
}
cleanup:
- VIR_FREE(output);
virCommandFree(cmd);
return ret;
}
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 3bcd369d12..365ac36f2b 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -748,7 +748,7 @@ libxlDomainSaveImageOpen(libxlDriverPrivatePtr driver,
int fd;
virDomainDefPtr def = NULL;
libxlSavefileHeader hdr;
- char *xml = NULL;
+ g_autofree char *xml = NULL;
if ((fd = virFileOpenAs(from, O_RDONLY, 0, -1, -1, 0)) < 0) {
virReportSystemError(-fd,
@@ -792,15 +792,12 @@ libxlDomainSaveImageOpen(libxlDriverPrivatePtr driver,
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
goto error;
- VIR_FREE(xml);
-
*ret_def = def;
*ret_hdr = hdr;
return fd;
error:
- VIR_FREE(xml);
virDomainDefFree(def);
VIR_FORCE_CLOSE(fd);
return -1;
@@ -951,7 +948,7 @@ libxlDomainAutoCoreDump(libxlDriverPrivatePtr driver,
g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
g_autoptr(GDateTime) now = g_date_time_new_now_local();
g_autofree char *nowstr = NULL;
- char *dumpfile = NULL;
+ g_autofree char *dumpfile = NULL;
nowstr = g_date_time_format(now, "%Y-%m-%d-%H:%M:%S");
@@ -963,7 +960,6 @@ libxlDomainAutoCoreDump(libxlDriverPrivatePtr driver,
libxl_domain_core_dump(cfg->ctx, vm->def->id, dumpfile, NULL);
virObjectLock(vm);
- VIR_FREE(dumpfile);
return 0;
}
@@ -1262,8 +1258,8 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
libxlSavefileHeader hdr;
int ret = -1;
uint32_t domid = 0;
- char *dom_xml = NULL;
- char *managed_save_path = NULL;
+ g_autofree char *dom_xml = NULL;
+ g_autofree char *managed_save_path = NULL;
int managed_save_fd = -1;
libxlDomainObjPrivatePtr priv = vm->privateData;
g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
@@ -1271,7 +1267,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
libxl_asyncprogress_how aop_console_how;
libxl_domain_restore_params params;
unsigned int hostdev_flags = VIR_HOSTDEV_SP_PCI;
- char *config_json = NULL;
+ g_autofree char *config_json = NULL;
#ifdef LIBXL_HAVE_PVUSB
hostdev_flags |= VIR_HOSTDEV_SP_USB;
@@ -1513,9 +1509,6 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
cleanup:
libxl_domain_config_dispose(&d_config);
- VIR_FREE(config_json);
- VIR_FREE(dom_xml);
- VIR_FREE(managed_save_path);
virDomainDefFree(def);
VIR_FORCE_CLOSE(managed_save_fd);
return ret;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 2e002b2930..fcb203ab98 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -533,7 +533,7 @@ libxlDriverShouldLoad(bool privileged)
if (virFileExists(HYPERVISOR_CAPABILITIES)) {
int status;
- char *output = NULL;
+ g_autofree char *output = NULL;
/*
* Don't load if not running on a Xen control domain (dom0). It is not
* sufficient to check for the file to exist as any guest can mount
@@ -542,7 +542,6 @@ libxlDriverShouldLoad(bool privileged)
status = virFileReadAll(HYPERVISOR_CAPABILITIES, 10, &output);
if (status >= 0)
status = strncmp(output, "control_d", 9);
- VIR_FREE(output);
if (status) {
VIR_INFO("No Xen capabilities detected, probably not running "
"in a Xen Dom0. Disabling libxenlight driver");
@@ -1819,7 +1818,7 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver,
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
libxlSavefileHeader hdr;
virObjectEventPtr event = NULL;
- char *xml = NULL;
+ g_autofree char *xml = NULL;
uint32_t xml_len;
int fd = -1;
int ret = -1;
@@ -1889,7 +1888,6 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver,
ret = 0;
cleanup:
- VIR_FREE(xml);
if (VIR_CLOSE(fd) < 0)
virReportSystemError(errno, "%s", _("cannot close file"));
virObjectEventStateQueue(driver->domainEventState, event);
@@ -2117,7 +2115,7 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags)
{
libxlDriverPrivatePtr driver = dom->conn->privateData;
virDomainObjPtr vm = NULL;
- char *name = NULL;
+ g_autofree char *name = NULL;
int ret = -1;
virCheckFlags(0, -1);
@@ -2160,7 +2158,6 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags)
cleanup:
virDomainObjEndAPI(&vm);
- VIR_FREE(name);
return ret;
}
@@ -2213,7 +2210,7 @@ libxlDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
libxlDriverPrivatePtr driver = dom->conn->privateData;
virDomainObjPtr vm = NULL;
int ret = -1;
- char *name = NULL;
+ g_autofree char *name = NULL;
virCheckFlags(0, -1);
@@ -2231,7 +2228,6 @@ libxlDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
vm->hasManagedSave = false;
cleanup:
- VIR_FREE(name);
virDomainObjEndAPI(&vm);
return ret;
}
@@ -2917,7 +2913,7 @@ libxlDomainUndefineFlags(virDomainPtr dom,
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
virDomainObjPtr vm;
virObjectEventPtr event = NULL;
- char *name = NULL;
+ g_autofree char *name = NULL;
int ret = -1;
virCheckFlags(VIR_DOMAIN_UNDEFINE_MANAGED_SAVE, -1);
@@ -2967,7 +2963,6 @@ libxlDomainUndefineFlags(virDomainPtr dom,
ret = 0;
cleanup:
- VIR_FREE(name);
virDomainObjEndAPI(&vm);
virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
@@ -4518,7 +4513,8 @@ libxlDomainSetAutostart(virDomainPtr dom, int autostart)
libxlDriverPrivatePtr driver = dom->conn->privateData;
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
virDomainObjPtr vm;
- char *configFile = NULL, *autostartLink = NULL;
+ g_autofree char *configFile = NULL;
+ g_autofree char *autostartLink = NULL;
int ret = -1;
if (!(vm = libxlDomObjFromDomain(dom)))
@@ -4577,8 +4573,6 @@ libxlDomainSetAutostart(virDomainPtr dom, int autostart)
libxlDomainObjEndJob(driver, vm);
cleanup:
- VIR_FREE(configFile);
- VIR_FREE(autostartLink);
virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
@@ -4882,7 +4876,7 @@ libxlDomainGetNumaParameters(virDomainPtr dom,
virDomainObjPtr vm;
libxl_bitmap nodemap;
virBitmapPtr nodes = NULL;
- char *nodeset = NULL;
+ g_autofree char *nodeset = NULL;
int rc, ret = -1;
size_t i, j;
@@ -4981,7 +4975,6 @@ libxlDomainGetNumaParameters(virDomainPtr dom,
ret = 0;
cleanup:
- VIR_FREE(nodeset);
virBitmapFree(nodes);
libxl_bitmap_dispose(&nodemap);
virDomainObjEndAPI(&vm);
@@ -5783,7 +5776,7 @@ libxlNodeDeviceDetachFlags(virNodeDevicePtr dev,
virPCIDeviceAddress devAddr;
int ret = -1;
virNodeDeviceDefPtr def = NULL;
- char *xml = NULL;
+ g_autofree char *xml = NULL;
libxlDriverPrivatePtr driver = dev->conn->privateData;
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
virConnectPtr nodeconn = NULL;
@@ -5839,7 +5832,6 @@ libxlNodeDeviceDetachFlags(virNodeDevicePtr dev,
virNodeDeviceDefFree(def);
virObjectUnref(nodedev);
virObjectUnref(nodeconn);
- VIR_FREE(xml);
return ret;
}
@@ -5856,7 +5848,7 @@ libxlNodeDeviceReAttach(virNodeDevicePtr dev)
virPCIDeviceAddress devAddr;
int ret = -1;
virNodeDeviceDefPtr def = NULL;
- char *xml = NULL;
+ g_autofree char *xml = NULL;
libxlDriverPrivatePtr driver = dev->conn->privateData;
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
virConnectPtr nodeconn = NULL;
@@ -5903,7 +5895,6 @@ libxlNodeDeviceReAttach(virNodeDevicePtr dev)
virNodeDeviceDefFree(def);
virObjectUnref(nodedev);
virObjectUnref(nodeconn);
- VIR_FREE(xml);
return ret;
}
@@ -5914,7 +5905,7 @@ libxlNodeDeviceReset(virNodeDevicePtr dev)
virPCIDeviceAddress devAddr;
int ret = -1;
virNodeDeviceDefPtr def = NULL;
- char *xml = NULL;
+ g_autofree char *xml = NULL;
libxlDriverPrivatePtr driver = dev->conn->privateData;
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
virConnectPtr nodeconn = NULL;
@@ -5961,7 +5952,6 @@ libxlNodeDeviceReset(virNodeDevicePtr dev)
virNodeDeviceDefFree(def);
virObjectUnref(nodedev);
virObjectUnref(nodeconn);
- VIR_FREE(xml);
return ret;
}
diff --git a/src/libxl/libxl_logger.c b/src/libxl/libxl_logger.c
index 93a9c76b25..39e59d9231 100644
--- a/src/libxl/libxl_logger.c
+++ b/src/libxl/libxl_logger.c
@@ -65,7 +65,7 @@ libvirt_vmessage(xentoollog_logger *logger_in,
xentoollog_logger_libvirt *lg = (xentoollog_logger_libvirt *)logger_in;
FILE *logFile = lg->defaultLogFile;
char timestamp[VIR_TIME_STRING_BUFLEN];
- char *message = NULL;
+ g_autofree char *message = NULL;
char *start, *end;
VIR_DEBUG("libvirt_vmessage: context='%s' format='%s'", context, format);
@@ -107,8 +107,6 @@ libvirt_vmessage(xentoollog_logger *logger_in,
fputc('\n', logFile);
fflush(logFile);
-
- VIR_FREE(message);
}
static void
@@ -135,7 +133,7 @@ libxlLoggerNew(const char *logDir, virLogPriority minLevel)
{
xentoollog_logger_libvirt logger;
libxlLoggerPtr logger_out = NULL;
- char *path = NULL;
+ g_autofree char *path = NULL;
switch (minLevel) {
case VIR_LOG_DEBUG:
@@ -164,7 +162,6 @@ libxlLoggerNew(const char *logDir, virLogPriority minLevel)
logger_out = XTL_NEW_LOGGER(libvirt, logger);
cleanup:
- VIR_FREE(path);
return logger_out;
error:
@@ -188,9 +185,9 @@ libxlLoggerOpenFile(libxlLoggerPtr logger,
const char *name,
const char *domain_config)
{
- char *path = NULL;
+ g_autofree char *path = NULL;
FILE *logFile = NULL;
- char *domidstr = NULL;
+ g_autofree char *domidstr = NULL;
path = g_strdup_printf("%s/%s.log", logger->logDir, name);
domidstr = g_strdup_printf("%d", id);
@@ -198,7 +195,7 @@ libxlLoggerOpenFile(libxlLoggerPtr logger,
if (!(logFile = fopen(path, "a"))) {
VIR_WARN("Failed to open log file %s: %s",
path, g_strerror(errno));
- goto cleanup;
+ return;
}
ignore_value(virHashAddEntry(logger->files, domidstr, logFile));
@@ -207,19 +204,13 @@ libxlLoggerOpenFile(libxlLoggerPtr logger,
fprintf(logFile, "Domain start: %s\n", domain_config);
fflush(logFile);
}
-
- cleanup:
- VIR_FREE(path);
- VIR_FREE(domidstr);
}
void
libxlLoggerCloseFile(libxlLoggerPtr logger, int id)
{
- char *domidstr = NULL;
+ g_autofree char *domidstr = NULL;
domidstr = g_strdup_printf("%d", id);
ignore_value(virHashRemoveEntry(logger->files, domidstr));
-
- VIR_FREE(domidstr);
}
diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index c56fdd98ab..631f67930d 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -150,7 +150,7 @@ libxlMigrationEatCookie(const char *cookiein,
libxlMigrationCookiePtr mig = NULL;
xmlDocPtr doc = NULL;
xmlXPathContextPtr ctxt = NULL;
- char *uuidstr = NULL;
+ g_autofree char *uuidstr = NULL;
int ret = -1;
/*
@@ -216,7 +216,6 @@ libxlMigrationEatCookie(const char *cookiein,
libxlMigrationCookieFree(mig);
cleanup:
- VIR_FREE(uuidstr);
xmlXPathFreeContext(ctxt);
xmlFreeDoc(doc);
return ret;
@@ -840,7 +839,7 @@ struct _libxlTunnelMigrationThread {
static void libxlTunnel3MigrationSrcFunc(void *arg)
{
libxlTunnelMigrationThread *data = (libxlTunnelMigrationThread *)arg;
- char *buffer = NULL;
+ g_autofree char *buffer = NULL;
struct pollfd fds[1];
int timeout = -1;
@@ -858,7 +857,7 @@ static void libxlTunnel3MigrationSrcFunc(void *arg)
continue;
virReportError(errno, "%s",
_("poll failed in libxlTunnel3MigrationSrcFunc"));
- goto cleanup;
+ return;
}
if (ret == 0) {
@@ -874,13 +873,13 @@ static void libxlTunnel3MigrationSrcFunc(void *arg)
/* Write to dest stream */
if (virStreamSend(data->st, buffer, nbytes) < 0) {
virStreamAbort(data->st);
- goto cleanup;
+ return;
}
} else if (nbytes < 0) {
virReportError(errno, "%s",
_("tunnelled migration failed to read from xen side"));
virStreamAbort(data->st);
- goto cleanup;
+ return;
} else {
/* EOF; transferred all data */
break;
@@ -889,10 +888,6 @@ static void libxlTunnel3MigrationSrcFunc(void *arg)
}
ignore_value(virStreamFinish(data->st));
-
- cleanup:
- VIR_FREE(buffer);
-
return;
}
diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index f852032d8a..781483f496 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -2102,29 +2102,24 @@ xenFormatCharDev(virConfPtr conf, virDomainDefPtr def,
static int
xenFormatCPUAllocation(virConfPtr conf, virDomainDefPtr def)
{
- int ret = -1;
- char *cpus = NULL;
+ g_autofree char *cpus = NULL;
if (virDomainDefGetVcpus(def) < virDomainDefGetVcpusMax(def) &&
xenConfigSetInt(conf, "maxvcpus", virDomainDefGetVcpusMax(def)) < 0)
- goto cleanup;
+ return -1;
if (xenConfigSetInt(conf, "vcpus", virDomainDefGetVcpus(def)) < 0)
- goto cleanup;
+ return -1;
if ((def->cpumask != NULL) &&
((cpus = virBitmapFormat(def->cpumask)) == NULL)) {
- goto cleanup;
+ return -1;
}
if (cpus &&
xenConfigSetString(conf, "cpus", cpus) < 0)
- goto cleanup;
+ return -1;
- ret = 0;
-
- cleanup:
- VIR_FREE(cpus);
- return ret;
+ return 0;
}
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index 494b5f3dd2..4113be8cd1 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -1373,7 +1373,7 @@ static int
xenFormatXLCPUID(virConfPtr conf, virDomainDefPtr def)
{
char **cpuid_pairs = NULL;
- char *cpuid_string = NULL;
+ g_autofree char *cpuid_string = NULL;
size_t i, j;
int ret = -1;
@@ -1431,7 +1431,6 @@ xenFormatXLCPUID(virConfPtr conf, virDomainDefPtr def)
cleanup:
g_strfreev(cpuid_pairs);
- VIR_FREE(cpuid_string);
return ret;
}
@@ -1686,7 +1685,7 @@ xenFormatXLDisk(virConfValuePtr list, virDomainDiskDefPtr disk)
virConfValuePtr val, tmp;
int format = virDomainDiskGetFormat(disk);
const char *driver = virDomainDiskGetDriver(disk);
- char *target = NULL;
+ g_autofree char *target = NULL;
int ret = -1;
/* format */
@@ -1772,7 +1771,6 @@ xenFormatXLDisk(virConfValuePtr list, virDomainDiskDefPtr disk)
ret = 0;
cleanup:
- VIR_FREE(target);
return ret;
}
--
2.29.2
3 years, 9 months
[libvirt PATCH 0/2] ci: Add helper script
by Andrea Bolognani
Andrea Bolognani (2):
ci: Remove Debian 9 special case
ci: Add helper script
ci/cirrus/refresh | 22 --------
ci/containers/refresh | 42 ---------------
ci/helper | 118 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 118 insertions(+), 64 deletions(-)
delete mode 100755 ci/cirrus/refresh
delete mode 100755 ci/containers/refresh
create mode 100755 ci/helper
--
2.26.2
3 years, 9 months
[PATCH] virsh: Add virshCodesetNameCompleter
by Kristina Hanicova
Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
virsh: Add virshCodesetNameCompleter
Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
tools/virsh-completer-domain.c | 22 ++++++++++++++++++++++
tools/virsh-completer-domain.h | 4 ++++
tools/virsh-domain.c | 1 +
3 files changed, 27 insertions(+)
diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c
index e773af6552..fc4d7b2e52 100644
--- a/tools/virsh-completer-domain.c
+++ b/tools/virsh-completer-domain.c
@@ -31,6 +31,7 @@
#include "virxml.h"
#include "virperf.h"
#include "virbitmap.h"
+#include "virkeycode.h"
char **
virshDomainNameCompleter(vshControl *ctl,
@@ -778,3 +779,24 @@ virshDomainLifecycleActionCompleter(vshControl *ctl G_GNUC_UNUSED,
return g_steal_pointer(&tmp);
}
+
+
+char **
+virshCodesetNameCompleter(vshControl *ctl G_GNUC_UNUSED,
+ const vshCmd *cmd G_GNUC_UNUSED,
+ unsigned int flags)
+{
+ g_auto(GStrv) tmp = NULL;
+ size_t i = 0;
+
+ virCheckFlags(0, NULL);
+
+ tmp = g_new0(char *, VIR_KEYCODE_SET_LAST + 1);
+
+ for (i = 0; i < VIR_KEYCODE_SET_LAST; i++) {
+ const char *name = virKeycodeSetTypeToString(i);
+ tmp[i] = g_strdup(name);
+ }
+
+ return g_steal_pointer(&tmp);
+}
diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h
index 92c57bce75..4c01b0ca1f 100644
--- a/tools/virsh-completer-domain.h
+++ b/tools/virsh-completer-domain.h
@@ -110,3 +110,7 @@ char ** virshDomainLifecycleCompleter(vshControl *ctl,
char ** virshDomainLifecycleActionCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
+
+char ** virshCodesetNameCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 1c58c26d93..d40995f44d 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -8791,6 +8791,7 @@ static const vshCmdOptDef opts_send_key[] = {
{.name = "codeset",
.type = VSH_OT_STRING,
.flags = VSH_OFLAG_REQ_OPT,
+ .completer = virshCodesetNameCompleter,
.help = N_("the codeset of keycodes, default:linux")
},
{.name = "holdtime",
--
2.29.2
3 years, 9 months
[libvirt PATCH 0/4] RFE: ci: A couple of minor improvements
by Erik Skultety
First of all, this builds on top of [1].
As I was testing some builds in local containers I noticed that when one does:
$ make -C ci ci-list-images
it will return images that we no longer support in lcitool nor in libvirt, but
one can still pull them and run a build in those. So I created a Python script
that compares the current registry with what we support in lcitool and if the=
re
images of distro we no longer support, it will flag those (see below).
Now, I wonder where the proper place to run this would be, originally I creat=
ed
for our GitLab containers and ran it during the sanity-check phase [2]. But
having it marked as a "soft" failure didn't seem correct. So I'm proposing to
run this within the context of the "refresh" script.
I also pondered whether I should go ahead and rewrite the refresh script to
Python as well (like this series does for list-images.sh), but I actually like
how straight forward the refresh script is, unlike list-images, it would not
look better in Python for sure. The 3 resulting script hierarchy isn't perfec=
t,
but I'd like to hear some comments first.
[1] https://listman.redhat.com/archives/libvir-list/2021-February/msg00636.ht=
ml
[2] https://gitlab.com/eskultety/libvirt/-/pipelines/253570058
EXAMPLE OUTPUT OF THE REGISTRY CHECKER:
The following images can be purged from the registry:
libvirt/libvirt/ci-debian-9
libvirt/libvirt/ci-debian-9-cross-aarch64
libvirt/libvirt/ci-debian-9-cross-mipsel
libvirt/libvirt/ci-debian-9-cross-armv7l
libvirt/libvirt/ci-debian-9-cross-armv6l
libvirt/libvirt/ci-debian-9-cross-mips
libvirt/libvirt/ci-debian-9-cross-ppc64le
libvirt/libvirt/ci-debian-9-cross-s390x
libvirt/libvirt/ci-debian-9-cross-mips64el
libvirt/libvirt/ci-fedora-31
libvirt/libvirt/ci-opensuse-151
You can remove the above images over the API with the following code snippet:
$ for image_id in 1154661 1154667 1154669 1154671 1154676 1154678 1154682 11=
54683 1154686 1154687 1154724 \
;do \
curl --request DELETE --header "PRIVATE-TOKEN: <access_token>" \
https://gitlab.com/api/v4/projects/192693/registry/repositories/$image_id \
;done
Erik Skultety (4):
ci: Makefile: Specify a help target to replace ci-help
ci: Rewrite list-images from Bash to Python
ci: list-images: Split some generic logic to a util module
ci: Introduce a new checker script 'check-registry.py'
ci/Makefile | 12 ++---
ci/containers/check-registry.py | 96 +++++++++++++++++++++++++++++++++
ci/containers/refresh | 5 ++
ci/containers/util.py | 25 +++++++++
ci/list-images.py | 32 +++++++++++
5 files changed, 161 insertions(+), 9 deletions(-)
create mode 100644 ci/containers/check-registry.py
create mode 100644 ci/containers/util.py
create mode 100644 ci/list-images.py
--=20
2.29.2
3 years, 9 months
[libvirt PATCH 0/3] qemu: add support for VNC power control option
by Daniel P. Berrangé
Daniel P. Berrangé (3):
conf: add support for VNC power control setting
qemu: probe for -vnc power-control option support
qemu: wire up support for VNC power control options
docs/formatdomain.rst | 5 +++++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 12 ++++++++++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 9 +++++++++
tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 +
tests/qemuxml2argvdata/graphics-vnc-policy.args | 2 +-
tests/qemuxml2argvdata/graphics-vnc-policy.xml | 2 +-
tests/qemuxml2argvtest.c | 2 +-
11 files changed, 39 insertions(+), 3 deletions(-)
--
2.29.2
3 years, 9 months
[libvirt PATCH] docs: formatdomain: fix link to memoryBacking element
by Ján Tomko
Fixes: e88bdaf789b6f1cc5347b217240f15afd86a94c1
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
Pushed as trivial.
docs/formatdomain.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index eafd6b3396..2587106191 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -2615,7 +2615,7 @@ paravirtualized driver is specified via the ``disk`` element.
``vhostuser``
Enables the hypervisor to connect to another process using vhost-user
protocol. Requires shared memory configured for the VM, for more details
- see ``access`` mode for `memoryBacking <#elementsMemoryBacking>` element.
+ see ``access`` mode for `memoryBacking <#elementsMemoryBacking>`__ element.
The ``source`` element has following mandatory attributes:
--
2.29.2
3 years, 9 months