[libvirt] [PATCH] doc nits
by Dan Kenigsberg
(sorry, these ones annoy me when they are online)
---
src/datatypes.c | 4 ++--
src/libvirt.c | 22 +++++++++++-----------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/datatypes.c b/src/datatypes.c
index 89ad309..0601a79 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -71,7 +71,7 @@ virNetworkFreeName(virNetworkPtr network, const char *name ATTRIBUTE_UNUSED)
/**
* virInterfaceFreeName:
- * @interface: a interface object
+ * @interface: an interface object
*
* Destroy the interface object, this is just used by the interface hash callback.
*
@@ -674,7 +674,7 @@ _("Failed to change interface mac address from %s to %s due to differing lengths
* virReleaseInterface:
* @interface: the interface to release
*
- * Unconditionally release all memory associated with a interface.
+ * Unconditionally release all memory associated with an interface.
* The conn.lock mutex must be held prior to calling this, and will
* be released prior to this returning. The interface obj must not
* be used once this method returns.
diff --git a/src/libvirt.c b/src/libvirt.c
index 9e87900..f7a0761 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -291,7 +291,7 @@ virInitialize(void)
#ifdef WITH_DRIVER_MODULES
/* We don't care if any of these fail, because the whole point
* is to allow users to only install modules they want to use.
- * If they try to use a open a connection for a module that
+ * If they try to use an open a connection for a module that
* is not loaded they'll get a suitable error at that point
*/
virDriverLoadModule("test");
@@ -2050,7 +2050,7 @@ error:
* virDomainResume:
* @domain: a domain object
*
- * Resume an suspended domain, the process is restarted from the state where
+ * Resume a suspended domain, the process is restarted from the state where
* it was frozen by calling virSuspendDomain().
* This function may requires privileged access
*
@@ -3999,7 +3999,7 @@ error:
*
* The path parameter is the name of the network interface.
*
- * Domains may have more than network interface. To get stats for
+ * Domains may have more than one network interface. To get stats for
* each you should make multiple calls to this function.
*
* Individual fields within the stats structure may be returned
@@ -4680,7 +4680,7 @@ error:
* @domain: pointer to domain object, or NULL for Domain0
* @info: pointer to an array of virVcpuInfo structures (OUT)
* @maxinfo: number of structures in info array
- * @cpumaps: pointer to an bit map of real CPUs for all vcpus of this
+ * @cpumaps: pointer to a bit map of real CPUs for all vcpus of this
* domain (in 8-bit bytes) (OUT)
* If cpumaps is NULL, then no cpumap information is returned by the API.
* It's assumed there is <maxinfo> cpumap in cpumaps array.
@@ -9202,7 +9202,7 @@ error:
* @xml: XML describing the secret.
* @flags: flags, use 0 for now
*
- * If XML specifies an UUID, locates the specified secret and replaces all
+ * If XML specifies a UUID, locates the specified secret and replaces all
* attributes of the secret specified by UUID by attributes specified in xml
* (any attributes not specified in xml are discarded).
*
@@ -9713,7 +9713,7 @@ virStreamRef(virStreamPtr stream)
* with the call, but may instead be delayed until a
* subsequent call.
*
- * A example using this with a hypothetical file upload
+ * An example using this with a hypothetical file upload
* API looks like
*
* virStreamPtr st = virStreamNew(conn, 0);
@@ -9805,7 +9805,7 @@ error:
* with the call, but may instead be delayed until a
* subsequent call.
*
- * A example using this with a hypothetical file download
+ * An example using this with a hypothetical file download
* API looks like
*
* virStreamPtr st = virStreamNew(conn, 0);
@@ -9896,7 +9896,7 @@ error:
* requested data source. This is simply a convenient alternative
* to virStreamSend, for apps that do blocking-I/o.
*
- * A example using this with a hypothetical file upload
+ * An example using this with a hypothetical file upload
* API looks like
*
* int mysource(virStreamPtr st, char *buf, int nbytes, void *opaque) {
@@ -9993,7 +9993,7 @@ cleanup:
* requested data sink. This is simply a convenient alternative
* to virStreamRecv, for apps that do blocking-I/o.
*
- * A example using this with a hypothetical file download
+ * An example using this with a hypothetical file download
* API looks like
*
* int mysink(virStreamPtr st, const char *buf, int nbytes, void *opaque) {
@@ -10174,7 +10174,7 @@ error:
* virStreamEventRemoveCallback:
* @stream: pointer to the stream object
*
- * Remove a event callback from the stream
+ * Remove an event callback from the stream
*
* Returns 0 on success, -1 on error
*/
@@ -10297,7 +10297,7 @@ error:
* Decrement the reference count on a stream, releasing
* the stream object if the reference count has hit zero.
*
- * There must not be a active data transfer in progress
+ * There must not be an active data transfer in progress
* when releasing the stream. If a stream needs to be
* disposed of prior to end of stream being reached, then
* the virStreamAbort function should be called first.
--
1.6.2.5
14 years, 11 months
[libvirt] RestrictedVersion Error trying to shutdown an ESX VM
by Shahar Klein
I could swear it worked before:
virsh # list
Id Name State
----------------------------------
352 ubuntu904 running
368 rh53 running
virsh # shutdown 352
error: Failed to shutdown domain 352
error: internal error HTTP response code 500. VI Fault: ServerFaultCode - fault.RestrictedVersion.summary
with LIBVIRT_DEBUG=1:
virsh # shutdown 352
10:34:50.665: debug : virDomainLookupByID:1746 : conn=0x626440, id=352
10:34:50.687: debug : virGetDomain:344 : New hash entry 0x7104d0
10:34:50.687: debug : virDomainShutdown:2331 : domain=0x7104d0
error: Failed to shutdown domain 352
10:34:50.722: debug : virDomainFree:1958 : domain=0x7104d0
10:34:50.722: debug : virUnrefDomain:421 : unref domain 0x7104d0 ubuntu904 1
10:34:50.722: debug : virReleaseDomain:375 : release domain 0x7104d0 ubuntu904
10:34:50.722: debug : virReleaseDomain:391 : unref connection 0x626440 2
error: internal error HTTP response code 500. VI Fault: ServerFaultCode - fault.RestrictedVersion.summary
14 years, 11 months
[libvirt] [PATCH] Fix problems in the Xen inotify driver.
by Matthias Bolte
In xenInotifyXendDomainsDirLookup() the wrong UUID variable is used
to search in the config info list.
In xenInotifyEvent() the event is dispatched if it's NULL.
Both were introduced in bc898df2c74fe3c8efedfbbd430737bac950e65e.
---
src/xen/xen_inotify.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index 9e0407f..aa3893a 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -142,7 +142,7 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, const char *filename,
search for, and create a domain from the stored
list info */
for (i = 0 ; i < priv->configInfoList->count ; i++) {
- if (!memcmp(uuid, priv->configInfoList->doms[i]->uuid, VIR_UUID_BUFLEN)) {
+ if (!memcmp(rawuuid, priv->configInfoList->doms[i]->uuid, VIR_UUID_BUFLEN)) {
*name = strdup(priv->configInfoList->doms[i]->name);
if (!*name) {
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
@@ -332,7 +332,7 @@ reread:
xenInotifyDomainEventFromFile(conn, fname,
VIR_DOMAIN_EVENT_UNDEFINED,
VIR_DOMAIN_EVENT_UNDEFINED_REMOVED);
- if (!event)
+ if (event)
xenUnifiedDomainEventDispatch(conn->privateData, event);
else
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
--
1.6.0.4
14 years, 11 months
[libvirt] [PATCH] Fix error message in qemudLoadDriverConfig()
by Matthias Bolte
* src/qemu/qemu_conf.c: change the error message to refer to
'cgroup_controllers' instead of 'cgroup_device_acl'
---
src/qemu/qemu_conf.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 158e9a3..a095cb7 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -243,7 +243,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
int ctl;
if (pp->type != VIR_CONF_STRING) {
- VIR_ERROR("%s", _("cgroup_device_acl must be a list of strings"));
+ VIR_ERROR("%s", _("cgroup_controllers must be a list of strings"));
virConfFree(conf);
return -1;
}
--
1.6.0.4
14 years, 11 months
[libvirt] [PATCH] Various syntax-check fixes.
by Chris Lalancette
Make a pass over the syntax-check files, tightening up regex's,
un-ignoring certain files, and cleaning things up.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
.x-sc_prohibit_VIR_ERR_NO_MEMORY | 13 +++++--------
.x-sc_prohibit_gethostby | 5 ++---
.x-sc_prohibit_strcmp_and_strncmp | 7 +++++++
.x-sc_prohibit_strncpy | 2 +-
.x-sc_require_config_h | 1 -
Makefile.am | 14 ++++++++++++--
cfg.mk | 8 +++-----
7 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/.x-sc_prohibit_VIR_ERR_NO_MEMORY b/.x-sc_prohibit_VIR_ERR_NO_MEMORY
index fbefbeb..5c96e83 100644
--- a/.x-sc_prohibit_VIR_ERR_NO_MEMORY
+++ b/.x-sc_prohibit_VIR_ERR_NO_MEMORY
@@ -1,8 +1,5 @@
-ChangeLog
-docs/devhelp/libvirt-virterror.html
-docs/html/libvirt-virterror.html
-docs/libvirt-api.xml
-docs/libvirt-refs.xml
-include/libvirt/virterror.h
-daemon/dispatch.c
-src/util/virterror.c
+^ChangeLog$
+^ChangeLog-old$
+^include/libvirt/virterror\.h$
+^daemon/dispatch\.c$
+^src/util/virterror\.c$
diff --git a/.x-sc_prohibit_gethostby b/.x-sc_prohibit_gethostby
index c771142..7c052f4 100644
--- a/.x-sc_prohibit_gethostby
+++ b/.x-sc_prohibit_gethostby
@@ -1,3 +1,2 @@
-gnulib/lib/getaddrinfo.c
-gnulib/m4/
-src/xend_internal.c
+^gnulib/lib/getaddrinfo\.c$
+^gnulib/m4/
diff --git a/.x-sc_prohibit_strcmp_and_strncmp b/.x-sc_prohibit_strcmp_and_strncmp
index b7c456e..c0d8793 100644
--- a/.x-sc_prohibit_strcmp_and_strncmp
+++ b/.x-sc_prohibit_strcmp_and_strncmp
@@ -1 +1,8 @@
^gnulib/
+^ChangeLog-old$
+^examples/domain-events/events-c/event-test\.c$
+^src/internal\.h$
+^src/lxc/lxc_container\.c$
+^src/node_device/node_device_devkit\.c$
+^src/node_device/node_device_hal\.c$
+^src/storage/parthelper\.c$
diff --git a/.x-sc_prohibit_strncpy b/.x-sc_prohibit_strncpy
index 10bc29c..70e2300 100644
--- a/.x-sc_prohibit_strncpy
+++ b/.x-sc_prohibit_strncpy
@@ -1 +1 @@
-src/util/util.c
+^src/util/util\.c$
diff --git a/.x-sc_require_config_h b/.x-sc_require_config_h
index e1f6e10..a530ae0 100644
--- a/.x-sc_require_config_h
+++ b/.x-sc_require_config_h
@@ -1,5 +1,4 @@
^examples/
^gnulib/lib/dummy\.c$
^gnulib/tests/dummy\.c$
-^daemon/remote_protocol\.c$
^ChangeLog$
diff --git a/Makefile.am b/Makefile.am
index 977ad0c..14fc593 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,12 +17,22 @@ EXTRA_DIST = \
mingw32-libvirt.spec.in \
libvirt.pc libvirt.pc.in \
autobuild.sh \
+ .x-sc_avoid_ctype_macros \
.x-sc_avoid_if_before_free \
- .x-sc_require_config_h_first \
+ .x-sc_avoid_write \
+ .x-sc_m4_quote_check \
+ .x-sc_prohibit_asprintf \
+ .x-sc_prohibit_gethostby \
+ .x-sc_prohibit_have_config_h \
+ .x-sc_prohibit_HAVE_MBRTOWC \
+ .x-sc_prohibit_nonreentrant \
.x-sc_prohibit_strcmp \
.x-sc_prohibit_strcmp_and_strncmp \
+ .x-sc_prohibit_strncpy \
+ .x-sc_prohibit_VIR_ERR_NO_MEMORY \
.x-sc_require_config_h \
- .x-sc_prohibit_nonreentrant \
+ .x-sc_require_config_h_first \
+ .x-sc_trailing_blank \
Makefile.nonreentrant \
autogen.sh \
examples/domain-events/events-python \
diff --git a/cfg.mk b/cfg.mk
index 44cfd17..c1d3864 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -79,11 +79,9 @@ sc_avoid_write:
# Use STREQ rather than comparing strcmp == 0, or != 0.
# Similarly, use STREQLEN or STRPREFIX rather than strncmp.
sc_prohibit_strcmp_and_strncmp:
- @grep -nE '! *strn?cmp *\(|\<strn?cmp *\([^)]+\) *==' \
- $$($(VC_LIST_EXCEPT)) \
- | grep -vE ':# *define STREQ(LEN)?\(' && \
- { echo '$(ME): use STREQ(LEN) in place of the above uses of strcmp(strncmp)' \
- 1>&2; exit 1; } || :
+ @re='strn?cmp *\(' \
+ msg='use STREQ() in place of the above uses of str[n]cmp' \
+ $(_prohibit_regexp)
# Use virAsprintf rather than a'sprintf since *strp is undefined on error.
sc_prohibit_asprintf:
--
1.6.0.6
14 years, 11 months
[libvirt] [PATCH] Tighten up nonreentrant syntax-check.
by Chris Lalancette
We can slightly tighten up the regex's used to detect the use of
nonreentrant functions. We can also check src/util/virterror.c
by modifying a comment; I think it's worth it to get the additional
coverage.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
.x-sc_prohibit_nonreentrant | 8 ++++----
src/util/virterror.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/.x-sc_prohibit_nonreentrant b/.x-sc_prohibit_nonreentrant
index ac783c0..0ab2f5d 100644
--- a/.x-sc_prohibit_nonreentrant
+++ b/.x-sc_prohibit_nonreentrant
@@ -1,10 +1,10 @@
^gnulib/
^po/
-ChangeLog
+^ChangeLog$
+^ChangeLog-old$
^Makefile*
^docs/
^tests/
-^tools/virsh\.c
-^tools/console\.c
-^src/util/virterror\.c
+^tools/virsh\.c$
+^tools/console\.c$
^build-aux/
diff --git a/src/util/virterror.c b/src/util/virterror.c
index e421ab7..657cb3f 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -1157,7 +1157,7 @@ const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen)
return errBuf;
# endif
#else
- /* Mingw lacks strerror_r() and its strerror() is definitely not
+ /* Mingw lacks strerror_r and its strerror is definitely not
* threadsafe, so safest option is to just print the raw errno
* value - we can at least reliably & safely look it up in the
* header files for debug purposes
--
1.6.0.6
14 years, 11 months
[libvirt] [PATCH] Replace two strcmp() by STREQ() in qemu_driver.c
by Chris Lalancette
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/qemu/qemu_driver.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4cd235d..da7dda7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4142,7 +4142,7 @@ qemudCanonicalizeMachineFromInfo(virDomainDefPtr def,
if (!machine->canonical)
continue;
- if (strcmp(def->os.machine, machine->name) != 0)
+ if (STRNEQ(def->os.machine, machine->name))
continue;
if (!(*canonical = strdup(machine->canonical))) {
@@ -4171,7 +4171,7 @@ qemudCanonicalizeMachineDirect(virDomainDefPtr def, char **canonical)
if (!machines[i]->canonical)
continue;
- if (strcmp(def->os.machine, machines[i]->name) != 0)
+ if (STRNEQ(def->os.machine, machines[i]->name))
continue;
*canonical = machines[i]->canonical;
--
1.6.0.6
14 years, 11 months
[libvirt] [PATCH] Replace gethostname by virGetHostname in xend_internal.c
by Chris Lalancette
---
src/xen/xend_internal.c | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 27d215e..d3ab019 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -4342,21 +4342,12 @@ xenDaemonDomainMigratePrepare (virConnectPtr dconn,
const char *dname ATTRIBUTE_UNUSED,
unsigned long resource ATTRIBUTE_UNUSED)
{
- int r;
- char hostname [HOST_NAME_MAX+1];
-
/* If uri_in is NULL, get the current hostname as a best guess
* of how the source host should connect to us. Note that caller
* deallocates this string.
*/
if (uri_in == NULL) {
- r = gethostname (hostname, HOST_NAME_MAX+1);
- if (r == -1) {
- virReportSystemError(dconn, errno,
- _("unable to resolve name %s"), hostname);
- return -1;
- }
- *uri_out = strdup (hostname);
+ *uri_out = virGetHostname();
if (*uri_out == NULL) {
virReportOOMError(dconn);
return -1;
--
1.6.0.6
14 years, 11 months
[libvirt] [PATCH] Replace a gethostname by virGetHostname in libvirtd.c
by Chris Lalancette
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
daemon/libvirtd.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 4eb33bc..02bd287 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -937,15 +937,19 @@ static struct qemud_server *qemudNetworkInit(struct qemud_server *server) {
server->mdns = libvirtd_mdns_new();
if (!mdns_name) {
- char groupname[64], localhost[HOST_NAME_MAX+1], *tmp;
+ char groupname[64], *localhost, *tmp;
/* Extract the host part of the potentially FQDN */
- gethostname(localhost, HOST_NAME_MAX);
- localhost[HOST_NAME_MAX] = '\0';
+ localhost = virGetHostname();
+ if (localhost == NULL) {
+ virReportOOMError(NULL);
+ goto cleanup;
+ }
if ((tmp = strchr(localhost, '.')))
*tmp = '\0';
snprintf(groupname, sizeof(groupname)-1, "Virtualization Host %s", localhost);
groupname[sizeof(groupname)-1] = '\0';
group = libvirtd_mdns_add_group(server->mdns, groupname);
+ VIR_FREE(localhost);
} else {
group = libvirtd_mdns_add_group(server->mdns, mdns_name);
}
--
1.6.0.6
14 years, 11 months
[libvirt] [PATCH] Remove a completely bogus reference increment in the Xen driver.
by Chris Lalancette
xenUnifiedDomainEventRegister() calls out to
virDomainEventCallbackListAdd(), which increments the reference
count on the connection. That is fine, but then
xenUnifiedDomainEventRegister() increments the usage count again,
leading to a usage count leak. Remove the increment in the xen
register, and the UnrefConnect in the xen unregister.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/xen/xen_driver.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 5273a11..f2744b0 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1502,9 +1502,6 @@ xenUnifiedDomainEventRegister (virConnectPtr conn,
ret = virDomainEventCallbackListAdd(conn, priv->domainEventCallbacks,
callback, opaque, freefunc);
- if (ret == 0)
- conn->refs++;
-
xenUnifiedUnlock(priv);
return (ret);
}
@@ -1530,9 +1527,6 @@ xenUnifiedDomainEventDeregister (virConnectPtr conn,
ret = virDomainEventCallbackListRemove(conn, priv->domainEventCallbacks,
callback);
- if (ret == 0)
- virUnrefConnect(conn);
-
xenUnifiedUnlock(priv);
return ret;
}
--
1.6.0.6
14 years, 11 months