[libvirt] [PATCH 0/2] gnulib update
by Eric Blake
The latest gnulib update accidentally reintroduced -Wformat-nonliteral
(by virtue of adding -Wformat=2, understood only by newer gcc), I
almost got sucked into the rathole of fixing all our problems before
I realized the real issue, but by then, I had already written patch 1.
I'd like to get this in before the freeze, and then (hopefully) not
touch .gnulib until after the release (we've been burned too many
times by a .gnulib update after rc1).
Eric Blake (2):
error: drop old-style error reporting
build: import latest gnulib, for mingw and syntax-check fixes
.gnulib | 2 +-
gnulib/local/lib/openpty.c.diff | 26 ------
gnulib/local/lib/pty.in.h.diff | 13 ---
m4/virt-compile-warnings.m4 | 8 ++-
src/fdstream.c | 2 +-
src/libvirt_private.syms | 1 -
src/qemu/qemu_monitor.c | 2 +-
src/qemu/qemu_monitor_json.c | 2 +-
src/util/conf.c | 22 ++---
src/util/virterror.c | 2 +-
src/util/virterror_internal.h | 8 --
src/xen/xen_hypervisor.c | 170 ++++++++++++++++-----------------------
src/xenapi/xenapi_utils.c | 2 +-
tests/testutils.c | 4 +-
tools/virsh.c | 12 ++--
15 files changed, 98 insertions(+), 178 deletions(-)
delete mode 100644 gnulib/local/lib/openpty.c.diff
delete mode 100644 gnulib/local/lib/pty.in.h.diff
--
1.7.7.3
12 years, 11 months
[libvirt] libvirt-php 0.4.5 and php 5.4
by Remi Collet
Hi,
I'm working on updating PHP to 5.4.0 (probably a fedora 17 feature).
libvirt 0.4.5 doesn't build because function_entry have been removed
See http://news.php.net/php.pecl.dev/7123
Fix is trivial :
s/function_entry/zend_function_entry/
Attcached patch solves this issue and also fixes a lot of compiler
warning (unused variable, unset, ...)
There is still a lot of warning... (most are trivial to fix)
I Hope this helps.
Remi.
P.S. Here is the full log (with -Wall)
Making all in src
make[3]: Entering directory `/dev/shm/libvirt-php-0.4.5/src'
gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic
-DCOMPILE_DL_LIBVIRT=1 -I/usr/include/php -I/usr/include/php/main
-I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext
-I/usr/include/php/ext/date/lib -c -o libvirt-php.o libvirt-php.c
-I/usr/include/libxml2 -DHAVE_CONFIG_H
rm -f *.o
libvirt-php.c: In function 'zif_libvirt_domain_send_keys':
libvirt-php.c:3002:2: warning: pointer targets in passing argument 3 of
'vnc_send_keys' differ in signedness [-Wpointer-sign]
libvirt-php.h:200:5: note: expected 'unsigned char *' but argument is of
type 'char *'
libvirt-php.c: In function 'zif_libvirt_image_create':
libvirt-php.c:1674:8: warning: ignoring return value of 'system',
declared with attribute warn_unused_result [-Wunused-result]
gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic
-DCOMPILE_DL_LIBVIRT=1 -c -o vncfunc.o vncfunc.c -I/usr/include/php
-I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend
-I/usr/include/php/ext -I/usr/include/php/ext/date/lib
-I/usr/include/libxml2 -DHAVE_CONFIG_H
vncfunc.c: In function 'vnc_parse_fb_params':
vncfunc.c:178:2: warning: pointer targets in passing argument 1 of
'strlen' differ in signedness [-Wpointer-sign]
/usr/include/string.h:399:15: note: expected 'const char *' but argument
is of type 'unsigned char *'
vncfunc.c:178:2: warning: pointer targets in passing argument 1 of
'__strdup' differ in signedness [-Wpointer-sign]
/usr/include/bits/string2.h:1303:14: note: expected 'const char *' but
argument is of type 'unsigned char *'
vncfunc.c:178:21: warning: pointer targets in assignment differ in
signedness [-Wpointer-sign]
vncfunc.c:141:17: warning: unused variable 'name' [-Wunused-variable]
vncfunc.c:139:6: warning: unused variable 'i' [-Wunused-variable]
vncfunc.c: In function 'vnc_send_key':
vncfunc.c:205:6: warning: unused variable 'i' [-Wunused-variable]
vncfunc.c: In function 'vnc_connect':
vncfunc.c:438:2: warning: implicit declaration of function
'connect_socket' [-Wimplicit-function-declaration]
vncfunc.c: In function 'vnc_get_dimensions':
vncfunc.c:511:2: warning: pointer targets in passing argument 1 of
'vnc_parse_fb_params' differ in signedness [-Wpointer-sign]
vncfunc.c:137:17: note: expected 'unsigned char *' but argument is of
type 'char *'
vncfunc.c:525:2: warning: implicit declaration of function
'socket_has_data' [-Wimplicit-function-declaration]
vncfunc.c:526:3: warning: implicit declaration of function 'socket_read'
[-Wimplicit-function-declaration]
vncfunc.c:484:20: warning: unused variable 'err' [-Wunused-variable]
vncfunc.c:484:9: warning: unused variable 'skip_next' [-Wunused-variable]
vncfunc.c:484:6: warning: unused variable 'i' [-Wunused-variable]
vncfunc.c: In function 'vnc_send_keys':
vncfunc.c:569:2: warning: pointer targets in passing argument 1 of
'vnc_parse_fb_params' differ in signedness [-Wpointer-sign]
vncfunc.c:137:17: note: expected 'unsigned char *' but argument is of
type 'char *'
vncfunc.c:572:2: warning: pointer targets in passing argument 1 of
'strlen' differ in signedness [-Wpointer-sign]
/usr/include/string.h:399:15: note: expected 'const char *' but argument
is of type 'unsigned char *'
vncfunc.c:572:2: warning: format '%d' expects argument of type 'int',
but argument 5 has type 'size_t' [-Wformat]
vncfunc.c:573:2: warning: pointer targets in passing argument 1 of
'strlen' differ in signedness [-Wpointer-sign]
/usr/include/string.h:399:15: note: expected 'const char *' but argument
is of type 'unsigned char *'
vncfunc.c:580:3: warning: pointer targets in passing argument 1 of
'strlen' differ in signedness [-Wpointer-sign]
/usr/include/string.h:399:15: note: expected 'const char *' but argument
is of type 'unsigned char *'
vncfunc.c:600:2: warning: pointer targets in passing argument 1 of
'strlen' differ in signedness [-Wpointer-sign]
/usr/include/string.h:399:15: note: expected 'const char *' but argument
is of type 'unsigned char *'
vncfunc.c:600:2: warning: format '%d' expects argument of type 'int',
but argument 4 has type 'size_t' [-Wformat]
vncfunc.c:547:20: warning: unused variable 'err' [-Wunused-variable]
vncfunc.c: In function 'vnc_send_pointer_event':
vncfunc.c:627:16: warning: unused variable 'end' [-Wunused-variable]
vncfunc.c:625:26: warning: unused variable 'err' [-Wunused-variable]
vncfunc.c:625:22: warning: unused variable 'ok' [-Wunused-variable]
vncfunc.c:625:19: warning: unused variable 'i' [-Wunused-variable]
vncfunc.c:625:11: warning: unused variable 'j' [-Wunused-variable]
vncfunc.c: In function 'vnc_refresh_screen':
vncfunc.c:697:20: warning: unused variable 'err' [-Wunused-variable]
vncfunc.c:697:9: warning: unused variable 'skip_next' [-Wunused-variable]
vncfunc.c:697:6: warning: unused variable 'i' [-Wunused-variable]
In file included from /usr/include/string.h:642:0,
from /usr/include/php/main/../main/php_config.h:2440,
from /usr/include/php/Zend/zend_config.h:1,
from /usr/include/php/Zend/zend.h:51,
from /usr/include/php/main/php.h:34,
from libvirt-php.h:44,
from vncfunc.c:10:
In function 'memset',
inlined from 'vnc_send_client_pointer' at vncfunc.c:252:8:
/usr/include/bits/string3.h:85:3: warning: call to
__builtin___memset_chk will always overflow destination buffer [enabled
by default]
gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic
-DCOMPILE_DL_LIBVIRT=1 -c -o sockets.o sockets.c -I/usr/include/php
-I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend
-I/usr/include/php/ext -I/usr/include/php/ext/date/lib
-I/usr/include/libxml2 -DHAVE_CONFIG_H
sockets.c: In function 'socket_has_data':
sockets.c:118:10: warning: unused variable 'result' [-Wunused-variable]
sockets.c: In function 'socket_read':
sockets.c:177:7: warning: ignoring return value of 'read', declared with
attribute warn_unused_result [-Wunused-result]
gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -shared
-lvirt -rdynamic -o libvirt-php.so vncfunc.o sockets.o libvirt-php.o
-ldl -lvirt -lxml2
echo "Extension compiled as libvirt-php.so"
Extension compiled as libvirt-php.so
12 years, 11 months
[libvirt] [libvirt-glib 1/2] Wrap storage pool info API
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
---
libvirt-gobject/libvirt-gobject-storage-pool.c | 44 ++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-storage-pool.h | 21 +++++++++++
libvirt-gobject/libvirt-gobject.sym | 2 +
3 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
index da8ada5..3c30a3d 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.c
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
@@ -189,6 +189,21 @@ gvir_storage_pool_handle_free(GVirStoragePoolHandle *src)
G_DEFINE_BOXED_TYPE(GVirStoragePoolHandle, gvir_storage_pool_handle,
gvir_storage_pool_handle_copy, gvir_storage_pool_handle_free)
+static GVirStoragePoolInfo *
+gvir_storage_pool_info_copy(GVirStoragePoolInfo *info)
+{
+ return g_slice_dup(GVirStoragePoolInfo, info);
+}
+
+static void
+gvir_storage_pool_info_free(GVirStoragePoolInfo *info)
+{
+ g_slice_free(GVirStoragePoolInfo, info);
+}
+
+G_DEFINE_BOXED_TYPE(GVirStoragePoolInfo, gvir_storage_pool_info,
+ gvir_storage_pool_info_copy, gvir_storage_pool_info_free)
+
const gchar *gvir_storage_pool_get_name(GVirStoragePool *pool)
{
GVirStoragePoolPrivate *priv = pool->priv;
@@ -237,6 +252,35 @@ GVirConfigStoragePool *gvir_storage_pool_get_config(GVirStoragePool *pool,
return conf;
}
+/**
+ * gvir_storage_pool_get_info:
+ * @pool: the storage_pool
+ * Returns: (transfer full): the info
+ */
+GVirStoragePoolInfo *gvir_storage_pool_get_info(GVirStoragePool *pool,
+ GError **err)
+{
+ GVirStoragePoolPrivate *priv = pool->priv;
+ virStoragePoolInfo info;
+ GVirStoragePoolInfo *ret;
+
+ if (virStoragePoolGetInfo(priv->handle, &info) < 0) {
+ if (err)
+ *err = gvir_error_new_literal(GVIR_STORAGE_POOL_ERROR,
+ 0,
+ "Unable to get storage pool info");
+ return NULL;
+ }
+
+ ret = g_slice_new(GVirStoragePoolInfo);
+ ret->state = info.state;
+ ret->capacity = info.capacity;
+ ret->allocation = info.allocation;
+ ret->available = info.available;
+
+ return ret;
+}
+
typedef gint (* CountFunction) (virStoragePoolPtr vpool);
typedef gint (* ListFunction) (virStoragePoolPtr vpool, gchar **lst, gint max);
diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.h b/libvirt-gobject/libvirt-gobject-storage-pool.h
index d95bb19..436238b 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.h
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.h
@@ -36,6 +36,7 @@ G_BEGIN_DECLS
#define GVIR_IS_STORAGE_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_STORAGE_POOL))
#define GVIR_STORAGE_POOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_STORAGE_POOL, GVirStoragePoolClass))
+#define GVIR_TYPE_STORAGE_POOL_INFO (gvir_storage_pool_info_get_type())
#define GVIR_TYPE_STORAGE_POOL_HANDLE (gvir_storage_pool_handle_get_type())
typedef struct _GVirStoragePool GVirStoragePool;
@@ -58,8 +59,25 @@ struct _GVirStoragePoolClass
gpointer padding[20];
};
+typedef enum {
+ GVIR_STORAGE_POOL_STATE_INACTIVE = 0, /* Not running */
+ GVIR_STORAGE_POOL_STATE_BUILDING = 1, /* Initializing pool, not available */
+ GVIR_STORAGE_POOL_STATE_RUNNING = 2, /* Running normally */
+ GVIR_STORAGE_POOL_STATE_DEGRADED = 3, /* Running degraded */
+ GVIR_STORAGE_POOL_STATE_INACCESSIBLE = 4, /* Running, but not accessible */
+} GVirStoragePoolState;
+
+typedef struct _GVirStoragePoolInfo GVirStoragePoolInfo;
+struct _GVirStoragePoolInfo
+{
+ GVirStoragePoolState state; /* the state */
+ guint64 capacity; /* Logical size bytes */
+ guint64 allocation; /* Current allocation bytes */
+ guint16 available; /* Remaining free space bytes */
+};
GType gvir_storage_pool_get_type(void);
+GType gvir_storage_pool_info_get_type(void);
GType gvir_storage_pool_handle_get_type(void);
const gchar *gvir_storage_pool_get_name(GVirStoragePool *pool);
@@ -69,6 +87,9 @@ GVirConfigStoragePool *gvir_storage_pool_get_config(GVirStoragePool *pool,
guint flags,
GError **err);
+GVirStoragePoolInfo *gvir_storage_pool_get_info(GVirStoragePool *pool,
+ GError **err);
+
gboolean gvir_storage_pool_refresh(GVirStoragePool *pool,
GCancellable *cancellable,
GError **err);
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index 61a3a31..55c515b 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -91,10 +91,12 @@ LIBVIRT_GOBJECT_0.0.1 {
gvir_secret_get_config;
gvir_storage_pool_get_type;
+ gvir_storage_pool_info_get_type;
gvir_storage_pool_handle_get_type;
gvir_storage_pool_get_name;
gvir_storage_pool_get_uuid;
gvir_storage_pool_get_config;
+ gvir_storage_pool_get_info;
gvir_storage_pool_refresh;
gvir_storage_pool_refresh_async;
gvir_storage_pool_refresh_finish;
--
1.7.7.3
12 years, 11 months
[libvirt] [PATCH] virsh: Allow other escape characters for console
by Michal Privoznik
Currently virsh supports only ^] as escape character for console.
However, some users might want to use something else. This patch
creates such ability by specifying '-e' switch on virsh command
line.
---
Okay, this patch is meant as RFC mainly but if it got enough ACKs
I will not hesitate to push it. My biggest concern is the way
of telling virsh customized sequence. I am not big fan of new switch,
however we lack virsh.conf in $conf_dir. Maybe it is the right time
for creating it.
Another approach is to pass the sequence as parameter directly to
'console' command.
What's your opinion?
tools/console.c | 28 +++++++++++++++++++++++-----
tools/console.h | 4 +++-
tools/virsh.c | 20 ++++++++++++++++----
tools/virsh.pod | 5 +++++
4 files changed, 47 insertions(+), 10 deletions(-)
diff --git a/tools/console.c b/tools/console.c
index 0f85bc7..db2e17e 100644
--- a/tools/console.c
+++ b/tools/console.c
@@ -43,9 +43,13 @@
# include "memory.h"
# include "virterror_internal.h"
-
-/* ie Ctrl-] as per telnet */
-# define CTRL_CLOSE_BRACKET '\35'
+/*
+ * Convert given character to control character.
+ * Basically, we take lower 5 bits unless given
+ * character is DEL (represented by '?'). Then
+ * we return 127
+ */
+# define CONTROL(c) ((c) == '?' ? ((c) | 0x40) : ((c) & 0x1f))
# define VIR_FROM_THIS VIR_FROM_NONE
@@ -66,6 +70,8 @@ struct virConsole {
struct virConsoleBuffer streamToTerminal;
struct virConsoleBuffer terminalToStream;
+
+ char escapeChar;
};
static int got_signal = 0;
@@ -215,7 +221,7 @@ virConsoleEventOnStdin(int watch ATTRIBUTE_UNUSED,
virConsoleShutdown(con);
return;
}
- if (con->terminalToStream.data[con->terminalToStream.offset] == CTRL_CLOSE_BRACKET) {
+ if (con->terminalToStream.data[con->terminalToStream.offset] == con->escapeChar) {
virConsoleShutdown(con);
return;
}
@@ -278,7 +284,18 @@ virConsoleEventOnStdout(int watch ATTRIBUTE_UNUSED,
}
-int vshRunConsole(virDomainPtr dom, const char *dev_name)
+static char
+vshGetEscapeChar(const char *s)
+{
+ if (*s == '^')
+ return CONTROL(s[1]);
+
+ return *s;
+}
+
+int vshRunConsole(virDomainPtr dom,
+ const char *dev_name,
+ const char *escape_seq)
{
int ret = -1;
struct termios ttyattr, rawattr;
@@ -326,6 +343,7 @@ int vshRunConsole(virDomainPtr dom, const char *dev_name)
goto cleanup;
}
+ con->escapeChar = vshGetEscapeChar(escape_seq);
con->st = virStreamNew(virDomainGetConnect(dom),
VIR_STREAM_NONBLOCK);
if (!con->st)
diff --git a/tools/console.h b/tools/console.h
index 9b05ff1..8cca08f 100644
--- a/tools/console.h
+++ b/tools/console.h
@@ -25,7 +25,9 @@
# ifndef WIN32
-int vshRunConsole(virDomainPtr dom, const char *dev_name);
+int vshRunConsole(virDomainPtr dom,
+ const char *dev_name,
+ const char *escape_seq);
# endif /* !WIN32 */
diff --git a/tools/virsh.c b/tools/virsh.c
index 89fb4e7..1b84980 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -75,6 +75,9 @@ static char *progname;
((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0 + \
((int) ((T)->tv_usec - (U)->tv_usec))) / 1000.0)
+/* Default escape char Ctrl-] as per telnet */
+#define CTRL_CLOSE_BRACKET "^]"
+
/**
* The log configuration
*/
@@ -249,6 +252,7 @@ typedef struct __vshControl {
virDomainGetState is not supported */
bool useSnapshotOld; /* cannot use virDomainSnapshotGetParent or
virDomainSnapshotNumChildren */
+ const char *escapeChar; /* Escape character for domain console */
} __vshControl;
typedef struct vshCmdGrp {
@@ -796,8 +800,8 @@ cmdRunConsole(vshControl *ctl, virDomainPtr dom, const char *name)
}
vshPrintExtra(ctl, _("Connected to domain %s\n"), virDomainGetName(dom));
- vshPrintExtra(ctl, "%s", _("Escape character is ^]\n"));
- if (vshRunConsole(dom, name) == 0)
+ vshPrintExtra(ctl, _("Escape character is %s\n"), ctl->escapeChar);
+ if (vshRunConsole(dom, name, ctl->escapeChar) == 0)
ret = true;
cleanup:
@@ -16817,6 +16821,7 @@ vshDeinit(vshControl *ctl)
vshReadlineDeinit(ctl);
vshCloseLogFile(ctl);
VIR_FREE(ctl->name);
+ VIR_FREE(ctl->escapeChar);
if (ctl->conn) {
int ret;
if ((ret = virConnectClose(ctl->conn)) != 0) {
@@ -16848,7 +16853,8 @@ vshUsage(void)
" -t | --timing print timing information\n"
" -l | --log <file> output logging to file\n"
" -v | --version[=short] program version\n"
- " -V | --version=long version and full options\n\n"
+ " -V | --version=long version and full options\n"
+ " -e | --escape <char> set escape sequence for console\n\n"
" commands (non interactive mode):\n\n"), progname, progname);
for (grp = cmdGroups; grp->name; grp++) {
@@ -17009,13 +17015,14 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
{"connect", required_argument, NULL, 'c'},
{"readonly", no_argument, NULL, 'r'},
{"log", required_argument, NULL, 'l'},
+ {"escape", required_argument, NULL, 'e'},
{NULL, 0, NULL, 0}
};
/* Standard (non-command) options. The leading + ensures that no
* argument reordering takes place, so that command options are
* not confused with top-level virsh options. */
- while ((arg = getopt_long(argc, argv, "+d:hqtc:vVrl:", opt, NULL)) != -1) {
+ while ((arg = getopt_long(argc, argv, "+d:hqtc:vVrl:e:", opt, NULL)) != -1) {
switch (arg) {
case 'd':
if (virStrToLong_i(optarg, NULL, 10, &ctl->debug) < 0) {
@@ -17050,6 +17057,9 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
case 'l':
ctl->logfile = vshStrdup(ctl, optarg);
break;
+ case 'e':
+ ctl->escapeChar = vshStrdup(ctl, optarg);
+ break;
default:
vshError(ctl, _("unsupported option '-%c'. See --help."), arg);
exit(EXIT_FAILURE);
@@ -17091,6 +17101,8 @@ main(int argc, char **argv)
ctl->imode = true; /* default is interactive mode */
ctl->log_fd = -1; /* Initialize log file descriptor */
ctl->debug = VSH_DEBUG_DEFAULT;
+ ctl->escapeChar = vshStrdup(ctl, CTRL_CLOSE_BRACKET);
+
if (!setlocale(LC_ALL, "")) {
perror("setlocale");
diff --git a/tools/virsh.pod b/tools/virsh.pod
index db872dd..08b761d 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -92,6 +92,11 @@ option of the B<connect> command.
Output elapsed time information for each command.
+=item B<-e>, B<--escape> I<string>
+
+Set alternative escape sequence for I<console> command. By default,
+telnet's ^] is used.
+
=back
=head1 NOTES
--
1.7.3.4
12 years, 11 months
[libvirt] [PATCH] bridge_driver: Don't define network if XML contains more IPv4 adreses.
by Peter Krempa
Only one IPv4 DHCP definition is supported. Originaly the code checked
for a multiple definition and returned an error, but the new domain
definition was already added to networks. This patch moves the check
before the newly defined network is added to active networks.
*src/network/bridge_driver.c: networkDefine(): - move multiple IPv4
adresses check before
definition is used.
---
src/network/bridge_driver.c | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index c49c25b..0c1563a 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2261,70 +2261,71 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char *xml) {
if (!(def = virNetworkDefParseString(xml)))
goto cleanup;
if (virNetworkObjIsDuplicate(&driver->networks, def, 0) < 0)
goto cleanup;
/* Only the three L3 network types that are configured by libvirt
* need to have a bridge device name / mac address provided
*/
if (def->forwardType == VIR_NETWORK_FORWARD_NONE ||
def->forwardType == VIR_NETWORK_FORWARD_NAT ||
def->forwardType == VIR_NETWORK_FORWARD_ROUTE) {
if (virNetworkSetBridgeName(&driver->networks, def, 1))
goto cleanup;
virNetworkSetBridgeMacAddr(def);
}
- if (!(network = virNetworkAssignDef(&driver->networks,
- def)))
- goto cleanup;
- freeDef = false;
-
- network->persistent = 1;
-
- if (virNetworkSaveConfig(driver->networkConfigDir, def) < 0) {
- virNetworkRemoveInactive(&driver->networks, network);
- network = NULL;
- goto cleanup;
- }
-
/* We only support dhcp on one IPv4 address per defined network */
for (ii = 0;
(ipdef = virNetworkDefGetIpByIndex(def, AF_UNSPEC, ii));
ii++) {
if (VIR_SOCKET_ADDR_IS_FAMILY(&ipdef->address, AF_INET)) {
if (ipdef->nranges || ipdef->nhosts) {
if (ipv4def) {
networkReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("Multiple dhcp sections found. dhcp is supported only for a single IPv4 address on each network"));
goto cleanup;
} else {
ipv4def = ipdef;
}
}
}
}
- if (ipv4def) {
+
+ if (!(network = virNetworkAssignDef(&driver->networks,
+ def)))
+ goto cleanup;
+ freeDef = false;
+
+ network->persistent = 1;
+
+ if (virNetworkSaveConfig(driver->networkConfigDir, def) < 0) {
+ virNetworkRemoveInactive(&driver->networks, network);
+ network = NULL;
+ goto cleanup;
+ }
+
+ if (ipv4def) {
dctx = dnsmasqContextNew(def->name, DNSMASQ_STATE_DIR);
if (dctx == NULL ||
networkBuildDnsmasqHostsfile(dctx, ipv4def, def->dns) < 0 ||
dnsmasqSave(dctx) < 0)
goto cleanup;
}
VIR_INFO("Defining network '%s'", def->name);
ret = virGetNetwork(conn, def->name, def->uuid);
cleanup:
if (freeDef)
virNetworkDefFree(def);
dnsmasqContextFree(dctx);
if (network)
virNetworkObjUnlock(network);
networkDriverUnlock(driver);
return ret;
}
--
1.7.3.4
12 years, 11 months
[libvirt] [PATCHv6 0/7] block io throttle via per-device block IO tuning
by Eric Blake
Here's the latest state of Lei's patch series with all my comments
folded in. I may have a few more tweaks to make now that I'm at
the point of testing things with both old qemu (graceful rejection)
and new qemu (sensical return values), so it may be a day or two (or
even a weekend, since this is a holiday weekend for me) before I
actually push this, so it wouldn't hurt if anyone else wants to
review in the meantime.
Lei Li (7):
Add new API virDomain{Set, Get}BlockIoTune
Add virDomain{Set, Get}BlockIoTune support to the remote driver
Support block I/O throttle in XML
Implement virDomain{Set, Get}BlockIoTune for the qemu driver
Enable the blkdeviotune command in virsh
Support virDomain{Set, Get}BlockIoTune in the python API
Add tests for blkdeviotune
daemon/remote.c | 64 ++++
docs/formatdomain.html.in | 39 +++
docs/schemas/domaincommon.rng | 122 +++++--
include/libvirt/libvirt.h.in | 63 ++++
python/generator.py | 2 +
python/libvirt-override-api.xml | 16 +
python/libvirt-override.c | 178 ++++++++++
src/conf/domain_conf.c | 90 +++++-
src/conf/domain_conf.h | 14 +
src/driver.h | 20 ++
src/libvirt.c | 148 +++++++++
src/libvirt_public.syms | 6 +
src/qemu/qemu_command.c | 31 ++
src/qemu/qemu_driver.c | 340 ++++++++++++++++++++
src/qemu/qemu_monitor.c | 33 ++
src/qemu/qemu_monitor.h | 8 +
src/qemu/qemu_monitor_json.c | 176 ++++++++++
src/qemu/qemu_monitor_json.h | 8 +
src/qemu/qemu_monitor_text.c | 151 +++++++++-
src/qemu/qemu_monitor_text.h | 8 +
src/remote/remote_driver.c | 57 ++++
src/remote/remote_protocol.x | 27 ++-
src/remote_protocol-structs | 24 ++
.../qemuxml2argv-blkdeviotune.args | 7 +
.../qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml | 30 ++
tests/qemuxml2argvtest.c | 2 +
tests/qemuxml2xmltest.c | 1 +
tools/virsh.c | 244 ++++++++++++++
tools/virsh.pod | 30 ++
29 files changed, 1900 insertions(+), 39 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml
--
1.7.7.3
12 years, 11 months
[libvirt] [PATCH] spec: mark directories in /var/run as ghosts
by Eric Blake
We have several directories that are created on the fly, and which
only contain state relevant to a running libvirtd process (all
located in /var/run). Since the directories are created as needed,
and make no sense without a running libvirtd, we want them deleted
if libvirt is uninstalled. And in F15 and newer, /var/run is on
tmpfs (forcing us to recreate on the fly); which means that someone
trying to verify a complete rpm will fail if the directory does not
currently exist because libvirtd has not been started since boot.
The solution, then, is to mark the directories as %ghost, so that
rpm knows that we own them and will clean it up if libvirt is
uninstalled, but will no longer create the directory for us at
install, nor complain at verify time if the directory does not exist.
See https://bugzilla.redhat.com/show_bug.cgi?id=656611.
* libvirt.spec.in (%files): Add %ghost to temporary directories
that we don't install, but want cleaned up on libvirt removal.
---
libvirt.spec.in | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index f61a243..06c949b 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1082,7 +1082,7 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd
%{_datadir}/libvirt/networks/default.xml
%endif
-%dir %{_localstatedir}/run/libvirt/
+%ghost %dir %{_localstatedir}/run/libvirt/
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/images/
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/filesystems/
@@ -1090,24 +1090,24 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd
%dir %attr(0711, root, root) %{_localstatedir}/cache/libvirt/
%if %{with_qemu}
-%dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
+%ghost %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
%endif
%if %{with_lxc}
-%dir %{_localstatedir}/run/libvirt/lxc/
+%ghost %dir %{_localstatedir}/run/libvirt/lxc/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/lxc/
%endif
%if %{with_uml}
-%dir %{_localstatedir}/run/libvirt/uml/
+%ghost %dir %{_localstatedir}/run/libvirt/uml/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/uml/
%endif
%if %{with_libxl}
-%dir %{_localstatedir}/run/libvirt/libxl/
+%ghost %dir %{_localstatedir}/run/libvirt/libxl/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/
%endif
%if %{with_network}
-%dir %{_localstatedir}/run/libvirt/network/
+%ghost %dir %{_localstatedir}/run/libvirt/network/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/network/
%dir %attr(0755, root, root) %{_localstatedir}/lib/libvirt/dnsmasq/
%endif
--
1.7.7.3
12 years, 11 months
[libvirt] [PATCH 0/6] plug memory leaks
by ajia@redhat.com
From: Alex Jia <ajia(a)redhat.com>
Detected by Coverity.
Alex Jia (6):
src/conf/domain_conf.c: Plug memory leak on virDomainDefParseXML() error path
src/qemu/qemu_process.c: Plug memory leak on qemuProcessWaitForMonitor() error path
src/rpc/virnetclient.c: Plug memory leak on virNetClientSendInternal() error path
src/uml/uml_driver.c: Plug memory leak on umlStartVMDaemon() error path
src/util/virnetdevbridge.c: Plug memory leak on virNetDevBridgeGet() sucessful path
src/util/virnetdevmacvlan.c: Plug memory leak on virNetDevMacVLanCreateWithVPortProfile() error path
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/conf/domain_conf.c | 1 +
src/qemu/qemu_process.c | 1 +
src/rpc/virnetclient.c | 1 +
src/uml/uml_driver.c | 1 +
src/util/virnetdevbridge.c | 1 +
src/util/virnetdevmacvlan.c | 1 +
6 files changed, 6 insertions(+), 0 deletions(-)
12 years, 11 months
[libvirt] 'make check' hangs
by Wen Congyang
When I run 'make check', it hangs sometimes.
I use gdb to attach lt-virsh, and the following is the
backtrace:
(gdb) thread 1
[Switching to thread 1 (Thread 0x7fc6c04d5800 (LWP 24099))]#0 0x0000003bdce0804d in pthread_join () from /lib64/libpthread.so.0
(gdb) bt
#0 0x0000003bdce0804d in pthread_join () from /lib64/libpthread.so.0
#1 0x000000000041c0b3 in vshDeinit (ctl=0x7fff015f4570) at virsh.c:17262
#2 0x00000000004248d1 in main (argc=<value optimized out>, argv=0x7fff015f4728) at virsh.c:17608
(gdb) thread 2
[Switching to thread 2 (Thread 0x7fc6c04d4700 (LWP 24138))]#0 0x0000003bdc2dc053 in poll () from /lib64/libc.so.6
(gdb) bt
#0 0x0000003bdc2dc053 in poll () from /lib64/libc.so.6
#1 0x00007fc6c075359c in virEventPollRunOnce () at util/event_poll.c:619
#2 0x00007fc6c07527d7 in virEventRunDefaultImpl () at util/event.c:247
#3 0x000000000041bea3 in vshEventLoop (opaque=0x7fff015f4570) at virsh.c:16800
#4 0x00007fc6c0764702 in virThreadHelper (data=<value optimized out>) at util/threads-pthread.c:157
#5 0x0000003bdce077f1 in start_thread () from /lib64/libpthread.so.0
#6 0x0000003bdc2e570d in clone () from /lib64/libc.so.6
(gdb)
12 years, 11 months