[Libvir] a couple of questions -Newbie
by Spencer Parker
I am really excited to start using this, but I have a couple of
questions about how to use it exactly. I want to be able to pull a list
of stats out of my Xen machines. I need to get something like network
i/o. I just need to know how much in and out traffic that a specific
machine is doing. I am pretty new to python and to programming in
general. I have looked at the APi and stuff like that, but am a little
confused still on how to actually do this. Mainly I just need to know
how to connect to certain things.
Once I have a basic understanding of what is going on then I can take it
from there. Thanks for all the help!
Spencer Parker
16 years, 10 months
[Libvir] API Question...
by Spencer Parker
Okay...so I am still trying to get what this says I can get. But I want
to do it with Python. I am looking at this:
virDomainInterfaceStatsStruct and wondering if I can grab this info with
Python or not. I looked at the libvirt module, but I don't see how I
would grab this. Any ideas?
16 years, 10 months
[Libvir] [PATCH] Avoid segfault upon early libvirtd failure.
by Jim Meyering
One of today's leak-plugging patches introduced a bug.
Fortunately, it can strike only when libvirtd is about to
fail anyway. The consequence is that instead of failing in
an orderly manner, it would probably segfault.
Sorry about that. Here's the fix:
Avoid segfault upon early libvirtd failure.
* qemud/qemud.c (main): Don't call qemudCleanup on an
uninitialized pointer.
By the way, even though this evoked a warning from gcc,
"make distcheck" passes. Obviously, that means the distcheck
rule is inadequate. I'll fix it so that it turns on -Werror
for the final build.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
qemud/qemud.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/qemud/qemud.c b/qemud/qemud.c
index 96fdf32..b6b82ed 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -2025,7 +2025,7 @@ libvirt management daemon:\n\
#define MAX_LISTEN 5
int main(int argc, char **argv) {
- struct qemud_server *server;
+ struct qemud_server *server = NULL;
struct sigaction sig_action;
int sigpipe[2];
const char *pid_file = NULL;
@@ -2180,7 +2180,8 @@ int main(int argc, char **argv) {
unlink (pid_file);
error1:
- qemudCleanup(server);
+ if (server)
+ qemudCleanup(server);
return ret;
}
--
1.5.4.3.366.g55277
16 years, 10 months
[Libvir] [PATCH]Change MAC address to case insensitive
by S.Sakamoto
Hi,
xenXMDomainAttachDevice and xenXMDomainDetachDevice
treats "case sensitve" for MAC address of stopping domain.
This patch changes from case sensitive to case insensitive.
Thanks,
Shigeki Sakamoto.
Index: src/xm_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xm_internal.c,v
retrieving revision 1.64
diff -u -p -r1.64 xm_internal.c
--- src/xm_internal.c 20 Feb 2008 15:29:13 -0000 1.64
+++ src/xm_internal.c 26 Feb 2008 06:40:57 -0000
@@ -2812,7 +2812,7 @@ xenXMAttachInterface(virDomainPtr domain
key = nextkey;
}
- if (!(strcmp(dommac, (const char *) mac))) {
+ if (!(strcasecmp(dommac, (const char *) mac))) {
if (autoassign) {
free(mac);
mac = NULL;
@@ -3087,7 +3087,7 @@ xenXMDomainDetachDevice(virDomainPtr dom
mac = nextmac;
}
- if (!(strcmp(dommac, (const char *) key)))
+ if (!(strcasecmp(dommac, (const char *) key)))
break;
}
skip:
16 years, 10 months
[Libvir] [PATCH] Fix capabilities xml for topology info
by Cole Robinson
The patch below fixes the capabilities xml generated for the hosts
topology info. This was causing virt-install to barf when using
the test driver (see attached capabilities xml from before this patch).
Thanks,
Cole
diff --git a/src/capabilities.c b/src/capabilities.c
index bedd445..01bb308 100644
--- a/src/capabilities.c
+++ b/src/capabilities.c
@@ -583,7 +583,7 @@ virCapabilitiesFormatXML(virCapsPtr caps)
caps->host.numaCell[i]->ncpus) < 0)
goto no_memory;
for (j = 0 ; j < caps->host.numaCell[i]->ncpus ; j++)
- if (virBufferVSprintf(&xml, " <cpu id='%d'>\n",
+ if (virBufferVSprintf(&xml, " <cpu id='%d'/>\n",
caps->host.numaCell[i]->cpus[j]) < 0)
goto no_memory;
if (virBufferAddLit(&xml, " </cpus>\n") < 0)
<capabilities>
<host>
<cpu>
<arch>i686</arch>
<features>
<pae/>
<nonpae/>
</features>
</cpu>
<topology>
<cells num='2'>
<cell id='0'>
<cpus num='8'>
<cpu id='0'>
<cpu id='2'>
<cpu id='4'>
<cpu id='6'>
<cpu id='8'>
<cpu id='10'>
<cpu id='12'>
<cpu id='14'>
</cpus>
</cell>
<cell id='1'>
<cpus num='8'>
<cpu id='1'>
<cpu id='3'>
<cpu id='5'>
<cpu id='7'>
<cpu id='9'>
<cpu id='11'>
<cpu id='13'>
<cpu id='15'>
</cpus>
</cell>
</cells>
</topology>
</host>
<guest>
<os_type>linux</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<domain type='test'>
</domain>
</arch>
<features>
<pae/>
<nonpae/>
</features>
</guest>
</capabilities>
16 years, 10 months
[Libvir] fix another bug exposed by a compiler warning
by Jim Meyering
Correct a no-op conditional.
* src/qemu_conf.c (qemudReportError): Reverse a test, and use the
pointer, errorMessage not its first byte, errorMessage[0].
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
src/qemu_conf.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index eead0bc..3877849 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -68,7 +68,7 @@ void qemudReportError(virConnectPtr conn,
errorMessage[0] = '\0';
}
- virerr = __virErrorMsg(code, (errorMessage[0] ? errorMessage[0] : NULL));
+ virerr = __virErrorMsg(code, (!errorMessage[0] ? errorMessage : NULL));
__virRaiseError(conn, dom, net, VIR_FROM_QEMU, code, VIR_ERR_ERROR,
virerr, errorMessage, NULL, -1, -1, virerr, errorMessage);
}
--
1.5.4.3.366.g55277
16 years, 10 months
[Libvir] [PATCH] Plug skipped-qemudCleanup leak.
by Jim Meyering
And another:
Plug skipped-qemudCleanup leak.
* qemud/qemud.c (main): Call qemudCleanup also upon failure.
Otherwise, an error return would skip it and induce leaks.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
ChangeLog | 6 ++++++
qemud/qemud.c | 3 +--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 049f515..81452ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-03-03 Jim Meyering <meyering(a)redhat.com>
+
+ Plug skipped-qemudCleanup leak.
+ * qemud/qemud.c (main): Call qemudCleanup also upon failure.
+ Otherwise, an error return would skip it and induce leaks.
+
Mon Mar 3 07:16:35 CET 2008 Daniel Veillard <veillard(a)redhat.com>
* include/libvirt/libvirt.h include/libvirt/libvirt.h.in:
diff --git a/qemud/qemud.c b/qemud/qemud.c
index 851e83e..7ccc9ee 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -2166,8 +2166,6 @@ int main(int argc, char **argv) {
qemudRunLoop(server);
- qemudCleanup(server);
-
close(sigwrite);
if (godaemon)
@@ -2181,6 +2179,7 @@ int main(int argc, char **argv) {
unlink (pid_file);
error1:
+ qemudCleanup(server);
return ret;
}
--
1.5.4.3.366.g55277
16 years, 10 months