On 01/18/2011 10:31 AM, Daniel P. Berrange wrote:
The driver table only has 10 slots, but there are potentially
11 drivers that need activating. Improve the error message
when driver registration fails
* src/libvirt.c: Increase driver table size & improve errors
---
src/libvirt.c | 34 +++++++++++++++++++++++++---------
1 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index d47afbe..f09e229 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -79,7 +79,7 @@
* - use reference counting to guarantee coherent pointer state ?
*/
-#define MAX_DRIVERS 10
+#define MAX_DRIVERS 20
static virDriverPtr virDriverTab[MAX_DRIVERS];
static int virDriverTabCount = 0;
@@ -523,7 +523,9 @@ virRegisterNetworkDriver(virNetworkDriverPtr driver)
}
if (virNetworkDriverTabCount >= MAX_DRIVERS) {
- virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virLibConnError(VIR_ERR_INTERNAL_ERROR,
+ _("Too many drivers, cannot register %s"),
+ driver->name);
ACK. I guess we may someday want to consider dynamically allocating the
table, rather than a hard-coded size, but drivers aren't added all that
frequently, and this patch is definitely an improvement.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org