[libvirt] [PATCH] python: Don't declare Py_ssize_t for Python 2.6
by Matthias Bolte
Commit cd48c3f4e95597 added a Py_ssize_t typedef for Python < 2.7.
But Py_ssize_t was added in Python 2.5. This makes the build fail
for Python 2.6.
Adjust the check to match Python < 2.5 to fix this.
---
python/typewrappers.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/python/typewrappers.h b/python/typewrappers.h
index 70c15d9..87ea1e5 100644
--- a/python/typewrappers.h
+++ b/python/typewrappers.h
@@ -22,7 +22,7 @@
#endif
/* Work around really old python. */
-#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 7
+#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5
typedef ssize_t Py_ssize_t;
#endif
--
1.7.0.4
13 years, 6 months
[libvirt] [PATCH] tests: Improve IPv6 detection for virNetSocket tests
by Matthias Bolte
getifaddrs can return an IPv6 address, but getaddrinfo can fail
for an IPv6 address. Cover this combination.
---
This is only tested on my system with broken IPv6. Could someone test this
on an IPv6 capable system and ensure that the IPv6 tests aren't skipped now
by running
cd tests
make virnetsockettest
PATH=`pwd`:$PATH LIBVIRT_DEBUG=1 ./virnetsockettest
This should print something like this
17:35:09.810: 4102: debug : checkProtocols:83 : Protocols: v4 1 v6 1
on an IPv6 capable system.
tests/virnetsockettest.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index f686a15..f6c7274 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -45,12 +45,16 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
int *freePort)
{
struct ifaddrs *ifaddr = NULL, *ifa;
+ struct addrinfo hints;
+ struct addrinfo *ai = NULL;
struct sockaddr_in in4;
struct sockaddr_in6 in6;
int s4 = -1, s6 = -1;
int i;
int ret = -1;
+ memset(&hints, 0, sizeof hints);
+
*hasIPv4 = *hasIPv6 = false;
*freePort = 0;
@@ -67,6 +71,15 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
*hasIPv6 = true;
}
+ hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
+ hints.ai_family = AF_INET6;
+ hints.ai_socktype = SOCK_STREAM;
+
+ if (getaddrinfo("::1", "5672", &hints, &ai) != 0)
+ *hasIPv6 = false;
+
+ freeaddrinfo(ai);
+
VIR_DEBUG("Protocols: v4 %d v6 %d\n", *hasIPv4, *hasIPv6);
freeifaddrs(ifaddr);
--
1.7.0.4
13 years, 6 months
[libvirt] [PATCH] Move load of AppArmor profile to GenLabel()
by Jamie Strandboge
Commit 12317957ecd6c37a2fb16275dcdeeacfe25c517 introduced an incompatible
architectural change for the AppArmor security driver. Specifically,
virSecurityManagerSetAllLabel() is now called much later in
src/qemu/qemu_process.c:qemuProcessStart(). Previously, SetAllLabel() was
called immediately after GenLabel() such that after the dynamic label (profile
name) was generated, SetAllLabel() would be called to create and load the
AppArmor profile into the kernel before qemuProcessHook() was executed. With
12317957ecd6c37a2fb16275dcdeeacfe25c517, qemuProcessHook() is now called
before SetAllLabel(), such that aa_change_profile() ends up being called
before the AppArmor profile is loaded into the kernel (via ProcessLabel() in
qemuProcessHook()).
This patch addresses the change by making GenLabel() load the AppArmor
profile into the kernel after the label (profile name) is generated.
SetAllLabel() is then adjusted to only reload_profile() and append stdin_fn to
the profile when it is specified. This also makes the AppArmor driver work
like its SELinux counterpart with regard to SetAllLabel() and stdin_fn.
Passes its part of 'check' and 'syntax-check' (though
libvirt_net_rpc_la-virnetmessage.lo failed to compile and po_check
failed the syntax check for unrelated reasons).
Prior to writing this patch, the issue was discussed on IRC with Daniel
Berrange and Eric Blake. Other discussed alternatives were to do a 2
stage qemuProcessHook(), where ProcessLabel() was only called in the
second stage after the handshake. In attempting this, it still didn't
address the fact that aa_change_profile() was being called on an
unloaded profile so it was abandoned. Another idea was to create a
second private API call that the AppArmor driver would use to load the
profile that would be a no-op for the SElinux driver. I started to go
this route, but in the end it was both unneeded and too complicated once
I realized I could simply load the profile in GenLabel() and still use
SetAllLabel() to reload the profile when stdin_path was specified. The
current fix is implemented wholly within the AppArmor driver and I think
much cleaner.
Reference: https://launchpad.net/bugs/795800
--
Jamie Strandboge | http://www.canonical.com
13 years, 6 months
[libvirt] [PATCH] docs: document correct flag name
by Eric Blake
When adding virDomainGetVcpusFlags in commit ea3f5c6, I did
enough rebasing that the doc comments in libvirt.c no longer
matched the final chosen enum names in libvirt.h.
And now we've gone ahead and deprecated the names
VIR_DOMAIN_VCPU_{LIVE,CONFIG}.
* src/libvirt.c (virDomainGetVcpusFlags): Fix comment.
---
Pushing under the trivial rule.
src/libvirt.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 26f338e..76e16ad 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -6919,9 +6919,9 @@ error:
* not support it. This function requires privileged access to the
* hypervisor.
*
- * @flags must include either VIR_DOMAIN_VCPU_ACTIVE to query a
+ * @flags must include either VIR_DOMAIN_AFFECT_LIVE to query a
* running domain (which will fail if domain is not active), or
- * VIR_DOMAIN_VCPU_PERSISTENT to query the XML description of the
+ * VIR_DOMAIN_AFFECT_CONFIG to query the XML description of the
* domain. It is an error to set both flags.
*
* If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then the maximum
--
1.7.4.4
13 years, 6 months
[libvirt] Block pull API QEMU progress update
by Stefan Hajnoczi
I am sending this email as an update on the new image streaming for
QEMU (aka block pull in libvirt).
Adam's libvirt virDomainBlockPull patches were recently merged to
allow populating a disk image while the domain is running. The QEMU
side implementation is not merged into qemu.git yet because similarity
with the live block copy feature has sparked discussion on how to
unify the two.
The QEMU APIs for image streaming and live block copy may or may not
be changed. I think they should stay as they are because they provide
good interfaces for those two features. However, it is possible that
unifying the implementations of the two features internally
necessitates changes to the QEMU APIs.
If changes are made, the question becomes whether they require
changing the libvirt block pull (and proposed live block copy) API.
Right now there is no proposal to change the QEMU APIs for the two
features but I think it is useful for libvirt to be aware of the
status on these features. Perhaps a precautionary measure like not
committing to the APIs until the QEMU patches are merged is
worthwhile, just for safety.
Marcelo, Kevin, and I are working on unifying the QEMU side
implementations of live block copy and image streaming. Hopefully the
specifics will be agreed soon and we can then enable these features in
QEMU and libvirt.
Stefan
13 years, 6 months
[libvirt] [PATCH] build: avoid python 2.4 build failure
by Eric Blake
On RHEL 5, I got:
/usr/bin/python ./generator.py /usr/bin/python
File "./generator.py", line 427
"virStreamFree", # Needed in custom virStream __del__, but free shouldn't
^
SyntaxError: invalid syntax
* python/generator.py (function_skip_python_impl): Use same syntax
as other skip lists.
---
Pushing under the build-breaker rule. However, the build is still
broken on RHEL 5, due to this next one that I don't know how to fix
(probably we'll have to test in configure.ac whether Py_ssize_t
exists, and if not, typedef it ourself in libvirt-override.c):
In file included from libvirt-override.c:22:
typewrappers.h:159: error: expected declaration specifiers or '...' before 'Py_ssize_t'
python/generator.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/python/generator.py b/python/generator.py
index a3ebcf9..6ce6596 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -423,10 +423,10 @@ skip_function = (
)
# Generate C code, but skip python impl
-function_skip_python_impl = {
+function_skip_python_impl = (
"virStreamFree", # Needed in custom virStream __del__, but free shouldn't
# be exposed in bindings
-}
+)
function_skip_index_one = (
"virDomainRevertToSnapshot",
--
1.7.4.4
13 years, 6 months
[libvirt] [PATCH] maint: typo fixes
by Eric Blake
* src/xenxs/xen_sxpr.c (xenParseSxprPCI): Comment fix.
* tests/object-locking.ml (driverTables): Likewise.
* tests/testutils.c (virtTestDifferenceBin): Likewise.
---
Pushing under the trivial rule.
I noticed the testutils 'world' typo first, then looking through
all the other hits for 'world', I noticed the 'wierd' problem.
src/xenxs/xen_sxpr.c | 2 +-
tests/object-locking.ml | 2 +-
tests/testutils.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index b5877bb..13ca015 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -922,7 +922,7 @@ xenParseSxprPCI(virDomainDefPtr def,
* )
*
* Normally there is one (device ...) block per device, but in
- * wierd world of Xen PCI, once (device ...) covers multiple
+ * weird world of Xen PCI, once (device ...) covers multiple
* devices.
*/
diff --git a/tests/object-locking.ml b/tests/object-locking.ml
index ce3b401..68c414e 100644
--- a/tests/object-locking.ml
+++ b/tests/object-locking.ml
@@ -48,7 +48,7 @@ let driverTables = [
"virNetworkDriver";
"virStorageDriver";
"virDeviceMonitor";
-(* "virStateDriver"; Disable for now, since shutdown/startup have wierd locking rules *)
+(* "virStateDriver"; Disable for now, since shutdown/startup have weird locking rules *)
]
(*
diff --git a/tests/testutils.c b/tests/testutils.c
index d192980..b433204 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -406,7 +406,7 @@ int virtTestDifferenceBin(FILE *stream,
}
}
}
- /* Round to nearest boundary of 4, except that last world can be short */
+ /* Round to nearest boundary of 4, except that last word can be short */
start -= (start % 4);
end += 4 - (end % 4);
if (end >= length)
--
1.7.4.4
13 years, 6 months
[libvirt] [PATCH 0/3] Automatic lease management for sanlock
by Daniel P. Berrange
The current sanlock plugin requires that the mgmt app manually
add leases to the guest configuration. This is undesirable for
cases where libvirt is used in a more ad-hoc setup without a
centralized management server. This series allows libvirt to
automatically create leases for each guest disk, ensuring
safety without any mgmt app effort
13 years, 6 months