[libvirt] [libvirt-sandbox PATCH 2/2] Debug is '-d' not '-D'
by Guido Günther
---
bin/virt-sandbox.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bin/virt-sandbox.c b/bin/virt-sandbox.c
index 00b2a29..b3b5166 100644
--- a/bin/virt-sandbox.c
+++ b/bin/virt-sandbox.c
@@ -300,7 +300,7 @@ Display the version number and exit
Display verbose progress information
-=item B<-D>, B<--debug>
+=item B<-d>, B<--debug>
Display debugging information
--
1.7.9.1
12 years, 10 months
[libvirt] [PATCH] Fixed URI parsing
by Martin Kletzander
Function xmlParseURI does not remove square brackets around IPv6
address when parsing. One of the solutions is making wrappers around
functions working with xmlURI*. This assures that uri->server will be
always properly assigned and it doesn't have to be changed when used
on some new place in the code.
For this purpose, functions virParseURI and virSaveURI were
added. These function are wrappers around xmlParseURI and xmlSaveUri
respectively.
Also there is one new syntax check function to prohibit these functions
anywhere else.
File changes:
- src/util/viruri.h -- declaration
- src/util/viruri.c -- definition
- src/libvirt_private.syms -- symbol export
- src/Makefile.am -- added source and header files
- cfg.mk -- added sc_prohibit_xmlURI
- all others -- ID name and include fixes
---
v4:
- fixed NULL pointer dereference
- fixed minor typo
- copyright added to header
v3:
- wrappers moved to new files
- syntax check added
- virAsprintf used instead of nasty memory mechanics
v2:
- added virSaveURI for building back the original string
cfg.mk | 8 ++++
src/Makefile.am | 3 +-
src/datatypes.h | 2 +-
src/driver.h | 2 +-
src/esx/esx_driver.c | 5 +-
src/esx/esx_util.c | 2 +-
src/esx/esx_util.h | 4 +-
src/hyperv/hyperv_util.c | 2 +-
src/hyperv/hyperv_util.h | 5 +-
src/libvirt.c | 10 ++--
src/libvirt_private.syms | 5 ++
src/libxl/libxl_driver.c | 3 +-
src/lxc/lxc_driver.c | 3 +-
src/openvz/openvz_driver.c | 3 +-
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_migration.c | 7 ++-
src/remote/remote_driver.c | 9 ++--
src/uml/uml_driver.c | 3 +-
src/util/qparams.c | 3 +-
src/util/viruri.c | 93 ++++++++++++++++++++++++++++++++++++++++++++
src/util/viruri.h | 22 ++++++++++
src/vbox/vbox_tmpl.c | 3 +-
src/vmx/vmx.c | 6 +-
src/xen/xen_driver.c | 4 +-
src/xen/xen_hypervisor.h | 3 +-
src/xen/xend_internal.c | 4 +-
src/xen/xend_internal.h | 2 +-
src/xenapi/xenapi_driver.c | 2 +-
src/xenapi/xenapi_utils.c | 4 +-
src/xenapi/xenapi_utils.h | 4 +-
30 files changed, 180 insertions(+), 48 deletions(-)
create mode 100644 src/util/viruri.c
create mode 100644 src/util/viruri.h
diff --git a/cfg.mk b/cfg.mk
index dcf44bb..9759d87 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -457,6 +457,12 @@ sc_prohibit_xmlGetProp:
halt='use virXMLPropString, not xmlGetProp' \
$(_sc_search_regexp)
+# xml(ParseURI|SaveUri) doesn't handle IPv6 URIs well
+sc_prohibit_xmlURI:
+ @prohibit='\<xml(ParseURI|SaveUri) *\(' \
+ halt='use virURI(Parse|Format), not xml(ParseURI|SaveUri)' \
+ $(_sc_search_regexp)
+
# ATTRIBUTE_UNUSED should only be applied in implementations, not
# header declarations
sc_avoid_attribute_unused_in_header:
@@ -758,6 +764,8 @@ exclude_file_name_regexp--sc_prohibit_strncpy = \
exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/xml\.c$$
+exclude_file_name_regexp--sc_prohibit_xmlURI = ^src/util/viruri\.c$$
+
exclude_file_name_regexp--sc_require_config_h = ^examples/
exclude_file_name_regexp--sc_require_config_h_first = ^examples/
diff --git a/src/Makefile.am b/src/Makefile.am
index d5f52a0..e2542b1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -104,7 +104,8 @@ UTIL_SOURCES = \
util/virnetlink.c util/virnetlink.h \
util/virrandom.h util/virrandom.c \
util/virsocketaddr.h util/virsocketaddr.c \
- util/virtime.h util/virtime.c
+ util/virtime.h util/virtime.c \
+ util/viruri.h util/viruri.c
EXTRA_DIST += $(srcdir)/util/virkeymaps.h $(srcdir)/util/keymaps.csv \
$(srcdir)/util/virkeycode-mapgen.py
diff --git a/src/datatypes.h b/src/datatypes.h
index 47058ed..fc284d2 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -151,7 +151,7 @@ struct _virConnect {
*/
unsigned int magic; /* specific value to check */
unsigned int flags; /* a set of connection flags */
- xmlURIPtr uri; /* connection URI */
+ virURIPtr uri; /* connection URI */
/* The underlying hypervisor driver and network driver. */
virDriverPtr driver;
diff --git a/src/driver.h b/src/driver.h
index d27fa99..b04b254 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -9,9 +9,9 @@
# include "config.h"
# include <unistd.h>
-# include <libxml/uri.h>
# include "internal.h"
+# include "viruri.h"
/*
* List of registered drivers numbers
*/
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index f5e1cc7..b6b22f8 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -44,6 +44,7 @@
#include "esx_vi.h"
#include "esx_vi_methods.h"
#include "esx_util.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_ESX
@@ -3945,7 +3946,7 @@ esxDomainMigratePerform(virDomainPtr domain,
{
int result = -1;
esxPrivate *priv = domain->conn->privateData;
- xmlURIPtr parsedUri = NULL;
+ virURIPtr parsedUri = NULL;
char *saveptr;
char *path_resourcePool;
char *path_hostSystem;
@@ -3976,7 +3977,7 @@ esxDomainMigratePerform(virDomainPtr domain,
}
/* Parse migration URI */
- parsedUri = xmlParseURI(uri);
+ parsedUri = virURIParse(uri);
if (parsedUri == NULL) {
virReportOOMError();
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 2c5ac1a..7d4b908 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -42,7 +42,7 @@
int
-esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, xmlURIPtr uri)
+esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
{
int result = -1;
struct qparam_set *queryParamSet = NULL;
diff --git a/src/esx/esx_util.h b/src/esx/esx_util.h
index 2bee510..a69b3f4 100644
--- a/src/esx/esx_util.h
+++ b/src/esx/esx_util.h
@@ -22,9 +22,9 @@
#ifndef __ESX_UTIL_H__
# define __ESX_UTIL_H__
-# include <libxml/uri.h>
# include <netdb.h>
# include "internal.h"
+# include "viruri.h"
typedef struct _esxUtil_ParsedUri esxUtil_ParsedUri;
@@ -40,7 +40,7 @@ struct _esxUtil_ParsedUri {
char *path;
};
-int esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, xmlURIPtr uri);
+int esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri);
void esxUtil_FreeParsedUri(esxUtil_ParsedUri **parsedUri);
diff --git a/src/hyperv/hyperv_util.c b/src/hyperv/hyperv_util.c
index 298cfe0..2e6a2d4 100644
--- a/src/hyperv/hyperv_util.c
+++ b/src/hyperv/hyperv_util.c
@@ -37,7 +37,7 @@
int
-hypervParseUri(hypervParsedUri **parsedUri, xmlURIPtr uri)
+hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri)
{
int result = -1;
struct qparam_set *queryParamSet = NULL;
diff --git a/src/hyperv/hyperv_util.h b/src/hyperv/hyperv_util.h
index 9057f55..d9d1c84 100644
--- a/src/hyperv/hyperv_util.h
+++ b/src/hyperv/hyperv_util.h
@@ -23,9 +23,8 @@
#ifndef __HYPERV_UTIL_H__
# define __HYPERV_UTIL_H__
-# include <libxml/uri.h>
-
# include "internal.h"
+# include "viruri.h"
typedef struct _hypervParsedUri hypervParsedUri;
@@ -33,7 +32,7 @@ struct _hypervParsedUri {
char *transport;
};
-int hypervParseUri(hypervParsedUri **parsedUri, xmlURIPtr uri);
+int hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri);
void hypervFreeParsedUri(hypervParsedUri **parsedUri);
diff --git a/src/libvirt.c b/src/libvirt.c
index 6294196..3eca512 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -23,7 +23,6 @@
#include <libxml/parser.h>
#include <libxml/xpath.h>
-#include <libxml/uri.h>
#include "getpass.h"
#ifdef HAVE_WINSOCK2_H
@@ -44,6 +43,7 @@
#include "command.h"
#include "virnodesuspend.h"
#include "virrandom.h"
+#include "viruri.h"
#ifndef WITH_DRIVER_MODULES
# ifdef WITH_TEST
@@ -1127,7 +1127,7 @@ do_open (const char *name,
virConnectOpenResolveURIAlias(name, &alias) < 0)
goto failed;
- ret->uri = xmlParseURI (alias ? alias : name);
+ ret->uri = virURIParse (alias ? alias : name);
if (!ret->uri) {
virLibConnError(VIR_ERR_INVALID_ARG,
_("could not parse connection URI %s"),
@@ -1729,7 +1729,7 @@ virConnectGetURI (virConnectPtr conn)
return NULL;
}
- name = (char *)xmlSaveUri(conn->uri);
+ name = (char *)virURIFormat(conn->uri);
if (!name) {
virReportOOMError();
goto error;
@@ -4952,7 +4952,7 @@ virDomainMigratePeer2Peer (virDomainPtr domain,
const char *uri,
unsigned long bandwidth)
{
- xmlURIPtr tempuri = NULL;
+ virURIPtr tempuri = NULL;
VIR_DOMAIN_DEBUG(domain, "xmlin=%s, flags=%lx, dname=%s, "
"dconnuri=%s, uri=%s, bandwidth=%lu",
NULLSTR(xmlin), flags, NULLSTR(dname),
@@ -4964,7 +4964,7 @@ virDomainMigratePeer2Peer (virDomainPtr domain,
return -1;
}
- tempuri = xmlParseURI(dconnuri);
+ tempuri = virURIParse(dconnuri);
if (!tempuri) {
virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
virDispatchError(domain->conn);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 9e3573f..047231f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1430,6 +1430,11 @@ virTypedParameterArrayValidate;
virTypedParameterAssign;
+# viruri.h
+virURIFormat;
+virURIParse;
+
+
# xml.h
virXMLChildElementCount;
virXMLParseHelper;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 6cfc5eb..6db33c2 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -44,6 +44,7 @@
#include "libxl_conf.h"
#include "xen_xm.h"
#include "virtypedparam.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_LIBXL
@@ -1043,7 +1044,7 @@ libxlOpen(virConnectPtr conn,
if (libxl_driver == NULL)
return VIR_DRV_OPEN_DECLINED;
- conn->uri = xmlParseURI("xen:///");
+ conn->uri = virURIParse("xen:///");
if (!conn->uri) {
virReportOOMError();
return VIR_DRV_OPEN_ERROR;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index b6962cf7..d77afcc 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -60,6 +60,7 @@
#include "virnodesuspend.h"
#include "virtime.h"
#include "virtypedparam.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_LXC
@@ -139,7 +140,7 @@ static virDrvOpenStatus lxcOpen(virConnectPtr conn,
if (lxc_driver == NULL)
return VIR_DRV_OPEN_DECLINED;
- conn->uri = xmlParseURI("lxc:///");
+ conn->uri = virURIParse("lxc:///");
if (!conn->uri) {
virReportOOMError();
return VIR_DRV_OPEN_ERROR;
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 833a98d..aef1491 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -56,6 +56,7 @@
#include "virfile.h"
#include "logging.h"
#include "command.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_OPENVZ
@@ -1335,7 +1336,7 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
if (access("/proc/vz", W_OK) < 0)
return VIR_DRV_OPEN_DECLINED;
- conn->uri = xmlParseURI("openvz:///system");
+ conn->uri = virURIParse("openvz:///system");
if (conn->uri == NULL) {
virReportOOMError();
return VIR_DRV_OPEN_ERROR;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 717bdf1..c5c7afc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -857,7 +857,7 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn,
if (qemu_driver == NULL)
return VIR_DRV_OPEN_DECLINED;
- conn->uri = xmlParseURI(qemu_driver->privileged ?
+ conn->uri = virURIParse(qemu_driver->privileged ?
"qemu:///system" :
"qemu:///session");
if (!conn->uri) {
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index f0af494..cf64981 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -45,6 +45,7 @@
#include "virtime.h"
#include "locking/domain_lock.h"
#include "rpc/virnetsocket.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
@@ -1759,7 +1760,7 @@ static int doNativeMigrate(struct qemud_driver *driver,
virConnectPtr dconn)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- xmlURIPtr uribits = NULL;
+ virURIPtr uribits = NULL;
int ret = -1;
qemuMigrationSpec spec;
@@ -1775,10 +1776,10 @@ static int doNativeMigrate(struct qemud_driver *driver,
virReportOOMError();
return -1;
}
- uribits = xmlParseURI(tmp);
+ uribits = virURIParse(tmp);
VIR_FREE(tmp);
} else {
- uribits = xmlParseURI(uri);
+ uribits = virURIParse(uri);
}
if (!uribits) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 2dacb70..8fb46e1 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -26,8 +26,6 @@
#include <unistd.h>
#include <assert.h>
-#include <libxml/uri.h>
-
#include "virnetclient.h"
#include "virnetclientprogram.h"
#include "virnetclientstream.h"
@@ -47,6 +45,7 @@
#include "command.h"
#include "intprops.h"
#include "virtypedparam.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_REMOTE
@@ -488,7 +487,7 @@ doRemoteOpen (virConnectPtr conn,
/* Allow remote serve to probe */
name = strdup("");
} else {
- xmlURI tmpuri = {
+ virURI tmpuri = {
.scheme = conn->uri->scheme,
#ifdef HAVE_XMLURI_QUERY_RAW
.query_raw = qparam_get_query (vars),
@@ -505,7 +504,7 @@ doRemoteOpen (virConnectPtr conn,
transport_str[-1] = '\0';
}
- name = (char *) xmlSaveUri (&tmpuri);
+ name = (char *) virURIFormat (&tmpuri);
#ifdef HAVE_XMLURI_QUERY_RAW
VIR_FREE(tmpuri.query_raw);
@@ -719,7 +718,7 @@ doRemoteOpen (virConnectPtr conn,
goto failed;
VIR_DEBUG("Auto-probed URI is %s", uriret.uri);
- conn->uri = xmlParseURI(uriret.uri);
+ conn->uri = virURIParse(uriret.uri);
VIR_FREE(uriret.uri);
if (!conn->uri) {
virReportOOMError();
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index a4cf945..cbb2c0e 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -63,6 +63,7 @@
#include "configmake.h"
#include "virnetdevtap.h"
#include "virnodesuspend.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_UML
@@ -1138,7 +1139,7 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn,
if (uml_driver == NULL)
return VIR_DRV_OPEN_DECLINED;
- conn->uri = xmlParseURI(uml_driver->privileged ?
+ conn->uri = virURIParse(uml_driver->privileged ?
"uml:///system" :
"uml:///session");
if (!conn->uri) {
diff --git a/src/util/qparams.c b/src/util/qparams.c
index f6d0713..83b568e 100644
--- a/src/util/qparams.c
+++ b/src/util/qparams.c
@@ -26,12 +26,11 @@
#include <stdlib.h>
#include <stdarg.h>
-#include <libxml/uri.h>
-
#include "virterror_internal.h"
#include "buf.h"
#include "memory.h"
#include "qparams.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/viruri.c b/src/util/viruri.c
new file mode 100644
index 0000000..0cbfc5a
--- /dev/null
+++ b/src/util/viruri.c
@@ -0,0 +1,93 @@
+/*
+ * viruri.c: URI parsing wrappers for libxml2 functions
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * See COPYING.LIB for the License of this software
+ */
+
+#include <config.h>
+
+#include "viruri.h"
+
+#include "memory.h"
+#include "util.h"
+
+/**
+ * virURIParse:
+ * @uri: URI to parse
+ *
+ * Wrapper for xmlParseURI
+ *
+ * Unfortunately there are few things that should be managed after
+ * parsing the URI. Fortunately there is only one thing now and its
+ * removing of square brackets around IPv6 addresses.
+ *
+ * @returns the parsed uri object with some fixes
+ */
+xmlURIPtr
+virURIParse(const char *uri)
+{
+ xmlURIPtr ret = xmlParseURI(uri);
+
+ /* First check: does it even make sense to jump inside */
+ if (ret != NULL &&
+ ret->server != NULL &&
+ ret->server[0] == '[') {
+ size_t length = strlen(ret->server);
+
+ /* We want to modify the server string only if there are
+ * square brackets on both ends and inside there is IPv6
+ * address. Otherwise we could make a mistake by modifying
+ * something other than an IPv6 address. */
+ if (ret->server[length - 1] == ']' && strchr(ret->server, ':')) {
+ memmove(&ret->server[0], &ret->server[1], length - 2);
+ ret->server[length - 2] = '\0';
+ }
+ /* Even after such modification, it is completely ok to free
+ * the uri with xmlFreeURI() */
+ }
+
+ return ret;
+}
+
+/**
+ * virURIFormat:
+ * @uri: URI to format
+ *
+ * Wrapper for xmlSaveUri
+ *
+ * This function constructs back everything that @ref virURIParse
+ * changes after parsing
+ *
+ * @returns the constructed uri as a string
+ */
+unsigned char *
+virURIFormat(xmlURIPtr uri)
+{
+ char *backupserver = NULL;
+ char *tmpserver = NULL;
+ unsigned char *ret;
+
+ /* First check: does it make sense to do anything */
+ if (uri != NULL &&
+ uri->server != NULL &&
+ strchr(uri->server, ':') != NULL) {
+
+ backupserver = uri->server;
+ if (virAsprintf(&tmpserver, "[%s]", uri->server) < 0)
+ return NULL;
+
+ uri->server = tmpserver;
+ }
+
+ ret = xmlSaveUri(uri);
+
+ /* Put the fixed version back */
+ if (tmpserver) {
+ uri->server = backupserver;
+ VIR_FREE(tmpserver);
+ }
+
+ return ret;
+}
diff --git a/src/util/viruri.h b/src/util/viruri.h
new file mode 100644
index 0000000..b2b0ca8
--- /dev/null
+++ b/src/util/viruri.h
@@ -0,0 +1,22 @@
+/*
+ * viruri.h: internal definitions used for URI parsing.
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * See COPYING.LIB for the License of this software
+ */
+
+#ifndef __VIR_URI_H__
+# define __VIR_URI_H__
+
+# include <libxml/uri.h>
+
+# include "internal.h"
+
+typedef xmlURI virURI;
+typedef xmlURIPtr virURIPtr;
+
+virURIPtr virURIParse(const char *uri);
+unsigned char * virURIFormat(virURIPtr uri);
+
+#endif /* __VIR_URI_H__ */
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index b168c7d..a39b567 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -56,6 +56,7 @@
#include "configmake.h"
#include "virfile.h"
#include "fdstream.h"
+#include "viruri.h"
/* This one changes from version to version. */
#if VBOX_API_VERSION == 2002
@@ -980,7 +981,7 @@ static virDrvOpenStatus vboxOpen(virConnectPtr conn,
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
if (conn->uri == NULL) {
- conn->uri = xmlParseURI(uid ? "vbox:///session" : "vbox:///system");
+ conn->uri = virURIParse(uid ? "vbox:///session" : "vbox:///system");
if (conn->uri == NULL) {
virReportOOMError();
return VIR_DRV_OPEN_ERROR;
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 823d5df..9c83de4 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -24,7 +24,6 @@
#include <config.h>
#include <c-ctype.h>
-#include <libxml/uri.h>
#include "internal.h"
#include "virterror_internal.h"
@@ -33,6 +32,7 @@
#include "logging.h"
#include "uuid.h"
#include "vmx.h"
+#include "viruri.h"
/*
@@ -2518,7 +2518,7 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
char network_endPoint_name[48] = "";
char *network_endPoint = NULL;
- xmlURIPtr parsedUri = NULL;
+ virURIPtr parsedUri = NULL;
if (def == NULL || *def != NULL) {
VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
@@ -2608,7 +2608,7 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
(*def)->target.port = port;
(*def)->source.type = VIR_DOMAIN_CHR_TYPE_TCP;
- parsedUri = xmlParseURI(fileName);
+ parsedUri = virURIParse(fileName);
if (parsedUri == NULL) {
virReportOOMError();
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 635f468..19ce7da 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -26,7 +26,6 @@
#include <sys/types.h>
#include <fcntl.h>
#include <xen/dom0_ops.h>
-#include <libxml/uri.h>
#include "virterror_internal.h"
#include "logging.h"
@@ -50,6 +49,7 @@
#include "uuid.h"
#include "fdstream.h"
#include "virfile.h"
+#include "viruri.h"
#include "command.h"
#include "virnodesuspend.h"
@@ -270,7 +270,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
if (!xenUnifiedProbe())
return VIR_DRV_OPEN_DECLINED;
- conn->uri = xmlParseURI("xen:///");
+ conn->uri = virURIParse("xen:///");
if (!conn->uri) {
virReportOOMError();
return VIR_DRV_OPEN_ERROR;
diff --git a/src/xen/xen_hypervisor.h b/src/xen/xen_hypervisor.h
index 77c6f74..55a99f1 100644
--- a/src/xen/xen_hypervisor.h
+++ b/src/xen/xen_hypervisor.h
@@ -11,11 +11,10 @@
#ifndef __VIR_XEN_INTERNAL_H__
# define __VIR_XEN_INTERNAL_H__
-# include <libxml/uri.h>
-
# include "internal.h"
# include "capabilities.h"
# include "driver.h"
+# include "viruri.h"
/* See xenHypervisorInit() for details. */
struct xenHypervisorVersions {
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 5c3838f..83bfac0 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -27,7 +27,6 @@
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
-#include <libxml/uri.h>
#include <errno.h>
#include "virterror_internal.h"
@@ -46,6 +45,7 @@
#include "memory.h"
#include "count-one-bits.h"
#include "virfile.h"
+#include "viruri.h"
/* required for cpumap_t */
#include <xen/dom0_ops.h>
@@ -3224,7 +3224,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
* "hostname", "hostname:port" or "xenmigr://hostname[:port]/".
*/
if (strstr (uri, "//")) { /* Full URI. */
- xmlURIPtr uriptr = xmlParseURI (uri);
+ virURIPtr uriptr = virURIParse (uri);
if (!uriptr) {
virXendError(VIR_ERR_INVALID_ARG,
"%s", _("xenDaemonDomainMigrate: invalid URI"));
diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
index eee67b5..3f0b63d 100644
--- a/src/xen/xend_internal.h
+++ b/src/xen/xend_internal.h
@@ -18,13 +18,13 @@
# include <sys/types.h>
# include <stdint.h>
-# include <libxml/uri.h>
# include "internal.h"
# include "capabilities.h"
# include "domain_conf.h"
# include "driver.h"
# include "buf.h"
+# include "viruri.h"
int
xenDaemonOpen_unix(virConnectPtr conn, const char *path);
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index f877f67..94644ae 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -25,7 +25,6 @@
#include <limits.h>
#include <stdint.h>
#include <string.h>
-#include <libxml/uri.h>
#include <curl/curl.h>
#include <xen/api/xen_all.h>
#include "internal.h"
@@ -37,6 +36,7 @@
#include "uuid.h"
#include "memory.h"
#include "buf.h"
+#include "viruri.h"
#include "xenapi_driver.h"
#include "xenapi_driver_private.h"
#include "xenapi_utils.h"
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index ddc7736..943b6c0 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -25,7 +25,6 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
-#include <libxml/uri.h>
#include <xen/api/xen_all.h>
#include "internal.h"
#include "domain_conf.h"
@@ -37,6 +36,7 @@
#include "buf.h"
#include "logging.h"
#include "qparams.h"
+#include "viruri.h"
#include "xenapi_driver_private.h"
#include "xenapi_utils.h"
@@ -94,7 +94,7 @@ xenapiUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
}
int
-xenapiUtil_ParseQuery(virConnectPtr conn, xmlURIPtr uri, int *noVerify)
+xenapiUtil_ParseQuery(virConnectPtr conn, virURIPtr uri, int *noVerify)
{
int result = 0;
int i;
diff --git a/src/xenapi/xenapi_utils.h b/src/xenapi/xenapi_utils.h
index 40506d5..aa1ff74 100644
--- a/src/xenapi/xenapi_utils.h
+++ b/src/xenapi/xenapi_utils.h
@@ -23,9 +23,9 @@
# define __VIR_XENAPI_UTILS__
# include <stdint.h>
-# include <libxml/uri.h>
# include <xen/api/xen_all.h>
# include "internal.h"
+# include "viruri.h"
# include "domain_conf.h"
# define NETWORK_DEVID_SIZE (12)
@@ -40,7 +40,7 @@ xenapiUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
const char *hostname);
int
-xenapiUtil_ParseQuery(virConnectPtr conn, xmlURIPtr uri, int *noVerify);
+xenapiUtil_ParseQuery(virConnectPtr conn, virURIPtr uri, int *noVerify);
enum xen_on_normal_exit
actionShutdownLibvirt2XenapiEnum(enum virDomainLifecycleAction action);
--
1.7.3.4
12 years, 10 months
[libvirt] [PATCH] Fixed service handling in specfile
by Martin Kletzander
After adding the libvirt-guests service into usual runlevels, we used
to start the libvirt-guests service. However this is usually not a
good practice. As mentioned on fedoraproject wiki, the installations
can be in changeroots, in an installer context, or in other situations
where we don't want the services autostarted.
---
libvirt.spec.in | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 67cde23..072fd8e 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1027,14 +1027,6 @@ fi
%if %{with_systemd}
%else
/sbin/chkconfig --add libvirt-guests
-if [ $1 -ge 1 ]; then
- level=$(/sbin/runlevel | /bin/cut -d ' ' -f 2)
- if /sbin/chkconfig --levels $level libvirt-guests; then
- # this doesn't do anything but allowing for libvirt-guests to be
- # stopped on the first shutdown
- /sbin/service libvirt-guests start > /dev/null 2>&1 || true
- fi
-fi
%endif
%postun client -p /sbin/ldconfig
--
1.7.3.4
12 years, 10 months
[libvirt] Correct a check for capacity arg of storageVolumeResize()
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
---
src/storage/storage_driver.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index df0e291..641944d 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1758,7 +1758,7 @@ storageVolumeResize(virStorageVolPtr obj,
goto out;
}
- if (abs_capacity > vol->allocation + pool->def->available) {
+ if (abs_capacity > vol->capacity + pool->def->available) {
virStorageReportError(VIR_ERR_INVALID_ARG,
_("Not enough space left on storage pool"));
goto out;
--
1.7.7.6
12 years, 10 months
[libvirt] [PATCH v3] Fixed URI parsing
by Martin Kletzander
Function xmlParseURI does not remove square brackets around IPv6
address when parsing. One of the solutions is making wrappers around
functions working with xmlURI*. This assures that uri->server will be
always properly assigned and it doesn't have to be changed when used
on some new place in the code.
For this purpose, functions virParseURI and virSaveURI were
added. These function are wrappers around xmlParseURI and xmlSaveUri
respectively.
Also there is one new syntax check function to prohibit these functions
anywhere else.
File changes:
- src/util/viruri.h -- declaration
- src/util/viruri.c -- definition
- src/libvirt_private.syms -- symbol export
- src/Makefile.am -- added source and header files
- cfg.mk -- added sc_prohibit_xmlURI
- all others -- ID name and include fixes
---
v3:
- wrappers moved to new files
- syntax check added
- virAsprintf used instead of nasty memory mechanics
v2:
- added virSaveURI for building back the original string
cfg.mk | 8 ++++
src/Makefile.am | 3 +-
src/datatypes.h | 2 +-
src/driver.h | 2 +-
src/esx/esx_driver.c | 5 +-
src/esx/esx_util.c | 2 +-
src/esx/esx_util.h | 4 +-
src/hyperv/hyperv_util.c | 2 +-
src/hyperv/hyperv_util.h | 5 +-
src/libvirt.c | 10 ++--
src/libvirt_private.syms | 5 ++
src/libxl/libxl_driver.c | 3 +-
src/lxc/lxc_driver.c | 3 +-
src/openvz/openvz_driver.c | 3 +-
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_migration.c | 7 ++-
src/remote/remote_driver.c | 9 ++--
src/uml/uml_driver.c | 3 +-
src/util/qparams.c | 3 +-
src/util/viruri.c | 91 ++++++++++++++++++++++++++++++++++++++++++++
src/util/viruri.h | 18 +++++++++
src/vbox/vbox_tmpl.c | 3 +-
src/vmx/vmx.c | 6 +-
src/xen/xen_driver.c | 4 +-
src/xen/xen_hypervisor.h | 3 +-
src/xen/xend_internal.c | 4 +-
src/xen/xend_internal.h | 2 +-
src/xenapi/xenapi_driver.c | 2 +-
src/xenapi/xenapi_utils.c | 4 +-
src/xenapi/xenapi_utils.h | 4 +-
30 files changed, 174 insertions(+), 48 deletions(-)
create mode 100644 src/util/viruri.c
create mode 100644 src/util/viruri.h
diff --git a/cfg.mk b/cfg.mk
index dcf44bb..9759d87 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -457,6 +457,12 @@ sc_prohibit_xmlGetProp:
halt='use virXMLPropString, not xmlGetProp' \
$(_sc_search_regexp)
+# xml(ParseURI|SaveUri) doesn't handle IPv6 URIs well
+sc_prohibit_xmlURI:
+ @prohibit='\<xml(ParseURI|SaveUri) *\(' \
+ halt='use virURI(Parse|Format), not xml(ParseURI|SaveUri)' \
+ $(_sc_search_regexp)
+
# ATTRIBUTE_UNUSED should only be applied in implementations, not
# header declarations
sc_avoid_attribute_unused_in_header:
@@ -758,6 +764,8 @@ exclude_file_name_regexp--sc_prohibit_strncpy = \
exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/xml\.c$$
+exclude_file_name_regexp--sc_prohibit_xmlURI = ^src/util/viruri\.c$$
+
exclude_file_name_regexp--sc_require_config_h = ^examples/
exclude_file_name_regexp--sc_require_config_h_first = ^examples/
diff --git a/src/Makefile.am b/src/Makefile.am
index d5f52a0..e2542b1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -104,7 +104,8 @@ UTIL_SOURCES = \
util/virnetlink.c util/virnetlink.h \
util/virrandom.h util/virrandom.c \
util/virsocketaddr.h util/virsocketaddr.c \
- util/virtime.h util/virtime.c
+ util/virtime.h util/virtime.c \
+ util/viruri.h util/viruri.c
EXTRA_DIST += $(srcdir)/util/virkeymaps.h $(srcdir)/util/keymaps.csv \
$(srcdir)/util/virkeycode-mapgen.py
diff --git a/src/datatypes.h b/src/datatypes.h
index 47058ed..fc284d2 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -151,7 +151,7 @@ struct _virConnect {
*/
unsigned int magic; /* specific value to check */
unsigned int flags; /* a set of connection flags */
- xmlURIPtr uri; /* connection URI */
+ virURIPtr uri; /* connection URI */
/* The underlying hypervisor driver and network driver. */
virDriverPtr driver;
diff --git a/src/driver.h b/src/driver.h
index d27fa99..b04b254 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -9,9 +9,9 @@
# include "config.h"
# include <unistd.h>
-# include <libxml/uri.h>
# include "internal.h"
+# include "viruri.h"
/*
* List of registered drivers numbers
*/
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index f5e1cc7..b6b22f8 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -44,6 +44,7 @@
#include "esx_vi.h"
#include "esx_vi_methods.h"
#include "esx_util.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_ESX
@@ -3945,7 +3946,7 @@ esxDomainMigratePerform(virDomainPtr domain,
{
int result = -1;
esxPrivate *priv = domain->conn->privateData;
- xmlURIPtr parsedUri = NULL;
+ virURIPtr parsedUri = NULL;
char *saveptr;
char *path_resourcePool;
char *path_hostSystem;
@@ -3976,7 +3977,7 @@ esxDomainMigratePerform(virDomainPtr domain,
}
/* Parse migration URI */
- parsedUri = xmlParseURI(uri);
+ parsedUri = virURIParse(uri);
if (parsedUri == NULL) {
virReportOOMError();
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 2c5ac1a..7d4b908 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -42,7 +42,7 @@
int
-esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, xmlURIPtr uri)
+esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
{
int result = -1;
struct qparam_set *queryParamSet = NULL;
diff --git a/src/esx/esx_util.h b/src/esx/esx_util.h
index 2bee510..a69b3f4 100644
--- a/src/esx/esx_util.h
+++ b/src/esx/esx_util.h
@@ -22,9 +22,9 @@
#ifndef __ESX_UTIL_H__
# define __ESX_UTIL_H__
-# include <libxml/uri.h>
# include <netdb.h>
# include "internal.h"
+# include "viruri.h"
typedef struct _esxUtil_ParsedUri esxUtil_ParsedUri;
@@ -40,7 +40,7 @@ struct _esxUtil_ParsedUri {
char *path;
};
-int esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, xmlURIPtr uri);
+int esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri);
void esxUtil_FreeParsedUri(esxUtil_ParsedUri **parsedUri);
diff --git a/src/hyperv/hyperv_util.c b/src/hyperv/hyperv_util.c
index 298cfe0..2e6a2d4 100644
--- a/src/hyperv/hyperv_util.c
+++ b/src/hyperv/hyperv_util.c
@@ -37,7 +37,7 @@
int
-hypervParseUri(hypervParsedUri **parsedUri, xmlURIPtr uri)
+hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri)
{
int result = -1;
struct qparam_set *queryParamSet = NULL;
diff --git a/src/hyperv/hyperv_util.h b/src/hyperv/hyperv_util.h
index 9057f55..d9d1c84 100644
--- a/src/hyperv/hyperv_util.h
+++ b/src/hyperv/hyperv_util.h
@@ -23,9 +23,8 @@
#ifndef __HYPERV_UTIL_H__
# define __HYPERV_UTIL_H__
-# include <libxml/uri.h>
-
# include "internal.h"
+# include "viruri.h"
typedef struct _hypervParsedUri hypervParsedUri;
@@ -33,7 +32,7 @@ struct _hypervParsedUri {
char *transport;
};
-int hypervParseUri(hypervParsedUri **parsedUri, xmlURIPtr uri);
+int hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri);
void hypervFreeParsedUri(hypervParsedUri **parsedUri);
diff --git a/src/libvirt.c b/src/libvirt.c
index 6294196..3eca512 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -23,7 +23,6 @@
#include <libxml/parser.h>
#include <libxml/xpath.h>
-#include <libxml/uri.h>
#include "getpass.h"
#ifdef HAVE_WINSOCK2_H
@@ -44,6 +43,7 @@
#include "command.h"
#include "virnodesuspend.h"
#include "virrandom.h"
+#include "viruri.h"
#ifndef WITH_DRIVER_MODULES
# ifdef WITH_TEST
@@ -1127,7 +1127,7 @@ do_open (const char *name,
virConnectOpenResolveURIAlias(name, &alias) < 0)
goto failed;
- ret->uri = xmlParseURI (alias ? alias : name);
+ ret->uri = virURIParse (alias ? alias : name);
if (!ret->uri) {
virLibConnError(VIR_ERR_INVALID_ARG,
_("could not parse connection URI %s"),
@@ -1729,7 +1729,7 @@ virConnectGetURI (virConnectPtr conn)
return NULL;
}
- name = (char *)xmlSaveUri(conn->uri);
+ name = (char *)virURIFormat(conn->uri);
if (!name) {
virReportOOMError();
goto error;
@@ -4952,7 +4952,7 @@ virDomainMigratePeer2Peer (virDomainPtr domain,
const char *uri,
unsigned long bandwidth)
{
- xmlURIPtr tempuri = NULL;
+ virURIPtr tempuri = NULL;
VIR_DOMAIN_DEBUG(domain, "xmlin=%s, flags=%lx, dname=%s, "
"dconnuri=%s, uri=%s, bandwidth=%lu",
NULLSTR(xmlin), flags, NULLSTR(dname),
@@ -4964,7 +4964,7 @@ virDomainMigratePeer2Peer (virDomainPtr domain,
return -1;
}
- tempuri = xmlParseURI(dconnuri);
+ tempuri = virURIParse(dconnuri);
if (!tempuri) {
virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
virDispatchError(domain->conn);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 9e3573f..15ea2ba 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1430,6 +1430,11 @@ virTypedParameterArrayValidate;
virTypedParameterAssign;
+# viruri.h
+virURIParse;
+virURIFormat;
+
+
# xml.h
virXMLChildElementCount;
virXMLParseHelper;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 6cfc5eb..6db33c2 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -44,6 +44,7 @@
#include "libxl_conf.h"
#include "xen_xm.h"
#include "virtypedparam.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_LIBXL
@@ -1043,7 +1044,7 @@ libxlOpen(virConnectPtr conn,
if (libxl_driver == NULL)
return VIR_DRV_OPEN_DECLINED;
- conn->uri = xmlParseURI("xen:///");
+ conn->uri = virURIParse("xen:///");
if (!conn->uri) {
virReportOOMError();
return VIR_DRV_OPEN_ERROR;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index b6962cf7..d77afcc 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -60,6 +60,7 @@
#include "virnodesuspend.h"
#include "virtime.h"
#include "virtypedparam.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_LXC
@@ -139,7 +140,7 @@ static virDrvOpenStatus lxcOpen(virConnectPtr conn,
if (lxc_driver == NULL)
return VIR_DRV_OPEN_DECLINED;
- conn->uri = xmlParseURI("lxc:///");
+ conn->uri = virURIParse("lxc:///");
if (!conn->uri) {
virReportOOMError();
return VIR_DRV_OPEN_ERROR;
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 833a98d..aef1491 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -56,6 +56,7 @@
#include "virfile.h"
#include "logging.h"
#include "command.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_OPENVZ
@@ -1335,7 +1336,7 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
if (access("/proc/vz", W_OK) < 0)
return VIR_DRV_OPEN_DECLINED;
- conn->uri = xmlParseURI("openvz:///system");
+ conn->uri = virURIParse("openvz:///system");
if (conn->uri == NULL) {
virReportOOMError();
return VIR_DRV_OPEN_ERROR;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 717bdf1..c5c7afc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -857,7 +857,7 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn,
if (qemu_driver == NULL)
return VIR_DRV_OPEN_DECLINED;
- conn->uri = xmlParseURI(qemu_driver->privileged ?
+ conn->uri = virURIParse(qemu_driver->privileged ?
"qemu:///system" :
"qemu:///session");
if (!conn->uri) {
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index f0af494..cf64981 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -45,6 +45,7 @@
#include "virtime.h"
#include "locking/domain_lock.h"
#include "rpc/virnetsocket.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
@@ -1759,7 +1760,7 @@ static int doNativeMigrate(struct qemud_driver *driver,
virConnectPtr dconn)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- xmlURIPtr uribits = NULL;
+ virURIPtr uribits = NULL;
int ret = -1;
qemuMigrationSpec spec;
@@ -1775,10 +1776,10 @@ static int doNativeMigrate(struct qemud_driver *driver,
virReportOOMError();
return -1;
}
- uribits = xmlParseURI(tmp);
+ uribits = virURIParse(tmp);
VIR_FREE(tmp);
} else {
- uribits = xmlParseURI(uri);
+ uribits = virURIParse(uri);
}
if (!uribits) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 2dacb70..8fb46e1 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -26,8 +26,6 @@
#include <unistd.h>
#include <assert.h>
-#include <libxml/uri.h>
-
#include "virnetclient.h"
#include "virnetclientprogram.h"
#include "virnetclientstream.h"
@@ -47,6 +45,7 @@
#include "command.h"
#include "intprops.h"
#include "virtypedparam.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_REMOTE
@@ -488,7 +487,7 @@ doRemoteOpen (virConnectPtr conn,
/* Allow remote serve to probe */
name = strdup("");
} else {
- xmlURI tmpuri = {
+ virURI tmpuri = {
.scheme = conn->uri->scheme,
#ifdef HAVE_XMLURI_QUERY_RAW
.query_raw = qparam_get_query (vars),
@@ -505,7 +504,7 @@ doRemoteOpen (virConnectPtr conn,
transport_str[-1] = '\0';
}
- name = (char *) xmlSaveUri (&tmpuri);
+ name = (char *) virURIFormat (&tmpuri);
#ifdef HAVE_XMLURI_QUERY_RAW
VIR_FREE(tmpuri.query_raw);
@@ -719,7 +718,7 @@ doRemoteOpen (virConnectPtr conn,
goto failed;
VIR_DEBUG("Auto-probed URI is %s", uriret.uri);
- conn->uri = xmlParseURI(uriret.uri);
+ conn->uri = virURIParse(uriret.uri);
VIR_FREE(uriret.uri);
if (!conn->uri) {
virReportOOMError();
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index a4cf945..cbb2c0e 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -63,6 +63,7 @@
#include "configmake.h"
#include "virnetdevtap.h"
#include "virnodesuspend.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_UML
@@ -1138,7 +1139,7 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn,
if (uml_driver == NULL)
return VIR_DRV_OPEN_DECLINED;
- conn->uri = xmlParseURI(uml_driver->privileged ?
+ conn->uri = virURIParse(uml_driver->privileged ?
"uml:///system" :
"uml:///session");
if (!conn->uri) {
diff --git a/src/util/qparams.c b/src/util/qparams.c
index f6d0713..83b568e 100644
--- a/src/util/qparams.c
+++ b/src/util/qparams.c
@@ -26,12 +26,11 @@
#include <stdlib.h>
#include <stdarg.h>
-#include <libxml/uri.h>
-
#include "virterror_internal.h"
#include "buf.h"
#include "memory.h"
#include "qparams.h"
+#include "viruri.h"
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/viruri.c b/src/util/viruri.c
new file mode 100644
index 0000000..c4bdfec
--- /dev/null
+++ b/src/util/viruri.c
@@ -0,0 +1,91 @@
+/*
+ * viruri.c: URI parsing wrappers for libxml2 functions
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * See COPYING.LIB for the License of this software
+ */
+
+#include <config.h>
+
+#include "viruri.h"
+
+#include "memory.h"
+#include "util.h"
+
+/**
+ * virURIParse:
+ * @uri: URI to parse
+ *
+ * Wrapper for xmlParseURI
+ *
+ * Unfortunately there are few things that should be managed after
+ * parsing the URI. Fortunately there is only one thing now and its
+ * removing of square brackets around IPv6 addresses.
+ *
+ * @returns the parsed uri object with some fixes
+ */
+xmlURIPtr
+virURIParse(const char *uri)
+{
+ xmlURIPtr ret = xmlParseURI(uri);
+
+ /* First check: does it even make sense to jump inside */
+ if (ret != NULL &&
+ ret->server != NULL &&
+ ret->server[0] == '[') {
+ size_t length = strlen(ret->server);
+
+ /* We want to modify the server string only if there are
+ * square brackets on both ends and inside there is IPv6
+ * address. Otherwise we could make a mistake by modifying
+ * something else than IPv6 address. */
+ if (ret->server[length - 1] == ']' && strchr(ret->server, ':')) {
+ memmove(&ret->server[0], &ret->server[1], length - 2);
+ ret->server[length - 2] = '\0';
+ }
+ /* Even after such modification, it is completely ok to free
+ * the uri with xmlFreeURI() */
+ }
+
+ return ret;
+}
+
+/**
+ * virURIFormat:
+ * @uri: URI to format
+ *
+ * Wrapper for xmlSaveUri
+ *
+ * This function constructs back everything that @ref virURIParse
+ * changes after parsing
+ *
+ * @returns the constructed uri as a string
+ */
+unsigned char *
+virURIFormat(xmlURIPtr uri)
+{
+ char *tmpserver = NULL, *backupserver = uri->server;
+ unsigned char *ret;
+
+ /* First check: does it make sense to do anything */
+ if (uri != NULL &&
+ uri->server != NULL &&
+ strchr(uri->server, ':') != NULL) {
+
+ if (virAsprintf(&tmpserver, "[%s]", uri->server) == -1)
+ return NULL;
+
+ uri->server = tmpserver;
+ }
+
+ ret = xmlSaveUri(uri);
+
+ /* Put the fixed version back */
+ if (tmpserver) {
+ uri->server = backupserver;
+ VIR_FREE(tmpserver);
+ }
+
+ return ret;
+}
diff --git a/src/util/viruri.h b/src/util/viruri.h
new file mode 100644
index 0000000..1315488
--- /dev/null
+++ b/src/util/viruri.h
@@ -0,0 +1,18 @@
+/*
+ * viruri.h: internal definitions used for URI parsing.
+ */
+
+#ifndef __VIR_URI_H__
+# define __VIR_URI_H__
+
+# include <libxml/uri.h>
+
+# include "internal.h"
+
+typedef xmlURI virURI;
+typedef xmlURIPtr virURIPtr;
+
+virURIPtr virURIParse(const char *uri);
+unsigned char * virURIFormat(virURIPtr uri);
+
+#endif /* __VIR_URI_H__ */
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index b168c7d..a39b567 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -56,6 +56,7 @@
#include "configmake.h"
#include "virfile.h"
#include "fdstream.h"
+#include "viruri.h"
/* This one changes from version to version. */
#if VBOX_API_VERSION == 2002
@@ -980,7 +981,7 @@ static virDrvOpenStatus vboxOpen(virConnectPtr conn,
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
if (conn->uri == NULL) {
- conn->uri = xmlParseURI(uid ? "vbox:///session" : "vbox:///system");
+ conn->uri = virURIParse(uid ? "vbox:///session" : "vbox:///system");
if (conn->uri == NULL) {
virReportOOMError();
return VIR_DRV_OPEN_ERROR;
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 823d5df..9c83de4 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -24,7 +24,6 @@
#include <config.h>
#include <c-ctype.h>
-#include <libxml/uri.h>
#include "internal.h"
#include "virterror_internal.h"
@@ -33,6 +32,7 @@
#include "logging.h"
#include "uuid.h"
#include "vmx.h"
+#include "viruri.h"
/*
@@ -2518,7 +2518,7 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
char network_endPoint_name[48] = "";
char *network_endPoint = NULL;
- xmlURIPtr parsedUri = NULL;
+ virURIPtr parsedUri = NULL;
if (def == NULL || *def != NULL) {
VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
@@ -2608,7 +2608,7 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
(*def)->target.port = port;
(*def)->source.type = VIR_DOMAIN_CHR_TYPE_TCP;
- parsedUri = xmlParseURI(fileName);
+ parsedUri = virURIParse(fileName);
if (parsedUri == NULL) {
virReportOOMError();
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 635f468..19ce7da 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -26,7 +26,6 @@
#include <sys/types.h>
#include <fcntl.h>
#include <xen/dom0_ops.h>
-#include <libxml/uri.h>
#include "virterror_internal.h"
#include "logging.h"
@@ -50,6 +49,7 @@
#include "uuid.h"
#include "fdstream.h"
#include "virfile.h"
+#include "viruri.h"
#include "command.h"
#include "virnodesuspend.h"
@@ -270,7 +270,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
if (!xenUnifiedProbe())
return VIR_DRV_OPEN_DECLINED;
- conn->uri = xmlParseURI("xen:///");
+ conn->uri = virURIParse("xen:///");
if (!conn->uri) {
virReportOOMError();
return VIR_DRV_OPEN_ERROR;
diff --git a/src/xen/xen_hypervisor.h b/src/xen/xen_hypervisor.h
index 77c6f74..55a99f1 100644
--- a/src/xen/xen_hypervisor.h
+++ b/src/xen/xen_hypervisor.h
@@ -11,11 +11,10 @@
#ifndef __VIR_XEN_INTERNAL_H__
# define __VIR_XEN_INTERNAL_H__
-# include <libxml/uri.h>
-
# include "internal.h"
# include "capabilities.h"
# include "driver.h"
+# include "viruri.h"
/* See xenHypervisorInit() for details. */
struct xenHypervisorVersions {
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 5c3838f..83bfac0 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -27,7 +27,6 @@
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
-#include <libxml/uri.h>
#include <errno.h>
#include "virterror_internal.h"
@@ -46,6 +45,7 @@
#include "memory.h"
#include "count-one-bits.h"
#include "virfile.h"
+#include "viruri.h"
/* required for cpumap_t */
#include <xen/dom0_ops.h>
@@ -3224,7 +3224,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
* "hostname", "hostname:port" or "xenmigr://hostname[:port]/".
*/
if (strstr (uri, "//")) { /* Full URI. */
- xmlURIPtr uriptr = xmlParseURI (uri);
+ virURIPtr uriptr = virURIParse (uri);
if (!uriptr) {
virXendError(VIR_ERR_INVALID_ARG,
"%s", _("xenDaemonDomainMigrate: invalid URI"));
diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
index eee67b5..3f0b63d 100644
--- a/src/xen/xend_internal.h
+++ b/src/xen/xend_internal.h
@@ -18,13 +18,13 @@
# include <sys/types.h>
# include <stdint.h>
-# include <libxml/uri.h>
# include "internal.h"
# include "capabilities.h"
# include "domain_conf.h"
# include "driver.h"
# include "buf.h"
+# include "viruri.h"
int
xenDaemonOpen_unix(virConnectPtr conn, const char *path);
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index f877f67..94644ae 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -25,7 +25,6 @@
#include <limits.h>
#include <stdint.h>
#include <string.h>
-#include <libxml/uri.h>
#include <curl/curl.h>
#include <xen/api/xen_all.h>
#include "internal.h"
@@ -37,6 +36,7 @@
#include "uuid.h"
#include "memory.h"
#include "buf.h"
+#include "viruri.h"
#include "xenapi_driver.h"
#include "xenapi_driver_private.h"
#include "xenapi_utils.h"
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index ddc7736..943b6c0 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -25,7 +25,6 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
-#include <libxml/uri.h>
#include <xen/api/xen_all.h>
#include "internal.h"
#include "domain_conf.h"
@@ -37,6 +36,7 @@
#include "buf.h"
#include "logging.h"
#include "qparams.h"
+#include "viruri.h"
#include "xenapi_driver_private.h"
#include "xenapi_utils.h"
@@ -94,7 +94,7 @@ xenapiUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
}
int
-xenapiUtil_ParseQuery(virConnectPtr conn, xmlURIPtr uri, int *noVerify)
+xenapiUtil_ParseQuery(virConnectPtr conn, virURIPtr uri, int *noVerify)
{
int result = 0;
int i;
diff --git a/src/xenapi/xenapi_utils.h b/src/xenapi/xenapi_utils.h
index 40506d5..aa1ff74 100644
--- a/src/xenapi/xenapi_utils.h
+++ b/src/xenapi/xenapi_utils.h
@@ -23,9 +23,9 @@
# define __VIR_XENAPI_UTILS__
# include <stdint.h>
-# include <libxml/uri.h>
# include <xen/api/xen_all.h>
# include "internal.h"
+# include "viruri.h"
# include "domain_conf.h"
# define NETWORK_DEVID_SIZE (12)
@@ -40,7 +40,7 @@ xenapiUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
const char *hostname);
int
-xenapiUtil_ParseQuery(virConnectPtr conn, xmlURIPtr uri, int *noVerify);
+xenapiUtil_ParseQuery(virConnectPtr conn, virURIPtr uri, int *noVerify);
enum xen_on_normal_exit
actionShutdownLibvirt2XenapiEnum(enum virDomainLifecycleAction action);
--
1.7.3.4
12 years, 10 months
[libvirt] [PATCH] virsh: fix informational message in iface-bridge command
by Laine Stump
See: https://bugzilla.redhat.com/show_bug.cgi?id=797066
The position of the bridge name and ethernet device name were
accidentally swapped in the message informing of success creating the
bridge.
---
tools/virsh.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index b97a888..66bbb0c 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -8974,7 +8974,7 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
}
vshPrint(ctl, _("Created bridge %s with attached device %s\n"),
- if_name, br_name);
+ br_name, if_name);
/* start it up unless requested not to */
if (!nostart) {
--
1.7.7.6
12 years, 10 months
[libvirt] Virt io blk buffer
by Pankaj Rawat
Hi all
Can any one tell what is the default Vitio blk IO Buffer size
And can we change it ? if yes how?
DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and
intended
for the named recipient(s) only.
It shall not attach any liability on the originator or NECHCL or its
affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the
opinions of NECHCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is
strictly prohibited. If you have
received this email in error please delete it and notify the sender
immediately. .
-----------------------------------------------------------------------------------------------------------------------
12 years, 10 months
[libvirt] New QMP event interface (was Re: [Qemu-devel] [PATCH 5/5] qmp: add DEVICE_TRAY_MOVED event)
by Anthony Liguori
On 02/24/2012 10:56 AM, Luiz Capitulino wrote:
> On Fri, 24 Feb 2012 10:44:11 -0600
> Anthony Liguori<anthony(a)codemonkey.ws> wrote:
>
>>> I'm asking because the conversion of events to the qapi is not too far away,
>>> but I think that using QOM will somewhat deprecate the code you have in the
>>> glib branch (besides having to wait for 1.2)?
>>
>> I have some vague ideas about what to do here. One thought would be to have a
>> standard notifier mechanism in Object that was advertised as a property type.
>> We could then provide an interface via QMP to [un]subscribe to a notifier property.
>
> This seems to be a good match with your previous ideas, implemented in the glib
> branch. But then subsystems/devices emitting events will have to be converted
> to QOM first...
Well we need to keep the old events for compatibility, so it's really just about
new events. I think that by end of 1.2, we would have all non-qdev subsystems
converted to QOM also so this shouldn't be a problem in practice.
>
>> I won't get to this until the 1.2 time frame though. My goals for 1.1 are to
>> get qbus conversions merged and refactor IRQs/MemoryRegions to use QOM. If time
>> permits, also refactor the PC to better use QOM.
>>
>> If someone wants to tackle events in QOM, I'd be happy to provide some
>> suggestions on where to start.
>
> I'd like to hear about it, but I'm not sure when I'll start working on it.
I've only thought about this roughly, but the problems that need to be solved are:
1) Have an object property that corresponds to a NotifierList (easy)
2) Figure out what it means to "get" and "set" a NotifierList. I think perhaps
we could somehow turn this into subscribe/unsubscribe...
We could take a plan9-like approach where "get" would return the canonical path
of a new object that corresponded to a subscription to the event. This is nice
because unsubscribing then just becomes a matter of destroying the subscription
object.
Once you had this subscription object, I think we would want a mechanism to
"connect" the subscription with either a native function pointer or some
mechanism that would let us translate that to QMP. Maybe we only connect with a
native function pointer and use QAPI generation code to build a native function
pointer that spits out a marshalled QObject.
3) We would need to think through the QMP interface for all of this. Given a
path, we want to be able to subscribe to an event and unsubscribe from an event.
We need to unsubscribe all subscribed events when the connection is lost. It
would be nice to have convenience interfaces for doing things like subscribing
to any event on a given type too including yet to be created objects.
Cc'ing libvirt here to see if they have any additional requirements.
Regards,
Anthony Liguori
12 years, 10 months
[libvirt] [PATCH] Improve error reporting when virsh console is run without a TTY
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
If attempting to run
ssh root@somehost virsh console someguest
You'll get an error
2012-02-15 13:11:47.683+0000: 4765: info : libvirt version: 0.9.10, package: 1.fc18 (Unknown, 2012-02-15-11:48:57, lettuce.camlab.fab.redhat.com)
2012-02-15 13:11:47.683+0000: 4765: error : vshRunConsole:320 : unable to get tty attributes: Invalid argument
Connected to domain f16x86_64
Escape character is ^]
There are several problems here
- The actual error message is bad for users
- We shouldn't rely on VIR_ERROR for this case
- The prompt makes it look like we still connected
because we didn't flush stdout.
* virsh.c: Flush stdout before starting console and check
for a valid tty
---
tools/virsh.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 3be86ed..b97a888 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -838,8 +838,14 @@ cmdRunConsole(vshControl *ctl, virDomainPtr dom, const char *name)
goto cleanup;
}
+ if (!isatty(STDIN_FILENO)) {
+ vshError(ctl, "%s", _("Cannot run interactive console without a controlling TTY"));
+ goto cleanup;
+ }
+
vshPrintExtra(ctl, _("Connected to domain %s\n"), virDomainGetName(dom));
vshPrintExtra(ctl, _("Escape character is %s\n"), ctl->escapeChar);
+ fflush(stdout);
if (vshRunConsole(dom, name, ctl->escapeChar) == 0)
ret = true;
--
1.7.7.6
12 years, 10 months
[libvirt] [PATCH] Workaround python header file insanity
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The /usr/include/python/pyconfig.h file pollutes the global
namespace with a huge number of HAVE_XXX and WITH_XXX
defines. These change what we detected in our own config.h
In particular if you try to build without DTrace, python's
headers turn it back on with predictable fail.
THe hack to workaround this is to rename WITH_DTRACE to
WITH_DTRACE_PROBES to avoid the namespace clash
---
configure.ac | 4 ++--
daemon/Makefile.am | 2 +-
src/Makefile.am | 4 ++--
src/internal.h | 2 +-
tests/Makefile.am | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index 732f4fe..262e63b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1378,10 +1378,10 @@ if test "$with_dtrace" != "no" ; then
with_dtrace=yes
fi
if test "$with_dtrace" = "yes"; then
- AC_DEFINE_UNQUOTED([WITH_DTRACE], 1, [whether DTrace static probes are available])
+ AC_DEFINE_UNQUOTED([WITH_DTRACE_PROBES], 1, [whether DTrace static probes are available])
fi
fi
-AM_CONDITIONAL([WITH_DTRACE], [test "$with_dtrace" != "no"])
+AM_CONDITIONAL([WITH_DTRACE_PROBES], [test "$with_dtrace" != "no"])
dnl NUMA lib
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index e2c1357..db4abf5 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -109,7 +109,7 @@ libvirtd_LDADD = \
$(SASL_LIBS) \
$(POLKIT_LIBS)
-if WITH_DTRACE
+if WITH_DTRACE_PROBES
libvirtd_LDADD += ../src/probes.o
endif
diff --git a/src/Makefile.am b/src/Makefile.am
index d5f52a0..9b1921d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1284,7 +1284,7 @@ libvirt_la_CFLAGS = -DIN_LIBVIRT $(AM_CFLAGS)
# picked out for us.
libvirt_la_DEPENDENCIES = $(libvirt_la_BUILT_LIBADD) $(LIBVIRT_SYMBOL_FILE)
-if WITH_DTRACE
+if WITH_DTRACE_PROBES
libvirt_la_BUILT_LIBADD += probes.o
libvirt_la_DEPENDENCIES += probes.o
nodist_libvirt_la_SOURCES = probes.h
@@ -1521,7 +1521,7 @@ libvirt_lxc_LDADD = $(CAPNG_LIBS) $(YAJL_LIBS) \
$(LIBNL_LIBS) $(AUDIT_LIBS) $(DEVMAPPER_LIBS) \
$(RT_LIBS) \
../gnulib/lib/libgnu.la
-if WITH_DTRACE
+if WITH_DTRACE_PROBES
libvirt_lxc_LDADD += probes.o
endif
if WITH_SECDRIVER_SELINUX
diff --git a/src/internal.h b/src/internal.h
index fabcb52..3408541 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -247,7 +247,7 @@
# define VIR_DIV_UP(value, size) (((value) + (size) - 1) / (size))
-# if WITH_DTRACE
+# if WITH_DTRACE_PROBES
# ifndef LIBVIRT_PROBES_H
# define LIBVIRT_PROBES_H
# include "probes.h"
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3fb9e2f..9974c2f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -29,7 +29,7 @@ INCLUDES += \
endif
PROBES_O =
-if WITH_DTRACE
+if WITH_DTRACE_PROBES
PROBES_O += ../src/probes.o
endif
--
1.7.7.6
12 years, 10 months