[libvirt] [RFC 5/5]: Rewrite findLuns function
by Chris Lalancette
This rather large patch rewrites the virStorageBackendISCSIFindLUNs() function
to only rely on sysfs for finding LUNs, given a session number. Along the way,
it also fixes the bug where we wouldn't find LUNs for older kernels (with the
block:sda format), and also (possibly) fixes a race condition where we could try
to find the LUN before udev has finished connecting it. I say it "possibly"
fixes it because I haven't been able to hit it so far, but I definitely need
more testing to try and confirm.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
16 years, 5 months
[libvirt] [RFC 3/5]: Fix up the call to iscsiadm --mode session
by Chris Lalancette
Older versions of iscsiadm didn't support the "-P 0" flag to the "iscsiadm
--mode session" command. However, just running "iscsiadm --mode session" seems
to work on all version of iscsiadm commands back to FC-6, so just use that.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
16 years, 5 months
[libvirt] [RFC 2/5]: Cleanup carriage returns in util.c
by Chris Lalancette
In src/util.c, virLog is just a wrapper around fprintf(stderr). Make sure to
put line breaks at the end of lines that use virLog() (noticed during testing).
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
16 years, 5 months
[libvirt] [RFC 1/5]: Return exitstatus from virStorageBackendRunProgRegex
by Chris Lalancette
This patch changes things around so that virStorageBackendRunProgRegex() does
*not* virStorageReportError() if the fork()/exec() process it spawned returned a
!= 0 exit code. Rather, it returns the exitcode in this case, and it is up to
the higher level to determine whether this is a fatal error or not. The use
case for this change is in the iSCSI stuff; older versions of iscsiadm tools
would return a failure when getting the session number, despite the command
succeeding.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
16 years, 5 months
[libvirt] [RFC 0/5]: Fix up iSCSI handling (again)
by Chris Lalancette
All,
I've been sitting on this for way too long, so I'm sending these patches
out for some initial review while I continue to test them. The following 5
patches rework the iSCSI LUN scanning again. The aim here is to:
1) Do minor cleanup of the existing code
2) Fix a bug where we aren't properly finding the LUNs on pre 2.6.24 kernels
3) Fix a bug seen in oVirt where we race between libvirtd scanning the sysfs
path and udev actually making the sysfs path in the first place
4) Further lessen our dependence on direct calls to iscsiadm, in case they
change the output in the future.
I've started testing this patchset against a variety of Fedora's, old and new.
Anything older than FC-6 is a lost cause; either it doesn't have iSCSI stuff
(FC-1 through FC-4), or the iscsi stuff it has is so radically different that
it's basically a different commandset (RHEL-4 and FC-5). In some light testing,
though, this patchset seems to work on FC-6, F-7, F-8, and F-9 (RHEL-5 still to
be tested).
As Dan mentioned earlier, I have collected output from the relevant iscsiadm
commands so that we can build our own fake iscsiadm in tests; I'll be working on
that test as well as continuing to test these patches against live iSCSI targets.
Note that this patchset is not to be applied yet; I've only lightly tested it so
far. I'd just like to see what people think about all of this.
Chris Lalancette
16 years, 5 months
[libvirt] PATCH: Fix misc compile warnings
by Daniel P. Berrange
Enabling a bunch of non-default configure options shows some compiler
warnings. This patch fixes them
Daniel
Index: src/lxc_driver.c
===================================================================
RCS file: /data/cvs/libvirt/src/lxc_driver.c,v
retrieving revision 1.11
diff -u -p -r1.11 lxc_driver.c
--- src/lxc_driver.c 9 Jun 2008 22:51:32 -0000 1.11
+++ src/lxc_driver.c 12 Jun 2008 11:19:09 -0000
@@ -1202,6 +1202,8 @@ static virDriver lxcDriver = {
NULL, /* domainMigrateFinish */
NULL, /* domainBlockStats */
NULL, /* domainInterfaceStats */
+ NULL, /* domainBlockPeek */
+ NULL, /* domainMemoryPeek */
NULL, /* nodeGetCellsFreeMemory */
NULL, /* getFreeMemory */
};
Index: src/openvz_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/openvz_conf.c,v
retrieving revision 1.24
diff -u -p -r1.24 openvz_conf.c
--- src/openvz_conf.c 6 Jun 2008 11:09:57 -0000 1.24
+++ src/openvz_conf.c 12 Jun 2008 11:19:09 -0000
@@ -41,13 +41,14 @@
#include <unistd.h>
#include <limits.h>
#include <errno.h>
+#include <string.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/uri.h>
-#include "libvirt/virterror.h"
+#include "internal.h"
#include "openvz_driver.h"
#include "openvz_conf.h"
@@ -55,8 +56,6 @@
#include "buf.h"
#include "memory.h"
-#include <string.h>
-
static char *openvzLocateConfDir(void);
static void error (virConnectPtr conn, virErrorNumber code, const char *info);
static struct openvz_vm_def *openvzParseXML(virConnectPtr conn, xmlDocPtr xml);
Index: src/openvz_driver.c
===================================================================
RCS file: /data/cvs/libvirt/src/openvz_driver.c,v
retrieving revision 1.21
diff -u -p -r1.21 openvz_driver.c
--- src/openvz_driver.c 6 Jun 2008 11:09:57 -0000 1.21
+++ src/openvz_driver.c 12 Jun 2008 11:19:09 -0000
@@ -761,6 +761,8 @@ static virDriver openvzDriver = {
NULL, /* domainMigrateFinish */
NULL, /* domainBlockStats */
NULL, /* domainInterfaceStats */
+ NULL, /* domainBlockPeek */
+ NULL, /* domainMemoryPeek */
NULL, /* nodeGetCellsFreeMemory */
NULL, /* nodeGetFreeMemory */
};
@@ -770,6 +772,7 @@ static virStateDriver openvzStateDriver
openvzShutdown,
openvzReload,
openvzActive,
+ NULL, /* sigHandler */
};
int openvzRegister(void) {
Index: tests/testutils.c
===================================================================
RCS file: /data/cvs/libvirt/tests/testutils.c,v
retrieving revision 1.16
diff -u -p -r1.16 testutils.c
--- tests/testutils.c 29 May 2008 19:41:40 -0000 1.16
+++ tests/testutils.c 12 Jun 2008 11:19:09 -0000
@@ -329,10 +329,7 @@ int virtTestMain(int argc,
int oomCount;
if ((debugStr = getenv("VIR_TEST_DEBUG")) != NULL) {
- if (virStrToLong_i(debugStr, NULL, 10, &testDebug) < 0)
- testDebug = 0;
-
- if (testDebug < 0)
+ if (virStrToLong_ui(debugStr, NULL, 10, &testDebug) < 0)
testDebug = 0;
}
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
16 years, 5 months
[libvirt] PATCH: Fix call to save iptables rules
by Daniel P. Berrange
When the virtual network forwarding support was introduced, the refactoring
appears to have caused the call to save iptables rules to be left out. This
patch fixes it.
Daniel.
Index: src/qemu_driver.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_driver.c,v
retrieving revision 1.86
diff -u -p -r1.86 qemu_driver.c
--- src/qemu_driver.c 12 Jun 2008 08:55:13 -0000 1.86
+++ src/qemu_driver.c 12 Jun 2008 11:18:58 -0000
@@ -1259,7 +1259,7 @@ qemudAddIptablesRules(virConnectPtr conn
if (!driver->iptables && !(driver->iptables = iptablesContextNew())) {
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
"%s", _("failed to allocate space for IP tables support"));
- return 1;
+ return 0;
}
@@ -1319,23 +1319,22 @@ qemudAddIptablesRules(virConnectPtr conn
}
- /* The remaining rules are only needed for IP forwarding */
- if (!network->def->forward) {
- iptablesSaveRules(driver->iptables);
- return 1;
+ if (network->def->forward) {
+ /* If masquerading is enabled, set up the rules*/
+ if (network->def->forwardMode == QEMUD_NET_FORWARD_NAT &&
+ !qemudAddMasqueradingIptablesRules(conn, driver, network))
+ goto err8;
+ /* else if routing is enabled, set up the rules*/
+ else if (network->def->forwardMode == QEMUD_NET_FORWARD_ROUTE &&
+ !qemudAddRoutingIptablesRules(conn, driver, network))
+ goto err8;
}
- /* If masquerading is enabled, set up the rules*/
- if (network->def->forwardMode == QEMUD_NET_FORWARD_NAT) {
- if (qemudAddMasqueradingIptablesRules(conn, driver, network))
- return 1;
- }
- /* else if routing is enabled, set up the rules*/
- else if (network->def->forwardMode == QEMUD_NET_FORWARD_ROUTE) {
- if (qemudAddRoutingIptablesRules(conn, driver, network))
- return 1;
- }
+ iptablesSaveRules(driver->iptables);
+
+ return 1;
+ err8:
iptablesRemoveForwardAllowCross(driver->iptables,
network->bridge);
err7:
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
16 years, 5 months
[libvirt] qemudDomainSetMemory() / qemudDomainSetVcpus() error codes
by Kaitlin Rupert
Hello,
I noticed qemudDomainSetMemory() / qemudDomainSetVcpus() use the
VIR_ERR_INTERNAL_ERROR error code when the caller attempts to set the
mem/vcpus of an active domain.
In this case, returning something like VIR_ERR_NO_SUPPORT would indicate
that this is an invalid call - which would distinguish the error from a
failure that occurred during the call.
Is it possible to use such a return code to indicate what is supported
by QEMU/KVM and what isn't?
Thanks!
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com
16 years, 5 months
[libvirt] [PATCH] Fix storage pool autostart python binding
by Cole Robinson
The attached patch fixes a few issues with the storage api
python bindings. The pool GetAutostart is now generated as
intended. Also the libvirtError class now accepts the pool
or vol object passed to it when a command fails.
Thanks,
Cole
diff --git a/python/libvir.py b/python/libvir.py
index 3a38898..784152a 100644
--- a/python/libvir.py
+++ b/python/libvir.py
@@ -15,13 +15,17 @@ import types
# The root of all libvirt errors.
class libvirtError(Exception):
- def __init__(self, msg, conn=None, dom=None, net=None):
+ def __init__(self, msg, conn=None, dom=None, net=None, pool=None, vol=None):
Exception.__init__(self, msg)
if dom is not None:
conn = dom._conn
elif net is not None:
conn = net._conn
+ elif pool is not None:
+ conn = pool._conn
+ elif vol is not None:
+ conn = vol._conn
if conn is None:
self.err = virGetLastError()
diff --git a/python/libvirt-python-api.xml b/python/libvirt-python-api.xml
index da643d7..f3b82fc 100644
--- a/python/libvirt-python-api.xml
+++ b/python/libvirt-python-api.xml
@@ -83,6 +83,11 @@
<return type='int' info='the autostart flag, or None in case of error'/>
<arg name='domain' type='virDomainPtr' info='a network object'/>
</function>
+ <function name='virStoragePoolGetAutostart' file='python'>
+ <info>Extract the autostart flag for a storage pool</info>
+ <return type='int' info='the autostart flag, or None in case of error'/>
+ <arg name='pool' type='virStoragePoolPtr' info='a storage pool object'/>
+ </function>
<function name='virDomainBlockStats' file='python'>
<info>Extracts block device statistics for a domain</info>
<return type='virDomainBlockStats' info='a tuple of statistics'/>
16 years, 5 months