[libvirt] [PATCH] qemu: hyperv: Add enlightenment support for TSC timekeeping
by Peter Krempa
The hyperv enlightenment features allow to ease guests timekeeping by
allowing to store offset from the TSC as a reference. Add the support
for enabling this flag in qemu.
---
Notes:
This feature is still under development in qemu. I will wait until it's finished before pushing this:
http://lists.nongnu.org/archive/html/qemu-devel/2014-01/msg02569.html
docs/formatdomain.html.in | 7 +++++++
src/conf/domain_conf.c | 6 +++++-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 2 ++
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index ff50214..6e1f93a 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1194,6 +1194,7 @@
<hyperv>
<relaxed state='on'/>
<vapic state='on'/>
+ <time state='on'/>
<spinlocks state='on' retries='4096'/>
</hyperv>
<pvspinlock/>
@@ -1266,6 +1267,12 @@
<td>on, off; retries - at least 4095</td>
<td><span class="since">1.1.0 (QEMU only)</span></td>
</tr>
+ <tr>
+ <td>time</td>
+ <td>Ease timekeeping in guests by providing reference TSC offsets</td>
+ <td>on, off</td>
+ <td><span class="since">1.2.2 (QEMU only)</span></td>
+ </tr>
</table>
</dd>
<dt><code>pvspinlock</code></dt>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 28e24f9..a3f7284 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -153,7 +153,8 @@ VIR_ENUM_IMPL(virDomainFeatureState, VIR_DOMAIN_FEATURE_STATE_LAST,
VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST,
"relaxed",
"vapic",
- "spinlocks")
+ "spinlocks",
+ "time")
VIR_ENUM_IMPL(virDomainLifecycle, VIR_DOMAIN_LIFECYCLE_LAST,
"destroy",
@@ -11720,6 +11721,7 @@ virDomainDefParseXML(xmlDocPtr xml,
switch ((enum virDomainHyperv) feature) {
case VIR_DOMAIN_HYPERV_RELAXED:
case VIR_DOMAIN_HYPERV_VAPIC:
+ case VIR_DOMAIN_HYPERV_TIME:
if (!(tmp = virXPathString("string(./@state)", ctxt))) {
virReportError(VIR_ERR_XML_ERROR,
_("missing 'state' attribute for "
@@ -13744,6 +13746,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
switch ((enum virDomainHyperv) i) {
case VIR_DOMAIN_HYPERV_RELAXED:
case VIR_DOMAIN_HYPERV_VAPIC:
+ case VIR_DOMAIN_HYPERV_TIME:
if (src->hyperv_features[i] != dst->hyperv_features[i]) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("State of HyperV enlightenment "
@@ -17226,6 +17229,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
switch ((enum virDomainHyperv) j) {
case VIR_DOMAIN_HYPERV_RELAXED:
case VIR_DOMAIN_HYPERV_VAPIC:
+ case VIR_DOMAIN_HYPERV_TIME:
if (def->hyperv_features[j])
virBufferAsprintf(buf, " <%s state='%s'/>\n",
virDomainHypervTypeToString(j),
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index d8f2e49..2516341 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1658,6 +1658,7 @@ enum virDomainHyperv {
VIR_DOMAIN_HYPERV_RELAXED = 0,
VIR_DOMAIN_HYPERV_VAPIC,
VIR_DOMAIN_HYPERV_SPINLOCKS,
+ VIR_DOMAIN_HYPERV_TIME,
VIR_DOMAIN_HYPERV_LAST
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 96b8825..7cf9ec9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6779,6 +6779,7 @@ qemuBuildCpuArgStr(virQEMUDriverPtr driver,
switch ((enum virDomainHyperv) i) {
case VIR_DOMAIN_HYPERV_RELAXED:
case VIR_DOMAIN_HYPERV_VAPIC:
+ case VIR_DOMAIN_HYPERV_TIME:
if (def->hyperv_features[i] == VIR_DOMAIN_FEATURE_STATE_ON)
virBufferAsprintf(&buf, ",hv_%s",
virDomainHypervTypeToString(i));
@@ -10971,6 +10972,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
switch ((enum virDomainHyperv) f) {
case VIR_DOMAIN_HYPERV_RELAXED:
case VIR_DOMAIN_HYPERV_VAPIC:
+ case VIR_DOMAIN_HYPERV_TIME:
if (value) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("HyperV feature '%s' should not "
--
1.8.5.3
10 years, 9 months
[libvirt] Help writing bug report: 99% system time when running >1 VM
by Kevin Shanahan
Hi,
I'm experiencing guest freezes and top is showing 99% system time
whenever I try to run more than one guest on my VM host.
Please help me to make a decent bug report!
libvirt: 1.2.1
qemu: 1.7.0
All individual VMs run perfectly on their own, only when two or more
are started at the same time I see these problems. I've not idea how
to find where the processes are getting "stuck". I've had this
working in the past, with the only differences I'm aware of being
version increments and that I previously used to use openvswitch, but
switched to simple linux bridge after rebuilding the setup.
If I strace for a few seconds on one of these processes which are
sucking up CPU, all I see is, e.g.:
[root@kvmhost1 ~]# strace -c -p 12392
Process 12392 attached
^CProcess 12392 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
0.00 0.000000 0 1 rt_sigpending
0.00 0.000000 0 1 1 rt_sigtimedwait
------ ----------- ----------- --------- --------- ----------------
100.00 0.000000 2 1 total
Any advice on what to do next appreciated!
Kind Regards,
Kevin Shanahan.
-- example top output --
top - 12:03:42 up 22:15, 3 users, load average: 3.27, 2.21, 1.64
Threads: 112 total, 4 running, 108 sleeping, 0 stopped, 0 zombie
%Cpu(s): 2.3 us, 97.7 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 8169596 total, 3119260 used, 5050336 free, 0 buffers
KiB Swap: 0 total, 0 used, 0 free. 435704 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
12392 root 20 0 2886636 138272 6380 R 59.2 1.7 3:19.38 qemu-system-x+
11053 root 20 0 3473808 2.031g 6408 R 57.5 26.1 28:47.17 qemu-system-x+
11054 root 20 0 3473808 2.031g 6408 R 36.9 26.1 19:29.52 qemu-system-x+
12393 root 20 0 2886636 138272 6380 S 36.3 1.7 2:14.98 qemu-system-x+
11051 root 20 0 3473808 2.031g 6408 S 7.7 26.1 8:11.11 qemu-system-x+
11057 root 20 0 3473808 2.031g 6408 S 0.0 26.1 0:00.00 qemu-system-x+
12342 root 20 0 1080460 173156 6312 S 0.0 2.1 0:02.44 qemu-system-x+
12344 root 20 0 1080460 173156 6312 S 0.0 2.1 0:29.59 qemu-system-x+
12346 root 20 0 1080460 173156 6312 S 0.0 2.1 0:00.00 qemu-system-x+
12390 root 20 0 2886636 138272 6380 S 0.0 1.7 0:01.71 qemu-system-x+
12396 root 20 0 2886636 138272 6380 S 0.0 1.7 0:00.00 qemu-system-x+
-- perf top output --
(seems pretty normal, I think?)
Samples: 3M of event 'cycles', Event count (approx.): 62626938657
20.90% [kernel] [k] read_hpet ◆
4.47% [kernel] [k] __schedule ▒
3.75% [kernel] [k] update_cfs_shares ▒
3.50% [kernel] [k] kvm_arch_vcpu_ioctl_run ▒
3.03% [kernel] [k] native_read_tsc ▒
2.42% [kernel] [k] update_curr ▒
2.22% [kernel] [k] native_write_msr_safe ▒
-- virsh dumpxml win7 --
<domain type='kvm' id='4'>
<name>win7</name>
<uuid>fb683081-01c0-ee11-3e6f-580c62216b59</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>2</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-i440fx-1.7'>hvm</type>
<boot dev='cdrom'/>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='localtime'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='volume' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source pool='vmspace' volume='win7.img'/>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<disk type='volume' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<alias name='ide0-1-0'/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
<controller type='ide' index='0'>
<alias name='ide0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<controller type='usb' index='0'>
<alias name='usb0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'>
<alias name='pci.0'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:cd:7a:f1'/>
<source bridge='br0'/>
<target dev='vnet1'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/2'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/2'>
<source path='/dev/pts/2'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<input type='tablet' bus='usb'>
<alias name='input0'/>
</input>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5901' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</memballoon>
</devices>
<seclabel type='none'/>
</domain>
-- virsh dumpxml arch1 --
<domain type='kvm' id='6'>
<name>arch1</name>
<uuid>fe10ccad-c4f0-b1ac-5b5b-fab023bb1176</uuid>
<memory unit='KiB'>1572864</memory>
<currentMemory unit='KiB'>1572864</currentMemory>
<vcpu placement='static'>2</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-i440fx-1.7'>hvm</type>
<boot dev='cdrom'/>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='volume' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source pool='vmspace' volume='arch1.img'/>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<alias name='ide0-1-0'/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
<controller type='ide' index='0'>
<alias name='ide0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<controller type='usb' index='0'>
<alias name='usb0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'>
<alias name='pci.0'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:a8:d8:4e'/>
<source bridge='br0'/>
<target dev='vnet2'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/5'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/5'>
<source path='/dev/pts/5'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5902' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</memballoon>
</devices>
<seclabel type='none'/>
</domain>
-- virsh pool-dumpxml vmspace --
<pool type='netfs'>
<name>vmspace</name>
<uuid>29cd171a-5727-4881-b858-e6e2e118d56d</uuid>
<capacity unit='bytes'>527373959168</capacity>
<allocation unit='bytes'>114542247936</allocation>
<available unit='bytes'>412831711232</available>
<source>
<host name='10.48.50.20'/>
<dir path='/vmspace/images'/>
<format type='nfs'/>
</source>
<target>
<path>/srv/kvm/images</path>
<permissions>
<mode>0755</mode>
<owner>-1</owner>
<group>-1</group>
</permissions>
</target>
</pool>
10 years, 9 months
[libvirt] [python PATCH] maint: ignore editor files
by Eric Blake
* .gitignore: Exclude emacs cruft.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing as trivial.
.gitignore | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.gitignore b/.gitignore
index b859b49..44e1656 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,5 @@ build/
dist/
MANIFEST
*~
+*#*#
+*.#*#
--
1.8.5.3
10 years, 9 months
[libvirt] [PATCH] Fix minor typo in governance doc
by Justin Clift
---
docs/governance.html.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/governance.html.in b/docs/governance.html.in
index e649f08..2f04281 100644
--- a/docs/governance.html.in
+++ b/docs/governance.html.in
@@ -24,7 +24,7 @@
project community taken as a whole, all members (whether users,
contributors or committers) are expected to abide by the project's
code of conduct. At a high level the code can be summarized as
- <em>"be excellant to each other"</em>. Expanding on this:
+ <em>"be excellent to each other"</em>. Expanding on this:
</p>
<ul>
--
1.8.3.1
10 years, 9 months
[libvirt] [PATCH v3 0/3] Honor blacklist for modprobe command
by John Ferlan
Rework changes from code review
v2 here: http://www.redhat.com/archives/libvir-list/2014-January/msg01473.html
v3 changes over v2:
* Changed configure.ac for "RMMOD" definition
* Use "virKMod*()" instead of "virModprobe*()" for function names
* Adjust virKModLoad() to take boolean parameter for using -b or not
* Add virKModIsBlacklisted() to perform the blacklist check
* Adjust virkmodtest.c to use the virCommandSetDryRun()
John Ferlan (3):
utils: Introduce functions for modprobe
tests: Add test for new virkmod functions
Honor blacklist for modprobe command
.gitignore | 2 +
configure.ac | 6 ++
src/Makefile.am | 1 +
src/libvirt_private.syms | 7 ++
src/util/virkmod.c | 182 ++++++++++++++++++++++++++++++++++++++++++++++
src/util/virkmod.h | 34 +++++++++
src/util/virpci.c | 28 +++++---
tests/Makefile.am | 5 ++
tests/virkmodtest.c | 183 +++++++++++++++++++++++++++++++++++++++++++++++
9 files changed, 439 insertions(+), 9 deletions(-)
create mode 100644 src/util/virkmod.c
create mode 100644 src/util/virkmod.h
create mode 100644 tests/virkmodtest.c
--
1.8.4.2
10 years, 9 months
[libvirt] [PATCH] build: Fix 'make rpm' in VPATH with wireshark
by Martin Kletzander
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
tools/wireshark/Makefile.am | 1 +
tools/wireshark/src/Makefile.am | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/wireshark/Makefile.am b/tools/wireshark/Makefile.am
index b6fa57c..28e6ed8 100644
--- a/tools/wireshark/Makefile.am
+++ b/tools/wireshark/Makefile.am
@@ -20,3 +20,4 @@
if WITH_WIRESHARK_DISSECTOR
SUBDIRS = src
endif WITH_WIRESHARK_DISSECTOR
+EXTRA_DIST = util/genxdrstub.pl util/make-dissector-reg
diff --git a/tools/wireshark/src/Makefile.am b/tools/wireshark/src/Makefile.am
index afe9975..44f22be 100644
--- a/tools/wireshark/src/Makefile.am
+++ b/tools/wireshark/src/Makefile.am
@@ -21,7 +21,7 @@
INCLUDES = -I$(top_srcdir)
ws_plugin_LTLIBRARIES = libvirt.la
-libvirt_la_SOURCES = packet-libvirt.c plugin.c
+libvirt_la_SOURCES = packet-libvirt.h packet-libvirt.c plugin.c
libvirt_la_CPPFLAGS = $(WS_DISSECTOR_CPPFLAGS)
libvirt_la_LDFLAGS = -avoid-version -module
--
1.8.5.3
10 years, 9 months
[libvirt] [PATCH] event: improve public API docs
by Eric Blake
Since libvirt 0.9.3, the entire virevent.c file has been a public
API, so improve the documentation in this file. Also, fix a
potential core dump - it could only be triggered by bogus use of
the API and would only affect the caller (not libvirtd), but we
might as well be nice.
* src/libvirt.c (virConnectDomainEventRegister)
(virConnectDomainEventRegisterAny)
(virConnectNetworkEventRegisterAny): Document event loop requirement.
* src/util/virevent.c (virEventAddHandle, virEventRemoveHandle)
(virEventAddTimeout, virEventRemoveTimeout): Likewise.
(virEventUpdateHandle, virEventUpdateTimeout): Likewise, and avoid
core dump if caller didn't register handler.
(virEventRunDefaultImpl): Expand example, and set up code block in
html docs.
(virEventRegisterImpl, virEventRegisterDefaultImpl): Document more
on the use of the event loop.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/libvirt.c | 24 ++++++++++------
src/util/virevent.c | 82 +++++++++++++++++++++++++++++++++++------------------
2 files changed, 70 insertions(+), 36 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 66841c8..f43718d 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -16121,11 +16121,13 @@ error:
* @freecb: optional function to deallocate opaque when not used anymore
*
* Adds a callback to receive notifications of domain lifecycle events
- * occurring on a connection
+ * occurring on a connection. This function requires that an event loop
+ * has been previously registered with virEventRegisterImpl() or
+ * virEventRegisterDefaultImpl().
*
* Use of this method is no longer recommended. Instead applications
* should try virConnectDomainEventRegisterAny() which has a more flexible
- * API contract
+ * API contract.
*
* The virDomainPtr object handle passed into the callback upon delivery
* of an event is only valid for the duration of execution of the callback.
@@ -16134,7 +16136,7 @@ error:
* The reference can be released once the object is no longer required
* by calling virDomainFree.
*
- * Returns 0 on success, -1 on failure
+ * Returns 0 on success, -1 on failure.
*/
int
virConnectDomainEventRegister(virConnectPtr conn,
@@ -19064,10 +19066,12 @@ error:
* @freecb: optional function to deallocate opaque when not used anymore
*
* Adds a callback to receive notifications of arbitrary domain events
- * occurring on a domain.
+ * occurring on a domain. This function requires that an event loop
+ * has been previously registered with virEventRegisterImpl() or
+ * virEventRegisterDefaultImpl().
*
* If @dom is NULL, then events will be monitored for any domain. If @dom
- * is non-NULL, then only the specific domain will be monitored
+ * is non-NULL, then only the specific domain will be monitored.
*
* Most types of event have a callback providing a custom set of parameters
* for the event. When registering an event, it is thus necessary to use
@@ -19085,7 +19089,7 @@ error:
* for the callback. To unregister a callback, this callback ID should
* be passed to the virConnectDomainEventDeregisterAny() method.
*
- * Returns a callback identifier on success, -1 on failure
+ * Returns a callback identifier on success, -1 on failure.
*/
int
virConnectDomainEventRegisterAny(virConnectPtr conn,
@@ -19183,10 +19187,12 @@ error:
* @freecb: optional function to deallocate opaque when not used anymore
*
* Adds a callback to receive notifications of arbitrary network events
- * occurring on a network.
+ * occurring on a network. This function requires that an event loop
+ * has been previously registered with virEventRegisterImpl() or
+ * virEventRegisterDefaultImpl().
*
* If @net is NULL, then events will be monitored for any network. If @net
- * is non-NULL, then only the specific network will be monitored
+ * is non-NULL, then only the specific network will be monitored.
*
* Most types of event have a callback providing a custom set of parameters
* for the event. When registering an event, it is thus necessary to use
@@ -19204,7 +19210,7 @@ error:
* for the callback. To unregister a callback, this callback ID should
* be passed to the virConnectNetworkEventDeregisterAny() method.
*
- * Returns a callback identifier on success, -1 on failure
+ * Returns a callback identifier on success, -1 on failure.
*/
int
virConnectNetworkEventRegisterAny(virConnectPtr conn,
diff --git a/src/util/virevent.c b/src/util/virevent.c
index fde29a2..0c94946 100644
--- a/src/util/virevent.c
+++ b/src/util/virevent.c
@@ -37,6 +37,16 @@ static virEventAddTimeoutFunc addTimeoutImpl = NULL;
static virEventUpdateTimeoutFunc updateTimeoutImpl = NULL;
static virEventRemoveTimeoutFunc removeTimeoutImpl = NULL;
+
+/*****************************************************
+ *
+ * Below this point are *PUBLIC* APIs for event
+ * loop integration with applications using libvirt.
+ * These API contracts cannot be changed.
+ *
+ *****************************************************/
+
+
/**
* virEventAddHandle:
*
@@ -46,10 +56,12 @@ static virEventRemoveTimeoutFunc removeTimeoutImpl = NULL;
* @opaque: user data to pass to callback
* @ff: callback to free opaque when handle is removed
*
- * Register a callback for monitoring file handle events.
+ * Register a callback for monitoring file handle events. This function
+ * requires that an event loop has previously been registered with
+ * virEventRegisterImpl() or virEventRegisterDefaultImpl().
*
* Returns -1 if the file handle cannot be registered, otherwise a handle
- * watch number to be used for updating and unregistering for events
+ * watch number to be used for updating and unregistering for events.
*/
int
virEventAddHandle(int fd,
@@ -70,14 +82,17 @@ virEventAddHandle(int fd,
* @watch: watch whose file handle to update
* @events: bitset of events to watch from virEventHandleType constants
*
- * Change event set for a monitored file handle.
+ * Change event set for a monitored file handle. This function
+ * requires that an event loop has previously been registered with
+ * virEventRegisterImpl() or virEventRegisterDefaultImpl().
*
- * Will not fail if fd exists
+ * Will not fail if fd exists.
*/
void
virEventUpdateHandle(int watch, int events)
{
- updateHandleImpl(watch, events);
+ if (updateHandleImpl)
+ updateHandleImpl(watch, events);
}
/**
@@ -85,7 +100,9 @@ virEventUpdateHandle(int watch, int events)
*
* @watch: watch whose file handle to remove
*
- * Unregister a callback from a file handle.
+ * Unregister a callback from a file handle. This function
+ * requires that an event loop has previously been registered with
+ * virEventRegisterImpl() or virEventRegisterDefaultImpl().
*
* Returns -1 if the file handle was not registered, 0 upon success.
*/
@@ -106,7 +123,9 @@ virEventRemoveHandle(int watch)
* @opaque: user data to pass to callback
* @ff: callback to free opaque when timeout is removed
*
- * Register a callback for a timer event.
+ * Register a callback for a timer event. This function
+ * requires that an event loop has previously been registered with
+ * virEventRegisterImpl() or virEventRegisterDefaultImpl().
*
* Setting timeout to -1 will disable the timer. Setting the timeout
* to zero will cause it to fire on every event loop iteration.
@@ -132,17 +151,20 @@ virEventAddTimeout(int timeout,
* @timer: timer id to change
* @timeout: time between events in milliseconds
*
- * Change frequency for a timer.
+ * Change frequency for a timer. This function
+ * requires that an event loop has previously been registered with
+ * virEventRegisterImpl() or virEventRegisterDefaultImpl().
*
* Setting frequency to -1 will disable the timer. Setting the frequency
* to zero will cause it to fire on every event loop iteration.
*
- * Will not fail if timer exists
+ * Will not fail if timer exists.
*/
void
virEventUpdateTimeout(int timer, int timeout)
{
- updateTimeoutImpl(timer, timeout);
+ if (updateTimeoutImpl)
+ updateTimeoutImpl(timer, timeout);
}
/**
@@ -150,7 +172,9 @@ virEventUpdateTimeout(int timer, int timeout)
*
* @timer: the timer id to remove
*
- * Unregister a callback for a timer.
+ * Unregister a callback for a timer. This function
+ * requires that an event loop has previously been registered with
+ * virEventRegisterImpl() or virEventRegisterDefaultImpl().
*
* Returns -1 if the timer was not registered, 0 upon success.
*/
@@ -164,14 +188,6 @@ virEventRemoveTimeout(int timer)
}
-/*****************************************************
- *
- * Below this point are 3 *PUBLIC* APIs for event
- * loop integration with applications using libvirt.
- * These API contracts cannot be changed.
- *
- *****************************************************/
-
/**
* virEventRegisterImpl:
* @addHandle: the callback to add fd handles
@@ -186,9 +202,14 @@ virEventRemoveTimeout(int timer)
* to integrate with the libglib2 event loop, or libevent
* or the QT event loop.
*
+ * Use of the virEventAddHandle() and similar APIs require that the
+ * corresponding handler be registered. Use of the
+ * virConnectDomainEventRegisterAny() and similar APIs requires that
+ * the three timeout handlers be registered.
+ *
* If an application does not need to integrate with an
* existing event loop implementation, then the
- * virEventRegisterDefaultImpl method can be used to setup
+ * virEventRegisterDefaultImpl() method can be used to setup
* the generic libvirt implementation.
*/
void virEventRegisterImpl(virEventAddHandleFunc addHandle,
@@ -220,9 +241,12 @@ void virEventRegisterImpl(virEventAddHandleFunc addHandle,
* not have a need to integrate with an external event
* loop impl.
*
- * Once registered, the application has to invoke virEventRunDefaultImpl in
+ * Once registered, the application has to invoke virEventRunDefaultImpl() in
* a loop to process events. Failure to do so may result in connections being
- * closed unexpectedly as a result of keepalive timeout.
+ * closed unexpectedly as a result of keepalive timeout. The default
+ * event loop fully supports handle and and timeout events, but only
+ * wakes up on events registered by libvirt API calls such as
+ * virEventAddHandle() or virConnectDomainEventRegisterAny().
*
* Returns 0 on success, -1 on failure.
*/
@@ -255,14 +279,18 @@ int virEventRegisterDefaultImpl(void)
*
* Run one iteration of the event loop. Applications
* will generally want to have a thread which invokes
- * this method in an infinite loop
+ * this method in an infinite loop. Furthermore, it is wise
+ * to set up a pipe-to-self handler (via virEventAddHandle())
+ * or a timeout (via virEventAddTimeout()) before calling this
+ * function, as it will block forever if there are no
+ * registered events.
*
- * static bool quit = false;
+ * static bool quit = false;
*
- * while (!quit) {
- * if (virEventRunDefaultImpl() < 0)
+ * while (!quit) {
+ * if (virEventRunDefaultImpl() < 0)
* ...print error...
- * }
+ * }
*
* Returns 0 on success, -1 on failure.
*/
--
1.8.4.2
10 years, 9 months
[libvirt] [RFC PATCH] libvirt support to force convergence of live guest migration
by Chegu Vinod
Busy enterprise workloads hosted on large sized VM's tend to dirty
memory faster than the transfer rate achieved via live guest migration.
Despite some good recent improvements (& using dedicated 10Gig NICs
between hosts) the live migration may NOT converge.
Recently support was added in qemu (version 1.6) to allow a user to
choose if they wish to force convergence of their migration via a
new migration capability : "auto-converge". This feature allows for qemu
to auto-detect lack of convergence and trigger a throttle-down of the
VCPUs.
This RFC patch includes the libvirt support needed to trigger this
feature. (Testing is still in progress)
Signed-off-by: Chegu Vinod <chegu_vinod(a)hp.com>
---
include/libvirt/libvirt.h.in | 1 +
src/qemu/qemu_migration.c | 44 ++++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_migration.h | 1 +
src/qemu/qemu_monitor.c | 2 +-
src/qemu/qemu_monitor.h | 1 +
tools/virsh-domain.c | 7 ++++++
6 files changed, 55 insertions(+), 1 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 146a59b..13b0bfc 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1192,6 +1192,7 @@ typedef enum {
VIR_MIGRATE_OFFLINE = (1 << 10), /* offline migrate */
VIR_MIGRATE_COMPRESSED = (1 << 11), /* compress data during migration */
VIR_MIGRATE_ABORT_ON_ERROR = (1 << 12), /* abort migration on I/O errors happened during migration */
+ VIR_MIGRATE_AUTO_CONVERGE = (1 << 13), /* force auto-convergence during during migration */
} virDomainMigrateFlags;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index e87ea85..8cc0c56 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1565,6 +1565,40 @@ cleanup:
}
static int
+qemuMigrationSetAutoConverge(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ enum qemuDomainAsyncJob job)
+{
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ int ret;
+
+ if (qemuDomainObjEnterMonitorAsync(driver, vm, job) < 0)
+ return -1;
+
+ ret = qemuMonitorGetMigrationCapability(
+ priv->mon,
+ QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE);
+
+ if (ret < 0) {
+ goto cleanup;
+ } else if (ret == 0) {
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("Auto-Converge migration is not supported by "
+ "QEMU binary"));
+ ret = -1;
+ goto cleanup;
+ }
+
+ ret = qemuMonitorSetMigrationCapability(
+ priv->mon,
+ QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE);
+
+cleanup:
+ qemuDomainObjExitMonitor(driver, vm);
+ return ret;
+}
+
+static int
qemuMigrationWaitForSpice(virQEMUDriverPtr driver,
virDomainObjPtr vm)
{
@@ -2389,6 +2423,11 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
goto stop;
+ if (flags & VIR_MIGRATE_AUTO_CONVERGE &&
+ qemuMigrationSetAutoConverge(driver, vm,
+ QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
+ goto stop;
+
if (mig->lockState) {
VIR_DEBUG("Received lockstate %s", mig->lockState);
VIR_FREE(priv->lockState);
@@ -3181,6 +3220,11 @@ qemuMigrationRun(virQEMUDriverPtr driver,
QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
goto cleanup;
+ if (flags & VIR_MIGRATE_AUTO_CONVERGE &&
+ qemuMigrationSetAutoConverge(driver, vm,
+ QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
+ goto cleanup;
+
if (qemuDomainObjEnterMonitorAsync(driver, vm,
QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
goto cleanup;
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index cafa2a2..c4258a1 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -39,6 +39,7 @@
VIR_MIGRATE_UNSAFE | \
VIR_MIGRATE_OFFLINE | \
VIR_MIGRATE_COMPRESSED | \
+ VIR_MIGRATE_AUTO_CONVERGE | \
VIR_MIGRATE_ABORT_ON_ERROR)
/* All supported migration parameters and their types. */
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 1514715..780a29a 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -118,7 +118,7 @@ VIR_ENUM_IMPL(qemuMonitorMigrationStatus,
VIR_ENUM_IMPL(qemuMonitorMigrationCaps,
QEMU_MONITOR_MIGRATION_CAPS_LAST,
- "xbzrle")
+ "xbzrle", "auto-converge")
VIR_ENUM_IMPL(qemuMonitorVMStatus,
QEMU_MONITOR_VM_STATUS_LAST,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index eabf000..95e70ab 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -440,6 +440,7 @@ int qemuMonitorGetSpiceMigrationStatus(qemuMonitorPtr mon,
typedef enum {
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE,
+ QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE,
QEMU_MONITOR_MIGRATION_CAPS_LAST
} qemuMonitorMigrationCaps;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 1fe138c..d94a81b 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -8532,6 +8532,10 @@ static const vshCmdOptDef opts_migrate[] = {
.type = VSH_OT_BOOL,
.help = N_("compress repeated pages during live migration")
},
+ {.name = "auto-converge",
+ .type = VSH_OT_BOOL,
+ .help = N_("force auto convergence during live migration")
+ },
{.name = "abort-on-error",
.type = VSH_OT_BOOL,
.help = N_("abort on soft errors during migration")
@@ -8676,6 +8680,9 @@ doMigrate(void *opaque)
if (vshCommandOptBool(cmd, "compressed"))
flags |= VIR_MIGRATE_COMPRESSED;
+ if (vshCommandOptBool(cmd, "auto-converge"))
+ flags |= VIR_MIGRATE_AUTO_CONVERGE;
+
if (vshCommandOptBool(cmd, "offline")) {
flags |= VIR_MIGRATE_OFFLINE;
}
--
1.7.1
10 years, 9 months
[libvirt] [PATCH v1 0/2] Network hooks
by Michal Privoznik
With the latest noise I made on the list with QoS I'm coming forward with this
idea. Network hooks can fill some holes in our functionality. For instance if
somebody is willing to set a QoS that is not covered by libvirt, or just want
to insert some additional iptables rules, etc. You name it.
Michal Privoznik (2):
networkStartNetwork: Be more verbose
network: Introduce start and shutdown hooks
docs/hooks.html.in | 43 ++++++++++++++++++++----------
src/network/bridge_driver.c | 64 +++++++++++++++++++++++++++++++++------------
src/util/virhook.c | 10 ++++++-
src/util/virhook.h | 8 ++++++
4 files changed, 94 insertions(+), 31 deletions(-)
--
1.8.5.2
10 years, 9 months
[libvirt] [PATCH v2 00/18] LXC configuration conversion to domain XML
by Cédric Bosdonnat
This new version of the patchset, fixes all comments from Daniel. It also adds
two more commits: one extending virConf to use it later in lxc_native.c and one
for some documentation on the new feature and its limitations.
Several RFEs have been filesd for this patchset: they are mentioned in the
appropriate commit log, and I still hope to be able to provide patches for them
later.
Cédric Bosdonnat (18):
Improve virConf parse to handle LXC config format
LXC driver: started implementing connectDomainXMLFromNative
LXC from native: import rootfs
LXC from native: migrate fstab and lxc.mount.entry
LXC from native: implement no network conversion
LXC from native: migrate veth network configuration
LXC from native: convert phys network types to net hostdev devices
LXC from native: convert lxc.tty to console devices
LXC from native: convert macvlan network configuration
LXC from native: convert lxc.id_map into <idmap>
LXC from native: migrate memory tuning
LXC from native: map lxc.cgroup.cpu.*
LXC from native: map lxc.cgroup.cpuset.*
LXC from native: add lxc.cgroup.blkio.* mapping
LXC from native: map lxc.arch to /domain/os/type@arch
LXC from native: map block filesystems
LXC from native: map vlan network type
LXC: added some doc on domxml-from-native with mention of limitations
.gitignore | 1 +
docs/drvlxc.html.in | 34 +-
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/libvirt_private.syms | 1 +
src/lxc/lxc_container.c | 2 +-
src/lxc/lxc_container.h | 2 +
src/lxc/lxc_driver.c | 31 +
src/lxc/lxc_native.c | 883 +++++++++++++++++++++
src/lxc/lxc_native.h | 32 +
src/util/virconf.c | 46 +-
src/util/virconf.h | 10 +
tests/Makefile.am | 7 +-
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.config | 7 +
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml | 35 +
.../lxcconf2xmldata/lxcconf2xml-cpusettune.config | 6 +
tests/lxcconf2xmldata/lxcconf2xml-cpusettune.xml | 27 +
tests/lxcconf2xmldata/lxcconf2xml-cputune.config | 7 +
tests/lxcconf2xmldata/lxcconf2xml-cputune.xml | 29 +
tests/lxcconf2xmldata/lxcconf2xml-fstab.config | 37 +
tests/lxcconf2xmldata/lxcconf2xml-idmap.config | 5 +
tests/lxcconf2xmldata/lxcconf2xml-idmap.xml | 28 +
.../lxcconf2xml-macvlannetwork.config | 13 +
.../lxcconf2xmldata/lxcconf2xml-macvlannetwork.xml | 26 +
tests/lxcconf2xmldata/lxcconf2xml-memtune.config | 10 +
tests/lxcconf2xmldata/lxcconf2xml-memtune.xml | 29 +
.../lxcconf2xmldata/lxcconf2xml-nonenetwork.config | 4 +
tests/lxcconf2xmldata/lxcconf2xml-nonenetwork.xml | 21 +
tests/lxcconf2xmldata/lxcconf2xml-nonetwork.config | 3 +
tests/lxcconf2xmldata/lxcconf2xml-nonetwork.xml | 24 +
.../lxcconf2xmldata/lxcconf2xml-physnetwork.config | 6 +
tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml | 26 +
tests/lxcconf2xmldata/lxcconf2xml-simple.config | 41 +
tests/lxcconf2xmldata/lxcconf2xml-simple.xml | 41 +
.../lxcconf2xmldata/lxcconf2xml-vlannetwork.config | 12 +
tests/lxcconf2xmldata/lxcconf2xml-vlannetwork.xml | 26 +
tests/lxcconf2xmltest.c | 131 +++
37 files changed, 1640 insertions(+), 5 deletions(-)
create mode 100644 src/lxc/lxc_native.c
create mode 100644 src/lxc/lxc_native.h
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-blkiotune.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cpusettune.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cpusettune.xml
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cputune.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-cputune.xml
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-fstab.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-idmap.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-idmap.xml
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork.xml
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-memtune.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-memtune.xml
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonenetwork.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonenetwork.xml
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonetwork.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonetwork.xml
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-physnetwork.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-simple.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-simple.xml
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-vlannetwork.config
create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-vlannetwork.xml
create mode 100644 tests/lxcconf2xmltest.c
--
1.8.5.2
10 years, 9 months