Re: [libvirt] [PATCH] autogen.sh: added glibtool and pkg-config checks
by Bruce Korb
Please don't use my project name when talking
about bootstrap process. "autogen.sh" has become
a popular misnomer, so at least keep the ".sh" suffix. Thanks.
On Wed, Sep 15, 2010 at 10:02 AM, Eric Blake <eblake(a)redhat.com> wrote:
> [adding bug-gnulib]
>
> On 09/15/2010 06:36 AM, Justin Clift wrote:
>>
>> OSX MacPorts has libtool named as glibtool, with libtoolize
>> named as glibtoolize. This patch adds support for this, and also
>> adds a check for pkg-config, to warn when it is missing.
>
> Hmm - would it be easier to make bootstrap.conf list pkg-config as a
> prerequisite, rather than having to hack up autogen.sh to do that?
>
> Also, if I'm reading the code right, changing bootstrap.conf to list
> 'libtoolize' instead of 'libtool' as the prerequisite will let you get by
> with overriding just $LIBTOOLIZE instead of both $LIBTOOL and $LIBTOOLIZE.
>
> Additionally it may be sufficient to just teach upstream
> gnulib/build-aux/bootstrap to use 'find_tool LIBTOOLIZE libtoolize
> glibtoolize', at which point re-syncing to upstream bootstrap will
> automatically pick up on the right libtool for MacOS without you having to
> hack libvirt's autogen.sh in the first place :)
>
> So, NACK to this version of the libvirt patch, and instead let me do some
> gnulib work... Not to mention that Gary is working on some upstream patches
> to improve bootstrap modularity, and there is also a request to add
> 'bootstrap --skip-git' that I need to respond to...
>
> --
> Eric Blake eblake(a)redhat.com +1-801-349-2682
> Libvirt virtualization library http://libvirt.org
>
>
14 years, 3 months
[libvirt] [PATCH] libvirtd: improve the error message displayed on tls client auth failure
by Justin Clift
This address BZ # 556599:
https://bugzilla.redhat.com/show_bug.cgi?id=556599
---
daemon/libvirtd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 711360b..46e22bd 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1226,7 +1226,7 @@ remoteCheckCertificate (gnutls_session_t session)
if (i == 0) {
if (!remoteCheckDN (cert)) {
/* This is the most common error: make it informative. */
- VIR_ERROR0(_("remoteCheckCertificate: client's Distinguished Name is not on the list of allowed clients (tls_allowed_dn_list). Use 'openssl x509 -in clientcert.pem -text' to view the Distinguished Name field in the client certificate, or run this daemon with --verbose option."));
+ VIR_ERROR0(_("remoteCheckCertificate: client's Distinguished Name is not on the list of allowed clients (tls_allowed_dn_list). Use 'certtool -i --infile clientcert.pem' to view the Distinguished Name field in the client certificate, or run this daemon with --verbose option."));
gnutls_x509_crt_deinit (cert);
return -1;
}
--
1.7.2.2
14 years, 3 months
[libvirt] [PATCH] maint: silence warning from libtool
by Eric Blake
I got tired of seeing this:
config.status: executing libtool commands
/bin/rm: cannot remove `libtoolT': No such file or directory
config.status: executing po-directories commands
While I was at it, there were a couple other unused variables.
* configure.ac (RM, MV, TAR): Drop; nothing in libvirt directly uses
this, and assigning RM interferes with libtool.
---
configure.ac | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index a71f5e8..5ded22b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -122,9 +122,6 @@ AM_CONDITIONAL([HAVE_GLIBC_RPCGEN],
$ac_cv_path_RPCGEN -t </dev/null >/dev/null 2>&1])
dnl Miscellaneous external programs.
-AC_PATH_PROG([RM], [rm], [/bin/rm])
-AC_PATH_PROG([MV], [mv], [/bin/mv])
-AC_PATH_PROG([TAR], [tar], [/bin/tar])
AC_PATH_PROG([XMLLINT], [xmllint], [/usr/bin/xmllint])
AC_PATH_PROG([XMLCATALOG], [xmlcatalog], [/usr/bin/xmlcatalog])
AC_PATH_PROG([XSLTPROC], [xsltproc], [/usr/bin/xsltproc])
--
1.7.2.2
14 years, 3 months
[libvirt] [PATCH] Rebuild network filter for UML guests on updates
by Soren Hansen
When nwfilter support was added to UML, I didn't realise the UML driver
needed instrumentation to make updating nwfilters on the fly work. This
patch adds this bit of glue.
Signed-off-by: Soren Hansen <soren(a)linux2go.dk>
---
src/uml/uml_driver.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 40345d5..9101928 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -2198,6 +2198,18 @@ static virDriver umlDriver = {
NULL, /* qemuDomainMonitorCommand */
};
+static int
+umlVMFilterRebuild(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virHashIterator iter, void *data)
+{
+ struct uml_driver *driver = uml_driver;
+
+ umlDriverLock(driver);
+ virHashForEach(uml_driver->domains.objs, iter, data);
+ umlDriverUnlock(driver);
+
+ return 0;
+}
static virStateDriver umlStateDriver = {
.name = "UML",
@@ -2207,8 +2219,14 @@ static virStateDriver umlStateDriver = {
.active = umlActive,
};
+static virNWFilterCallbackDriver umlCallbackDriver = {
+ .name = "UML",
+ .vmFilterRebuild = umlVMFilterRebuild,
+};
+
int umlRegister(void) {
virRegisterDriver(¨Driver);
virRegisterStateDriver(¨StateDriver);
+ virNWFilterRegisterCallbackDriver(¨CallbackDriver);
return 0;
}
--
1.7.1
14 years, 3 months
[libvirt] [PATCH] virsh: Use virBuffer for generating XML
by Jiri Denemark
cmdAttachInterface and cmdAttachDisk still used vshRealloc and sprintf
for generating XML, which is hardly maintainable. Let's get rid of this
old code.
---
tools/virsh.c | 152 ++++++++++++++++++++------------------------------------
1 files changed, 54 insertions(+), 98 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 57ea618..9eb1e51 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -7874,8 +7874,9 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
virDomainPtr dom = NULL;
char *mac, *target, *script, *type, *source;
int typ, ret = FALSE;
- char *buf = NULL, *tmp = NULL;
unsigned int flags;
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+ char *xml;
if (!vshConnectionUsability(ctl, ctl->conn))
goto cleanup;
@@ -7903,52 +7904,40 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
}
/* Make XML of interface */
- tmp = vshMalloc(ctl, 1);
- buf = vshMalloc(ctl, strlen(type) + 25);
- sprintf(buf, " <interface type='%s'>\n" , type);
+ virBufferVSprintf(&buf, "<interface type='%s'>\n" , type);
- tmp = vshRealloc(ctl, tmp, strlen(source) + 28);
- if (typ == 1) {
- sprintf(tmp, " <source network='%s'/>\n", source);
- } else if (typ == 2) {
- sprintf(tmp, " <source bridge='%s'/>\n", source);
- }
- buf = vshRealloc(ctl, buf, strlen(buf) + strlen(tmp) + 1);
- strcat(buf, tmp);
+ if (typ == 1)
+ virBufferVSprintf(&buf, " <source network='%s'/>\n", source);
+ else if (typ == 2)
+ virBufferVSprintf(&buf, " <source bridge='%s'/>\n", source);
- if (target != NULL) {
- tmp = vshRealloc(ctl, tmp, strlen(target) + 24);
- sprintf(tmp, " <target dev='%s'/>\n", target);
- buf = vshRealloc(ctl, buf, strlen(buf) + strlen(tmp) + 1);
- strcat(buf, tmp);
- }
+ if (target != NULL)
+ virBufferVSprintf(&buf, " <target dev='%s'/>\n", target);
+ if (mac != NULL)
+ virBufferVSprintf(&buf, " <mac address='%s'/>\n", mac);
+ if (script != NULL)
+ virBufferVSprintf(&buf, " <script path='%s'/>\n", script);
- if (mac != NULL) {
- tmp = vshRealloc(ctl, tmp, strlen(mac) + 25);
- sprintf(tmp, " <mac address='%s'/>\n", mac);
- buf = vshRealloc(ctl, buf, strlen(buf) + strlen(tmp) + 1);
- strcat(buf, tmp);
- }
+ virBufferAddLit(&buf, "</interface>\n");
- if (script != NULL) {
- tmp = vshRealloc(ctl, tmp, strlen(script) + 25);
- sprintf(tmp, " <script path='%s'/>\n", script);
- buf = vshRealloc(ctl, buf, strlen(buf) + strlen(tmp) + 1);
- strcat(buf, tmp);
+ if (virBufferError(&buf)) {
+ vshPrint(ctl, "%s", _("Failed to allocate XML buffer"));
+ return FALSE;
}
- buf = vshRealloc(ctl, buf, strlen(buf) + 19);
- strcat(buf, " </interface>\n");
+ xml = virBufferContentAndReset(&buf);
if (vshCommandOptBool(cmd, "persistent")) {
flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
if (virDomainIsActive(dom) == 1)
flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE;
- ret = virDomainAttachDeviceFlags(dom, buf, flags);
+ ret = virDomainAttachDeviceFlags(dom, xml, flags);
} else {
- ret = virDomainAttachDevice(dom, buf);
+ ret = virDomainAttachDevice(dom, xml);
}
+ VIR_FREE(xml);
+
if (ret != 0) {
vshError(ctl, "%s", _("Failed to attach interface"));
ret = FALSE;
@@ -7960,8 +7949,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
cleanup:
if (dom)
virDomainFree(dom);
- VIR_FREE(buf);
- VIR_FREE(tmp);
+ virBufferFreeAndReset(&buf);
return ret;
}
@@ -8126,9 +8114,10 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
virDomainPtr dom = NULL;
char *source, *target, *driver, *subdriver, *type, *mode;
int isFile = 0, ret = FALSE;
- char *buf = NULL, *tmp = NULL;
unsigned int flags;
char *stype;
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+ char *xml;
if (!vshConnectionUsability(ctl, ctl->conn))
goto cleanup;
@@ -8167,77 +8156,45 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
}
/* Make XML of disk */
- tmp = vshMalloc(ctl, 1);
- buf = vshMalloc(ctl, 23);
- if (isFile) {
- sprintf(buf, " <disk type='file'");
- } else {
- sprintf(buf, " <disk type='block'");
- }
-
- if (type) {
- tmp = vshRealloc(ctl, tmp, strlen(type) + 13);
- sprintf(tmp, " device='%s'>\n", type);
- } else {
- tmp = vshRealloc(ctl, tmp, 3);
- sprintf(tmp, ">\n");
- }
- buf = vshRealloc(ctl, buf, strlen(buf) + strlen(tmp) + 1);
- strcat(buf, tmp);
-
- if (driver) {
- tmp = vshRealloc(ctl, tmp, strlen(driver) + 22);
- sprintf(tmp, " <driver name='%s'", driver);
- } else {
- tmp = vshRealloc(ctl, tmp, 25);
- sprintf(tmp, " <driver name='phy'");
- }
- buf = vshRealloc(ctl, buf, strlen(buf) + strlen(tmp) + 1);
- strcat(buf, tmp);
-
- if (subdriver) {
- tmp = vshRealloc(ctl, tmp, strlen(subdriver) + 12);
- sprintf(tmp, " type='%s'/>\n", subdriver);
- } else {
- tmp = vshRealloc(ctl, tmp, 4);
- sprintf(tmp, "/>\n");
- }
- buf = vshRealloc(ctl, buf, strlen(buf) + strlen(tmp) + 1);
- strcat(buf, tmp);
-
- tmp = vshRealloc(ctl, tmp, strlen(source) + 25);
- if (isFile) {
- sprintf(tmp, " <source file='%s'/>\n", source);
- } else {
- sprintf(tmp, " <source dev='%s'/>\n", source);
- }
- buf = vshRealloc(ctl, buf, strlen(buf) + strlen(tmp) + 1);
- strcat(buf, tmp);
-
- tmp = vshRealloc(ctl, tmp, strlen(target) + 24);
- sprintf(tmp, " <target dev='%s'/>\n", target);
- buf = vshRealloc(ctl, buf, strlen(buf) + strlen(tmp) + 1);
- strcat(buf, tmp);
+ virBufferVSprintf(&buf, "<disk type='%s'",
+ (isFile) ? "file" : "block");
+ if (type)
+ virBufferVSprintf(&buf, " device='%s'", type);
+ virBufferAddLit(&buf, ">\n");
+
+ virBufferVSprintf(&buf, " <driver name='%s'",
+ (driver) ? driver : "phy");
+ if (subdriver)
+ virBufferVSprintf(&buf, " type='%s'", subdriver);
+ virBufferAddLit(&buf, "/>\n");
+
+ virBufferVSprintf(&buf, " <source %s='%s'/>\n",
+ (isFile) ? "file" : "dev",
+ source);
+ virBufferVSprintf(&buf, " <target dev='%s'/>\n", target);
+ if (mode)
+ virBufferVSprintf(&buf, " <%s/>\n", mode);
+
+ virBufferAddLit(&buf, "</disk>\n");
- if (mode != NULL) {
- tmp = vshRealloc(ctl, tmp, strlen(mode) + 11);
- sprintf(tmp, " <%s/>\n", mode);
- buf = vshRealloc(ctl, buf, strlen(buf) + strlen(tmp) + 1);
- strcat(buf, tmp);
+ if (virBufferError(&buf)) {
+ vshPrint(ctl, "%s", _("Failed to allocate XML buffer"));
+ return FALSE;
}
- buf = vshRealloc(ctl, buf, strlen(buf) + 13);
- strcat(buf, " </disk>\n");
+ xml = virBufferContentAndReset(&buf);
if (vshCommandOptBool(cmd, "persistent")) {
flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
if (virDomainIsActive(dom) == 1)
flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE;
- ret = virDomainAttachDeviceFlags(dom, buf, flags);
+ ret = virDomainAttachDeviceFlags(dom, xml, flags);
} else {
- ret = virDomainAttachDevice(dom, buf);
+ ret = virDomainAttachDevice(dom, xml);
}
+ VIR_FREE(xml);
+
if (ret != 0) {
vshError(ctl, "%s", _("Failed to attach disk"));
ret = FALSE;
@@ -8249,8 +8206,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
cleanup:
if (dom)
virDomainFree(dom);
- VIR_FREE(buf);
- VIR_FREE(tmp);
+ virBufferFreeAndReset(&buf);
return ret;
}
--
1.7.2.3
14 years, 3 months
[libvirt] [PATCH] Use SED variable for `sed` binary in src/Makefile
by Mitchell Hashimoto
Hi,
I've been trying to get libvirt (client) to cleanly/easily compile on
BSD-based systems (in this case OS X). "./configure" runs fine but the
"make" caused an error with `sed` since BSD sed was reporting some sort of
regex error. I realized that the "SED" variable was populated with "gsed"
which worked properly. This made the make continue (failed again later, will
address that when I can).
This is my first contribution to a C-based project and I don't have much
experience with autotools other than using them as a consumer. Let me know
if anything can be improved.
Thank you,
Mitchell
14 years, 3 months
[libvirt] [PATCH 0/3] test cases for spoofing prevention
by gstenzel@linux.vnet.ibm.com
The following patches add a set of test cases to verify that several spoofing attacks are prevented by the nwfilter subsystem.
In order to have a well defined test machine a virtual disk is installed from scratch over the network.
I am currently trying to find a suitable location for the kickstart file.
--
Best regards,
Gerhard Stenzel,
-----------------------------------------------------------------------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
14 years, 3 months
Re: [libvirt] Question, how to use virDomainQemuMonitorCommand()
by Chris Lalancette
On 09/07/10 - 04:08:13PM, Lai Jiangshan wrote:
> Hi, Chris,
>
> I saw virDomainQemuMonitorCommand() in libvirt-qemu.c,
> I think it will help me to send arbitrary qemu-monitor command to
> qemu via libvirtd.
>
> But how can I use virDomainQemuMonitorCommand()?
> Can I use it by just using current tools(virsh or other) without writing any code?
Unfortunately, no. There is a bug in the current virsh command that prevents
it from properly parsing the command-lines necessary to send monitor commands
to the qemu monitor. Until we fix that bug, we won't push the support into
virsh.
For that reason you will need to write a custom program to call
virDomainQemuMonitorCommand as appropriate. The absolute easiest program you
can write looks something like (untested):
#include <stdio.h>
#include <stdlib.h>
#include <libvirt/libvirt.h>
int main()
{
virConnectPtr conn;
virDomainPtr dom;
char *reply;
conn = virConnectOpen(NULL);
dom = virDomainLookupByName(conn, "mydomain");
virDomainQemuMonitorCommand(dom, "info cpus", &reply, 0);
fprintf(stderr, "Reply: %s\n", reply);
free(reply);
virConnectClose(conn);
return 0;
}
--
Chris Lalancette
14 years, 3 months