[libvirt] [PATCH] qemu: check for reboot-timeout on monitor=
by Martin Kletzander
The support for <boot rebootTimeout="12345"/> was added before we were
checking for qemu command line options in QMP, so we haven't properly
adapted virQEMUCaps when using it and thus we report unsupported
option with new enough qemu.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1042690
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 1 +
tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 +
4 files changed, 4 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a68e555..b1c30db 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2282,6 +2282,7 @@ static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = {
{ "drive", "discard", QEMU_CAPS_DRIVE_DISCARD },
{ "realtime", "mlock", QEMU_CAPS_MLOCK },
{ "boot-opts", "strict", QEMU_CAPS_BOOT_STRICT },
+ { "boot-opts", "reboot-timeout", QEMU_CAPS_REBOOT_TIMEOUT },
};
static int
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
index 2b00449..74f63c8 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
@@ -132,4 +132,5 @@
<flag name='ich9-intel-hda'/>
<flag name='kvm-pit-lost-tick-policy'/>
<flag name='boot-strict'/>
+ <flag name='reboot-timeout'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
index 7bce4aa..c82e39e 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
@@ -136,4 +136,5 @@
<flag name='ich9-intel-hda'/>
<flag name='kvm-pit-lost-tick-policy'/>
<flag name='boot-strict'/>
+ <flag name='reboot-timeout'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
index bfaab9d..0f2873f 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
@@ -135,4 +135,5 @@
<flag name='ich9-intel-hda'/>
<flag name='kvm-pit-lost-tick-policy'/>
<flag name='boot-strict'/>
+ <flag name='reboot-timeout'/>
</qemuCaps>
--
1.8.5.1
11 years, 5 months
[libvirt] A libvirt issue about S3 , please help have a look, thanks
by Zhenfeng Wang
Hi
I met a issue that while shutdown/reboot a guest which was in pmsuspended status with the acpi mode,
the virsh command appears executed successfully, actually, the guest keep in pmsuspended status and
it didn't shutoff the guest.Then I did the upper operation on my physical host, find the host will
be waked up from the pmsuspended stuatus while i type the shutdown button , so maybe that's the expect
result that the guest can't be shutdown successfully in pmsuspended status. So I think it should report
a proper error or wake up the guest while we shutdown a guest which was in pmsuspended status. Since i'm
not sure about this issue, so i hope you give me some advise to decide that whether we have necessary to
track this issue, thanks.
pkginfo
kernel-3.6.10-4.fc18.x86_64
libvirt-1.1.4-2.fc21.x86_64
qemu-1.4.0-5.fc20.x86_64
steps
1.Prepare a running guest
# virsh list --all
Id Name State
----------------------------------------------------
6 rhel7 running
# vrish dumpxml rhel7
--
<pm>
<suspend-to-mem enabled='yes'/>
<suspend-to-disk enabled='yes'/>
</pm>
--
<channel type='unix'>
<source mode='bind' path='/var/lib/libvirt/qemu/rhel7.agent'/>
<target type='virtio' name='org.qemu.guest_agent.0'/>
<alias name='channel1'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
2.Install the qemu-guest-agent packet in the guest, then start the qemu-guest-agent service
#systemctl start qemu-guest-agent
3.Do the S3 with the guest
# virsh dompmsuspend rhel7 --target mem
Domain rhel7 successfully suspended
# virsh list
Id Name State
----------------------------------------------------
30 rhel7 pmsuspended
4.Shutdown the guest with acpi, The command also appears executed successfully, actually, it didn't shutoff the guest
I think it shoud report error here if the guest can't be shutdown successfully.
# virsh shutdown rhel7 --mode acpi
Domain rhel7 is being shutdown
# echo $?
0
# virsh list
Id Name State
----------------------------------------------------
30 rhel7 pmsuspended
Check the libvirtd's log, we can see the following log
2013-12-13 10:11:46.004+0000: 25134: debug : qemuMonitorJSONIOProcessLine:175 : QEMU_MONITOR_RECV_REPLY: mon=0x7f824800c190 reply={"return": {}, "id": "libvirt-9"}
2013-12-13 10:11:46.004+0000: 25134: debug : qemuMonitorJSONIOProcessLine:155 : Line [{"timestamp": {"seconds": 1386929506, "microseconds": 3807}, "event": "POWERDOWN"}]
2013-12-13 10:11:46.004+0000: 25134: debug : virJSONValueFromString:975 : string={"timestamp": {"seconds": 1386929506, "microseconds": 3807}, "event": "POWERDOWN"}
2013-12-13 10:11:46.005+0000: 25134: debug : qemuMonitorJSONIOProcessLine:170 : QEMU_MONITOR_RECV_EVENT: mon=0x7f824800c190 event={"timestamp": {"seconds": 1386929506, "microseconds": 3807}, "event": "POWERDOWN"}
11 years, 5 months
[libvirt] [PATCH] lxc: return -1 if failed to kill lxc process
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
We missed a return when virProcessKillPainfully
failed to kill lxc process
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/lxc/lxc_process.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index c51c4d5..4e1e3ac 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -711,7 +711,11 @@ int virLXCProcessStop(virLXCDriverPtr driver,
} else {
/* If cgroup doesn't exist, just try cleaning up the
* libvirt_lxc process */
- virProcessKillPainfully(vm->pid, true);
+ if (virProcessKillPainfully(vm->pid, true) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Processes %d refused to die"), (int)vm->pid);
+ return -1;
+ }
}
virLXCProcessCleanup(driver, vm, reason);
--
1.8.2.1
11 years, 5 months
[libvirt] [PATCH] object: require maximal alignment in base class
by Eric Blake
Recent changes to events (commit 8a29ffcf) resulted in new compile
failures on some targets (such as ARM OMAP5):
conf/domain_event.c: In function 'virDomainEventDispatchDefaultFunc':
conf/domain_event.c:1198:30: error: cast increases required alignment of
target type [-Werror=cast-align]
conf/domain_event.c:1314:34: error: cast increases required alignment of
target type [-Werror=cast-align]
cc1: all warnings being treated as errors
The error is due to alignment; the base class is merely aligned
to the worst of 'int' and 'void*', while the child class must
be aligned to a 'long long'. The solution is to include a
'long long' (and for good measure, a function pointer) in the
base class to ensure correct alignment regardless of what a
child class may add, but to wrap the inclusion in a union so
as to not incur any wasted space. On a typical x86_64 platform,
the base class remains 16 bytes; on i686, the base class remains
12 bytes; and on the impacted ARM platform, the base class grows
from 12 bytes to 16 bytes due to the increase of alignment from
4 to 8 bytes.
Reported by Michele Paolino and others.
* src/util/virobject.h (_virObject): Use a union to ensure that
subclasses never have stricter alignment than the parent.
* src/util/virobject.c (virObjectNew, virObjectUnref)
(virObjectRef): Adjust clients.
* src/libvirt.c (virConnectRef, virDomainRef, virNetworkRef)
(virInterfaceRef, virStoragePoolRef, virStorageVolRef)
(virNodeDeviceRef, virSecretRef, virStreamRef, virNWFilterRef)
(virDomainSnapshotRef): Likewise.
* src/qemu/qemu_monitor.c (qemuMonitorOpenInternal)
(qemuMonitorClose): Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Even though this fixes a build-breaker, I'd rather that someone
actually experiencing the build failure test that this fixes
the problem for them before I push (I don't have easy access to
hardware exhibiting the problem).
src/libvirt.c | 22 +++++++++++-----------
src/qemu/qemu_monitor.c | 4 ++--
src/util/virobject.c | 10 +++++-----
src/util/virobject.h | 16 ++++++++++++++--
4 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index f01de83..d15d617 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -1563,7 +1563,7 @@ virConnectRef(virConnectPtr conn)
virDispatchError(NULL);
return -1;
}
- VIR_DEBUG("conn=%p refs=%d", conn, conn->object.refs);
+ VIR_DEBUG("conn=%p refs=%d", conn, conn->object.u.s.refs);
virObjectRef(conn);
return 0;
}
@@ -2469,7 +2469,7 @@ virDomainRef(virDomainPtr domain)
return -1;
}
- VIR_DOMAIN_DEBUG(domain, "refs=%d", domain->object.refs);
+ VIR_DOMAIN_DEBUG(domain, "refs=%d", domain->object.u.s.refs);
virObjectRef(domain);
return 0;
}
@@ -11977,7 +11977,7 @@ virNetworkRef(virNetworkPtr network)
virDispatchError(NULL);
return -1;
}
- VIR_DEBUG("network=%p refs=%d", network, network->object.refs);
+ VIR_DEBUG("network=%p refs=%d", network, network->object.u.s.refs);
virObjectRef(network);
return 0;
}
@@ -12921,7 +12921,7 @@ virInterfaceRef(virInterfacePtr iface)
virDispatchError(NULL);
return -1;
}
- VIR_DEBUG("iface=%p refs=%d", iface, iface->object.refs);
+ VIR_DEBUG("iface=%p refs=%d", iface, iface->object.u.s.refs);
virObjectRef(iface);
return 0;
}
@@ -13980,7 +13980,7 @@ virStoragePoolRef(virStoragePoolPtr pool)
virDispatchError(NULL);
return -1;
}
- VIR_DEBUG("pool=%p refs=%d", pool, pool->object.refs);
+ VIR_DEBUG("pool=%p refs=%d", pool, pool->object.u.s.refs);
virObjectRef(pool);
return 0;
}
@@ -15101,7 +15101,7 @@ virStorageVolRef(virStorageVolPtr vol)
virDispatchError(NULL);
return -1;
}
- VIR_DEBUG("vol=%p refs=%d", vol, vol->object.refs);
+ VIR_DEBUG("vol=%p refs=%d", vol, vol->object.u.s.refs);
virObjectRef(vol);
return 0;
}
@@ -15792,7 +15792,7 @@ virNodeDeviceRef(virNodeDevicePtr dev)
virDispatchError(NULL);
return -1;
}
- VIR_DEBUG("dev=%p refs=%d", dev, dev->object.refs);
+ VIR_DEBUG("dev=%p refs=%d", dev, dev->object.u.s.refs);
virObjectRef(dev);
return 0;
}
@@ -16900,7 +16900,7 @@ virSecretRef(virSecretPtr secret)
virDispatchError(NULL);
return -1;
}
- VIR_DEBUG("secret=%p refs=%d", secret, secret->object.refs);
+ VIR_DEBUG("secret=%p refs=%d", secret, secret->object.u.s.refs);
virObjectRef(secret);
return 0;
}
@@ -16994,7 +16994,7 @@ virStreamRef(virStreamPtr stream)
virDispatchError(NULL);
return -1;
}
- VIR_DEBUG("stream=%p refs=%d", stream, stream->object.refs);
+ VIR_DEBUG("stream=%p refs=%d", stream, stream->object.u.s.refs);
virObjectRef(stream);
return 0;
}
@@ -18400,7 +18400,7 @@ virNWFilterRef(virNWFilterPtr nwfilter)
virDispatchError(NULL);
return -1;
}
- VIR_DEBUG("nwfilter=%p refs=%d", nwfilter, nwfilter->object.refs);
+ VIR_DEBUG("nwfilter=%p refs=%d", nwfilter, nwfilter->object.u.s.refs);
virObjectRef(nwfilter);
return 0;
}
@@ -20699,7 +20699,7 @@ virDomainSnapshotRef(virDomainSnapshotPtr snapshot)
virDispatchError(NULL);
return -1;
}
- VIR_DEBUG("snapshot=%p, refs=%d", snapshot, snapshot->object.refs);
+ VIR_DEBUG("snapshot=%p, refs=%d", snapshot, snapshot->object.u.s.refs);
virObjectRef(snapshot);
return 0;
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 1514715..1fa1492 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -821,7 +821,7 @@ qemuMonitorOpenInternal(virDomainObjPtr vm,
PROBE(QEMU_MONITOR_NEW,
"mon=%p refs=%d fd=%d",
- mon, mon->parent.parent.refs, mon->fd);
+ mon, mon->parent.parent.u.s.refs, mon->fd);
virObjectUnlock(mon);
return mon;
@@ -893,7 +893,7 @@ void qemuMonitorClose(qemuMonitorPtr mon)
virObjectLock(mon);
PROBE(QEMU_MONITOR_CLOSE,
- "mon=%p refs=%d", mon, mon->parent.parent.refs);
+ "mon=%p refs=%d", mon, mon->parent.parent.u.s.refs);
if (mon->fd >= 0) {
if (mon->watch) {
diff --git a/src/util/virobject.c b/src/util/virobject.c
index 61b5413..4f83bc1 100644
--- a/src/util/virobject.c
+++ b/src/util/virobject.c
@@ -192,9 +192,9 @@ void *virObjectNew(virClassPtr klass)
klass->objectSize - sizeof(virObject)) < 0)
return NULL;
- obj->magic = klass->magic;
+ obj->u.s.magic = klass->magic;
obj->klass = klass;
- virAtomicIntSet(&obj->refs, 1);
+ virAtomicIntSet(&obj->u.s.refs, 1);
PROBE(OBJECT_NEW, "obj=%p classname=%s", obj, obj->klass->name);
@@ -252,7 +252,7 @@ bool virObjectUnref(void *anyobj)
if (!obj)
return false;
- bool lastRef = virAtomicIntDecAndTest(&obj->refs);
+ bool lastRef = virAtomicIntDecAndTest(&obj->u.s.refs);
PROBE(OBJECT_UNREF, "obj=%p", obj);
if (lastRef) {
PROBE(OBJECT_DISPOSE, "obj=%p", obj);
@@ -265,7 +265,7 @@ bool virObjectUnref(void *anyobj)
/* Clear & poison object */
memset(obj, 0, obj->klass->objectSize);
- obj->magic = 0xDEADBEEF;
+ obj->u.s.magic = 0xDEADBEEF;
obj->klass = (void*)0xDEADBEEF;
VIR_FREE(obj);
}
@@ -289,7 +289,7 @@ void *virObjectRef(void *anyobj)
if (!obj)
return NULL;
- virAtomicIntInc(&obj->refs);
+ virAtomicIntInc(&obj->u.s.refs);
PROBE(OBJECT_REF, "obj=%p", obj);
return anyobj;
}
diff --git a/src/util/virobject.h b/src/util/virobject.h
index 3a08f10..d571b5c 100644
--- a/src/util/virobject.h
+++ b/src/util/virobject.h
@@ -36,9 +36,21 @@ typedef virObjectLockable *virObjectLockablePtr;
typedef void (*virObjectDisposeCallback)(void *obj);
+/* Most code should not play with the contents of this struct; however,
+ * the struct itself is public so that it can be embedded as the first
+ * field of a subclassed object. */
struct _virObject {
- unsigned int magic;
- int refs;
+ /* Ensure correct alignment of this and all subclasses, even on
+ * platforms where 'long long' or function pointers have stricter
+ * requirements than 'void *'. */
+ union {
+ long long dummy_align1;
+ void (*dummy_align2) (void);
+ struct {
+ unsigned int magic;
+ int refs;
+ } s;
+ } u;
virClassPtr klass;
};
--
1.8.4.2
11 years, 5 months
[libvirt] [PATCH python v2] Add python3 to the automated build and RPM
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
This updates autobuild.sh to test the python3 build process.
The RPM specfile is changed to build a libvirt-python3 RPM
on Fedora > 18
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
autobuild.sh | 14 +++++++++----
libvirt-python.spec.in | 53 +++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 58 insertions(+), 9 deletions(-)
diff --git a/autobuild.sh b/autobuild.sh
index b3beaf1..5dffe96 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -7,11 +7,17 @@ set -ve
rm -rf MANIFEST dist build
-python setup.py sdist
+python2 setup.py sdist
-python setup.py build
-python setup.py test
-python setup.py install --root="$AUTOBUILD_INSTALL_ROOT"
+python2 setup.py build
+python2 setup.py test
+python2 setup.py install --root="$AUTOBUILD_INSTALL_ROOT"
+
+if test -f /usr/bin/python3 ; then
+ python3 setup.py build
+ python3 setup.py test
+ python3 setup.py install --root="$AUTOBUILD_INSTALL_ROOT"
+fi
type -p /usr/bin/rpmbuild > /dev/null 2>&1 || exit 0
diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index 7c6257e..ac399cb 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -1,5 +1,10 @@
-Summary: The libvirt virtualization API python binding
+%define with_python3 0
+%if 0%{?fedora} > 18
+%define with_python3 1
+%endif
+
+Summary: The libvirt virtualization API python2 binding
Name: libvirt-python
Version: @PY_VERSION@
Release: 1%{?dist}%{?extra_release}
@@ -9,6 +14,17 @@ License: LGPLv2+
Group: Development/Libraries
BuildRequires: libvirt-devel >= @C_VERSION@
BuildRequires: python-devel
+%if %{with_python3}
+BuildRequires: python3-devel
+%endif
+
+%if %{with_python3}
+%package -n libvirt-python3
+Summary: The libvirt virtualization API python3 binding
+Url: http://libvirt.org
+License: LGPLv2+
+Group: Development/Libraries
+%endif
# Don't want provides for python shared objects
%{?filter_provides_in: %filter_provides_in %{python_sitearch}/.*\.so}
@@ -20,22 +36,49 @@ written in the Python programming language to use the interface
supplied by the libvirt library to use the virtualization capabilities
of recent versions of Linux (and other OSes).
+%if %{with_python3}
+%description -n libvirt-python3
+The libvirt-python package contains a module that permits applications
+written in the Python programming language to use the interface
+supplied by the libvirt library to use the virtualization capabilities
+of recent versions of Linux (and other OSes).
+%endif
+
%prep
%setup -q
%build
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
+%if %{with_python3}
+CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
+%endif
%install
%{__python} setup.py install --skip-build --root=%{buildroot}
+%if %{with_python3}
+%{__python3} setup.py install --skip-build --root=%{buildroot}
+%endif
rm -f %{buildroot}%{_libdir}/python*/site-packages/*egg-info
%files
%defattr(-,root,root)
%doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/
-%{_libdir}/python*/site-packages/libvirt.py*
-%{_libdir}/python*/site-packages/libvirt_qemu.py*
-%{_libdir}/python*/site-packages/libvirt_lxc.py*
-%{_libdir}/python*/site-packages/libvirtmod*
+%{_libdir}/python2*/site-packages/libvirt.py*
+%{_libdir}/python2*/site-packages/libvirt_qemu.py*
+%{_libdir}/python2*/site-packages/libvirt_lxc.py*
+%{_libdir}/python2*/site-packages/libvirtmod*
+
+%if %{with_python3}
+%files -n libvirt-python3
+%defattr(-,root,root)
+%doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/
+%{_libdir}/python3*/site-packages/libvirt.py*
+%{_libdir}/python3*/site-packages/libvirt_qemu.py*
+%{_libdir}/python3*/site-packages/libvirt_lxc.py*
+%{_libdir}/python3*/site-packages/__pycache__/libvirt.cpython-*.py*
+%{_libdir}/python3*/site-packages/__pycache__/libvirt_qemu.cpython-*.py*
+%{_libdir}/python3*/site-packages/__pycache__/libvirt_lxc.cpython-*.py*
+%{_libdir}/python3*/site-packages/libvirtmod*
+%endif
%changelog
--
1.8.3.1
11 years, 5 months
[libvirt] [PATCH v4 0/6] Support keyboard device
by Li Zhang
From: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
This patchset is to add keyboard input device.
For PPC64, it doesn't support a default keyboard device when the graphic
is enabled. Libvirt supports QEMU command line as "-device VGA" which
won't create any keyboard device for it. So it requires libvirt to add
a default USB keyboard device for it.
This patchset is to add keyboard input device and a default USB keyboard
for PPC64.
The related discussion in QEMU community:
http://lists.nongnu.org/archive/html/qemu-devel/2013-11/msg01734.html
Li Zhang (6):
conf: Add a keyboard input device type
conf: Add one interface to add default input devices.
conf: Remove PS2 mouse device for non-X86 platforms
qemu_cap: Add USB keyboard capability
qemu: parse qemu command line for USB keyboard
Add a default USB keyboard and USB mouse for PPC64
v4 -> v3:
* Don't remove PS2 mouse device for other virtualization drivers (Jan Tomko).
v3 -> v2:
* Handle the KBD device type in xen and QEMU driver. (Daniel.P.Berrange)
* Remove PS2 mouse device for non-X86 platforms.
* Move virDomainDefMaybeAddInput to a new patch. (Jan Tomko)
* Replace VIR_REALLOC_N with VIR_APPEND_ELEMENT. (Jan Tomoko)
* Fix several typos. (Jan Tomoko)
* Add a virReportError when QEMU_CAPS_DEVICE_USB_KBD can't be gotten. (Jan Tomoko)
v2 -> v1:
* change ifs to switch clause.
* reconstruct the patches
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 92 ++++++++++++++--------
src/conf/domain_conf.h | 5 ++
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 41 +++++++---
src/qemu/qemu_domain.c | 23 +++++-
src/util/virarch.h | 2 +
src/xenxs/xen_sxpr.c | 27 +++++--
src/xenxs/xen_xm.c | 30 +++++--
tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 2 +
tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 +
tests/qemuhelptest.c | 8 ++
.../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml | 3 +-
.../qemuxml2argv-pseries-usb-kbd.args | 9 +++
.../qemuxml2argv-pseries-usb-kbd.xml | 19 +++++
tests/qemuxml2argvtest.c | 3 +
22 files changed, 212 insertions(+), 62 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-kbd.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-kbd.xml
--
1.8.2.1
11 years, 5 months
[libvirt] [PATCH] fix libvirt alignment on arm platforms
by Michele Paolino
With the changes added by the latest commits (e.g.
8a29ffcf9aee45b61a0a12ee45c656cfd52333e8) related to "new events feature
v2",
we are unable to compile libvirt on ARM target (OMAP5).
The error is due to alignment:
conf/domain_event.c: In function 'virDomainEventDispatchDefaultFunc':
conf/domain_event.c:1198:30: error: cast increases required alignment of
target type [-Werror=cast-align]
conf/domain_event.c:1314:34: error: cast increases required alignment of
target type [-Werror=cast-align]
cc1: all warnings being treated as errors
Using ATTRIBUTE_PACKED we force a structure to not follow architecture and
compiler best alignments.
---
src/conf/domain_event.c | 20 ++++++++++----------
src/conf/network_event.c | 2 +-
src/conf/object_event_private.h | 2 +-
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 64035f7..7d58367 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -76,7 +76,7 @@ struct _virDomainEventLifecycle {
int type;
int detail;
-};
+} ATTRIBUTE_PACKED;
typedef struct _virDomainEventLifecycle virDomainEventLifecycle;
typedef virDomainEventLifecycle *virDomainEventLifecyclePtr;
@@ -84,7 +84,7 @@ struct _virDomainEventRTCChange {
virDomainEvent parent;
long long offset;
-};
+} ATTRIBUTE_PACKED;
typedef struct _virDomainEventRTCChange virDomainEventRTCChange;
typedef virDomainEventRTCChange *virDomainEventRTCChangePtr;
@@ -92,7 +92,7 @@ struct _virDomainEventWatchdog {
virDomainEvent parent;
int action;
-};
+} ATTRIBUTE_PACKED;
typedef struct _virDomainEventWatchdog virDomainEventWatchdog;
typedef virDomainEventWatchdog *virDomainEventWatchdogPtr;
@@ -103,7 +103,7 @@ struct _virDomainEventIOError {
char *devAlias;
int action;
char *reason;
-};
+} ATTRIBUTE_PACKED;
typedef struct _virDomainEventIOError virDomainEventIOError;
typedef virDomainEventIOError *virDomainEventIOErrorPtr;
@@ -113,7 +113,7 @@ struct _virDomainEventBlockJob {
char *path;
int type;
int status;
-};
+} ATTRIBUTE_PACKED;
typedef struct _virDomainEventBlockJob virDomainEventBlockJob;
typedef virDomainEventBlockJob *virDomainEventBlockJobPtr;
@@ -125,7 +125,7 @@ struct _virDomainEventGraphics {
virDomainEventGraphicsAddressPtr remote;
char *authScheme;
virDomainEventGraphicsSubjectPtr subject;
-};
+} ATTRIBUTE_PACKED;
typedef struct _virDomainEventGraphics virDomainEventGraphics;
typedef virDomainEventGraphics *virDomainEventGraphicsPtr;
@@ -136,7 +136,7 @@ struct _virDomainEventDiskChange {
char *newSrcPath;
char *devAlias;
int reason;
-};
+} ATTRIBUTE_PACKED;
typedef struct _virDomainEventDiskChange virDomainEventDiskChange;
typedef virDomainEventDiskChange *virDomainEventDiskChangePtr;
@@ -145,7 +145,7 @@ struct _virDomainEventTrayChange {
char *devAlias;
int reason;
-};
+} ATTRIBUTE_PACKED;
typedef struct _virDomainEventTrayChange virDomainEventTrayChange;
typedef virDomainEventTrayChange *virDomainEventTrayChangePtr;
@@ -154,7 +154,7 @@ struct _virDomainEventBalloonChange {
/* In unit of 1024 bytes */
unsigned long long actual;
-};
+} ATTRIBUTE_PACKED;
typedef struct _virDomainEventBalloonChange virDomainEventBalloonChange;
typedef virDomainEventBalloonChange *virDomainEventBalloonChangePtr;
@@ -162,7 +162,7 @@ struct _virDomainEventDeviceRemoved {
virDomainEvent parent;
char *devAlias;
-};
+} ATTRIBUTE_PACKED;
typedef struct _virDomainEventDeviceRemoved virDomainEventDeviceRemoved;
typedef virDomainEventDeviceRemoved *virDomainEventDeviceRemovedPtr;
diff --git a/src/conf/network_event.c b/src/conf/network_event.c
index 4a02523..1ffcf6c 100644
--- a/src/conf/network_event.c
+++ b/src/conf/network_event.c
@@ -32,7 +32,7 @@ struct _virNetworkEventLifecycle {
virObjectEvent parent;
int type;
-};
+} ATTRIBUTE_PACKED;
typedef struct _virNetworkEventLifecycle virNetworkEventLifecycle;
typedef virNetworkEventLifecycle *virNetworkEventLifecyclePtr;
diff --git a/src/conf/object_event_private.h b/src/conf/object_event_private.h
index f41f432..34cd902 100644
--- a/src/conf/object_event_private.h
+++ b/src/conf/object_event_private.h
@@ -73,7 +73,7 @@ struct _virObjectEvent {
virObject parent;
int eventID;
virObjectMeta meta;
-};
+}ATTRIBUTE_PACKED;
virClassPtr
virClassForObjectEvent(void);
--
1.7.9.5
11 years, 5 months
[libvirt] [PATCH python] Add python3 to the automated build and RPM
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
This updates autobuild.sh to test the python3 build process.
The RPM specfile is changed to build a libvirt-python3 RPM
on Fedora > 18
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
autobuild.sh | 6 ++++++
libvirt-python.spec.in | 57 +++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/autobuild.sh b/autobuild.sh
index b3beaf1..c7d2661 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -13,6 +13,12 @@ python setup.py build
python setup.py test
python setup.py install --root="$AUTOBUILD_INSTALL_ROOT"
+if test -f /usr/bin/python3 ; then
+ python3 setup.py build
+ python3 setup.py test
+ python3 setup.py install --root="$AUTOBUILD_INSTALL_ROOT"
+fi
+
type -p /usr/bin/rpmbuild > /dev/null 2>&1 || exit 0
if [ -n "$AUTOBUILD_COUNTER" ]; then
diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index 7c6257e..c61febc 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -1,5 +1,10 @@
-Summary: The libvirt virtualization API python binding
+%global with_python3 0
+%if 0%{?fedora} > 18
+%global with_python3 1
+%endif
+
+Summary: The libvirt virtualization API python2 binding
Name: libvirt-python
Version: @PY_VERSION@
Release: 1%{?dist}%{?extra_release}
@@ -9,6 +14,17 @@ License: LGPLv2+
Group: Development/Libraries
BuildRequires: libvirt-devel >= @C_VERSION@
BuildRequires: python-devel
+%if %{with_python3}
+BuildRequires: python3-devel
+%endif
+
+%if %{with_python3}
+%package -n libvirt-python3
+Summary: The libvirt virtualization API python3 binding
+Url: http://libvirt.org
+License: LGPLv2+
+Group: Development/Libraries
+%endif
# Don't want provides for python shared objects
%{?filter_provides_in: %filter_provides_in %{python_sitearch}/.*\.so}
@@ -20,22 +36,49 @@ written in the Python programming language to use the interface
supplied by the libvirt library to use the virtualization capabilities
of recent versions of Linux (and other OSes).
+%if %{with_python3}
+%description -n libvirt-python3
+The libvirt-python package contains a module that permits applications
+written in the Python programming language to use the interface
+supplied by the libvirt library to use the virtualization capabilities
+of recent versions of Linux (and other OSes).
+%endif
+
%prep
%setup -q
%build
-CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
+CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
+%if %{with_python3}
+CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
+%endif
%install
-%{__python} setup.py install --skip-build --root=%{buildroot}
+%{__python2} setup.py install --skip-build --root=%{buildroot}
+%if %{with_python3}
+%{__python3} setup.py install --skip-build --root=%{buildroot}
+%endif
rm -f %{buildroot}%{_libdir}/python*/site-packages/*egg-info
%files
%defattr(-,root,root)
%doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/
-%{_libdir}/python*/site-packages/libvirt.py*
-%{_libdir}/python*/site-packages/libvirt_qemu.py*
-%{_libdir}/python*/site-packages/libvirt_lxc.py*
-%{_libdir}/python*/site-packages/libvirtmod*
+%{_libdir}/python2*/site-packages/libvirt.py*
+%{_libdir}/python2*/site-packages/libvirt_qemu.py*
+%{_libdir}/python2*/site-packages/libvirt_lxc.py*
+%{_libdir}/python2*/site-packages/libvirtmod*
+
+%if %{with_python3}
+%files -n libvirt-python3
+%defattr(-,root,root)
+%doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/
+%{_libdir}/python3*/site-packages/libvirt.py*
+%{_libdir}/python3*/site-packages/libvirt_qemu.py*
+%{_libdir}/python3*/site-packages/libvirt_lxc.py*
+%{_libdir}/python3*/site-packages/__pycache__/libvirt.cpython-*.py*
+%{_libdir}/python3*/site-packages/__pycache__/libvirt_qemu.cpython-*.py*
+%{_libdir}/python3*/site-packages/__pycache__/libvirt_lxc.cpython-*.py*
+%{_libdir}/python3*/site-packages/libvirtmod*
+%endif
%changelog
--
1.8.3.1
11 years, 5 months
[libvirt] [PATCH python] Rewrite libvirt_charPtrUnwrap to work with Python 3.0->3.2
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The PyUnicode_AsUTF8 method doesn't exist prior to Python 3.3.
It is also somewhat inefficient, so rewrite it to use an
intermediate PyBytes object.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
typewrappers.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/typewrappers.c b/typewrappers.c
index a7a42f2..a5b562d 100644
--- a/typewrappers.c
+++ b/typewrappers.c
@@ -361,9 +361,10 @@ libvirt_boolUnwrap(PyObject *obj, bool *val)
int
libvirt_charPtrUnwrap(PyObject *obj, char **str)
{
-#if PY_MAJOR_VERSION < 3
- const char *ret;
+#if PY_MAJOR_VERSION > 2
+ PyObject *bytes;
#endif
+ const char *ret;
*str = NULL;
if (!obj) {
PyErr_SetString(PyExc_TypeError, "unexpected type");
@@ -371,16 +372,18 @@ libvirt_charPtrUnwrap(PyObject *obj, char **str)
}
#if PY_MAJOR_VERSION > 2
- if (!(*str = PyUnicode_AsUTF8(obj)))
+ if (!(bytes = PyUnicode_AsUTF8String(obj)))
return -1;
+ ret = PyBytes_AsString(bytes);
#else
ret = PyString_AsString(obj);
- if (ret &&
- !(*str = strdup(ret)))
- return -1;
#endif
-
- return 0;
+ if (ret)
+ *str = strdup(ret);
+#if PY_MAJOR_VERSION > 2
+ Py_DECREF(bytes);
+#endif
+ return ret && *str ? 0 : -1;
}
int libvirt_charPtrSizeUnwrap(PyObject *obj, char **str, Py_ssize_t *size)
--
1.8.3.1
11 years, 5 months
[libvirt] [PATCH 0/6] Misc improvements to events code
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
This is a followup to the recent network events patches to
improve a few things I noticed when testing this out for
real.
Daniel P. Berrange (6):
Move examples/domain-events/event-c to examples/object-events
Update event demo program to support network events too
Add 'detail' arg to network lifecycle event internals
Introduce abstract virNetworkEvent class
Remove the event namespace concept
Add debug output when registering event handlers
Makefile.am | 2 +-
configure.ac | 2 +-
examples/domain-events/events-c/Makefile.am | 24 -
examples/domain-events/events-c/event-test.c | 644 -------------------------
examples/object-events/Makefile.am | 24 +
examples/object-events/event-test.c | 685 +++++++++++++++++++++++++++
src/conf/domain_event.c | 18 +-
src/conf/domain_event.h | 2 +
src/conf/network_event.c | 58 ++-
src/conf/network_event.h | 6 +-
src/conf/object_event.c | 33 +-
src/conf/object_event.h | 11 +-
src/conf/object_event_private.h | 2 +
src/network/bridge_driver.c | 15 +-
src/remote/remote_driver.c | 2 +-
src/test/test_driver.c | 15 +-
16 files changed, 828 insertions(+), 715 deletions(-)
delete mode 100644 examples/domain-events/events-c/Makefile.am
delete mode 100644 examples/domain-events/events-c/event-test.c
create mode 100644 examples/object-events/Makefile.am
create mode 100644 examples/object-events/event-test.c
--
1.8.3.1
11 years, 5 months