Bug 1115898

Summary: [RFE] Add events for cputune and iotune change
Product: Red Hat Enterprise Linux 7 Reporter: Martin Sivák <msivak>
Component: libvirtAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: agedosier, berrange, clalancette, dyuan, fromani, itamar, jforbes, laine, lhuang, libvirt-maint, mzhan, rbalakri, shyu, veillard, zhwang, zpeng
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.2.8-4.el7 Doc Type: Enhancement
Doc Text:
Feature: Emit events for tunable values of running domain. So far only cputune and blkdeviotune are implemented. Reason: Some controlling applications wants to know about changes of tunable values. By introducing this feature they don't have to parse the domain status XML in a loop to view those updates. Result: There is a new API that can be used to register an user callback. The callback will be triggered every time when there is an update of tunable values for specified running domain. Also "virsh event" has been updated to support this new event.
Story Points: ---
Clone Of: 1114492 Environment:
Last Closed: 2015-03-05 07:40:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1114492    
Bug Blocks: 1115887    

Description Martin Sivák 2014-07-03 09:57:13 UTC
+++ This bug was initially created as a clone of Bug #1114492 +++

Description of problem:

When multiple processes cooperate while managing a KVM/libvirt based virtual setup, they have to poll for changes in CPU and IO QoS settings.

Please add events so the processes (host manager and qos manager) can get the changed information in more efficient way.


This might apply to other values as well, but CPU and IO are the subsystems we care about the most at this time.

--- Additional comment from Cole Robinson on 2014-07-02 10:04:48 EDT ---

Moving to the upstream tracker.

Martin, if this is important to ovirt, I'd recommend filing a RHEL bug as well so resources are actually allocated as needed.

Comment 4 Luyao Huang 2014-11-07 03:34:54 UTC
Test with libvirt-1.2.8-6.el7:

1. open 1st terminal and run:
# virsh event --list
lifecycle
reboot
rtc-change
watchdog
io-error
graphics
io-error-reason
control-error
block-job
disk-change
tray-change
pm-wakeup
pm-suspend
balloon-change
pm-suspend-disk
device-removed
block-job-2
tunable


# valgrind --leak-check=full virsh event --loop --event tunable
==23842== Memcheck, a memory error detector
==23842== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==23842== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==23842== Command: virsh event --loop --event tunable
==23842== 


2,open 2nd terminal and run:

# virsh schedinfo r6
Scheduler      : posix
cpu_shares     : 1024
vcpu_period    : 100000
vcpu_quota     : -1
emulator_period: 100000
emulator_quota : -1

# virsh schedinfo r6 --set vcpu_period=111111
Scheduler      : posix
cpu_shares     : 1024
vcpu_period    : 111111
vcpu_quota     : -1
emulator_period: 100000
emulator_quota : -1

# virsh schedinfo r6 --set cpu_shares=0
Scheduler      : posix
cpu_shares     : 2
vcpu_period    : 111111
vcpu_quota     : -1
emulator_period: 100000
emulator_quota : -1

# virsh schedinfo r6 --set vcpu_quota=-1
Scheduler      : posix
cpu_shares     : 2
vcpu_period    : 111111
vcpu_quota     : -1
emulator_period: 100000
emulator_quota : -1

# virsh schedinfo r6 --set vcpu_quota=-2
Scheduler      : posix
cpu_shares     : 2
vcpu_period    : 111111
vcpu_quota     : -1
emulator_period: 100000
emulator_quota : -1

# virsh schedinfo r6 --set vcpu_quota=18446744073709551
Scheduler      : posix
cpu_shares     : 2
vcpu_period    : 111111
vcpu_quota     : 18446744073709551
emulator_period: 100000
emulator_quota : -1

# virsh schedinfo r6 --set vcpu_quota=-1
Scheduler      : posix
cpu_shares     : 2
vcpu_period    : 111111
vcpu_quota     : -1
emulator_period: 100000
emulator_quota : -1

# virsh schedinfo r6 --set emulator_period=12345
Scheduler      : posix
cpu_shares     : 2
vcpu_period    : 111111
vcpu_quota     : -1
emulator_period: 12345
emulator_quota : -1

# virsh schedinfo r6 --set emulator_quota=12345
Scheduler      : posix
cpu_shares     : 2
vcpu_period    : 111111
vcpu_quota     : -1
emulator_period: 12345
emulator_quota : 12345

#virsh vcpupin r6 1 3



3. on the first terminal:

==23842== Memcheck, a memory error detector
==23842== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==23842== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==23842== Command: virsh event --loop --event tunable
==23842== 


event 'tunable' for domain r6:
	cputune.vcpu_period: 111111
event 'tunable' for domain r6:
	cputune.cpu_shares: 2
event 'tunable' for domain r6:
	cputune.vcpu_quota: -1
event 'tunable' for domain r6:
	cputune.vcpu_quota: -2
event 'tunable' for domain r6:
	cputune.vcpu_quota: 18446744073709551
event 'tunable' for domain r6:
	cputune.vcpu_quota: -1
event 'tunable' for domain r6:
	cputune.emulator_period: 12345
event 'tunable' for domain r6:
	cputune.emulator_quota: 12345
event 'tunable' for domain r6:
	cputune.vcpupin1: 3

Comment 5 Luyao Huang 2014-11-07 03:45:12 UTC
S2:
For blkdeviotune

1.open 1st terminal and run:
# valgrind --leak-check=full virsh event --loop --event tunable
==23842== Memcheck, a memory error detector
==23842== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==23842== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==23842== Command: virsh event --loop --event tunable
==23842== 

2.open 2nd terminal and run:
# virsh blkdeviotune r6 hda --total-bytes-sec  123

# virsh blkdeviotune r6 hda --read-bytes-sec 234

# virsh blkdeviotune r6 hda --write-bytes-sec 1234

# virsh blkdeviotune r6 hda --total-iops-sec 123

# virsh blkdeviotune r6 hda --read-iops-sec 123456

# virsh blkdeviotune r6 hda --write-iops-sec 123


3.on the first terminal:

event 'tunable' for domain r6:
	blkdeviotune.disk: hda
	blkdeviotune.total_bytes_sec: 123
event 'tunable' for domain r6:
	blkdeviotune.disk: hda
	blkdeviotune.read_bytes_sec: 234
event 'tunable' for domain r6:
	blkdeviotune.disk: hda
	blkdeviotune.write_bytes_sec: 1234
event 'tunable' for domain r6:
	blkdeviotune.disk: hda
	blkdeviotune.total_iops_sec: 123
event 'tunable' for domain r6:
	blkdeviotune.disk: hda
	blkdeviotune.read_iops_sec: 123456
event 'tunable' for domain r6:
	blkdeviotune.disk: hda
	blkdeviotune.write_iops_sec: 123

Comment 6 Luyao Huang 2014-12-11 09:20:39 UTC
Verify this bug with the steps in comment 4 and comment 5.

Comment 8 errata-xmlrpc 2015-03-05 07:40:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0323.html

Comment 9 Peter Krempa 2015-03-09 13:29:50 UTC
*** Bug 1199002 has been marked as a duplicate of this bug. ***