[libvirt] [PATCH 3/4] util: consolidate QEMU and LXC block io related duplicate code

2019-10-29 Thread Mao Zhongyi
Both qemu and lxc drivers have some duplicate code when dealing with cgroups, such as virLXCCgroupSetupBlkioTune() and qemuSetupBlkioCgroup(), duplicate code over 80, so consolidate the same chunk into a separate routine. Signed-off-by: Mao Zhongyi Signed-off-by: Zhang Shengju ---

[libvirt] [PATCH 0/4] consolidate cgroup code that is duplicated between

2019-10-29 Thread Mao Zhongyi
Both QEMU and LXC drivers have some duplicate code when dealing with cgroups, this serials mainly consolidate the same chunk of src/qemu/qemu_cgroup.c and src/lxc/lxc_cgroup.c into src/util/cgroup.c. Mao Zhongyi (4): lxc: remove duplicate header files qemu: remove duplicate header files

[libvirt] [PATCH 2/4] qemu: remove duplicate header files

2019-10-29 Thread Mao Zhongyi
"#include vircgroup.h" appears in both qemu_cgroup.h and qemu_cgroup.c, and qemu_cgroup.c contains qemu_cgroup.h, so remove the duplicate declarations. Signed-off-by: Mao Zhongyi Signed-off-by: Zhang Shengju --- src/qemu/qemu_cgroup.c | 1 - 1 file changed, 1 deletion(-) diff --git

[libvirt] [PATCH 4/4] util: consolidate QEMU and LXC memory related duplicate code

2019-10-29 Thread Mao Zhongyi
Both qemu and lxc drivers have some duplicate code when dealing with cgroups, such as virLXCCgroupSetupMemTune() and qemuSetupMemoryCgroup(), duplicate code over 80, so consolidate the same chunk into a separate routine. Signed-off-by: Mao Zhongyi Signed-off-by: Zhang Shengju ---

[libvirt] [PATCH 1/4] lxc: remove duplicate header files

2019-10-29 Thread Mao Zhongyi
"#include vircgroup.h" appears in both lxc_cgroup.h and lxc_cgroup.c, and lxc_cgroup.c contains lxc_cgroup.h, so remove the duplicate declarations. Signed-off-by: Mao Zhongyi Signed-off-by: Zhang Shengju --- src/lxc/lxc_cgroup.c | 1 - 1 file changed, 1 deletion(-) diff --git

Re: [libvirt] the test-file

2019-10-29 Thread Leo Hou
> Hi.   > > hello,everyone: > > If I want to add a new CPU model ,the test-file >x86_64-cpuid-*-host.xml , x86_64-cpuid-*-guest.xml ,x86_64-cpuid-*-json.xml >and x86_64-cpuid->>  *.sig how to generate in the /tests/cputestdata/ ?   > The steps to add a new CPU data test case is to run

Re: [libvirt] [PATCH v3 REBASE 00/12] hostdev: handle usb detach/attach on node

2019-10-29 Thread Dave Allan
On Tue, Oct 29, 2019 at 08:20:04AM +, Nikolay Shirokovskiy wrote: On 28.10.2019 13:11, Dave Allan wrote: Hi Nikolay, I tried to apply these patches both to the current git head and also the git head as of Oct 15 when you posted them, and neither applied cleanly.  Can you confirm that

Re: [libvirt] the test-file

2019-10-29 Thread Jiri Denemark
Hi. > hello,everyone: > If I want to add a new CPU model ,the test-file > x86_64-cpuid-*-host.xml , x86_64-cpuid-*-guest.xml ,x86_64-cpuid-*-json.xml > and x86_64-cpuid-*.sig how to generate in the /tests/cputestdata/ ? The steps to add a new CPU data test case is to run the

Re: [libvirt] [PATCH v3 REBASE 00/12] hostdev: handle usb detach/attach on node

2019-10-29 Thread Nikolay Shirokovskiy
On 28.10.2019 13:11, Dave Allan wrote: > Hi Nikolay, > > I tried to apply these patches both to the current git head and also the git > head as of Oct 15 when you posted them, and neither applied cleanly.  Can you > confirm that they apply cleanly for you to the current tree? > > Thanks, >

[libvirt] [PATCH v3 REBASE 2 05/12] qemu: handle host usb device add/del udev events

2019-10-29 Thread Nikolay Shirokovskiy
Now when code handling attaching/detaching usb hostdev is appropriately changed use it to handle host usb device udev add/del events. As device adding/deleting needs acquiring job condition it is done in thread pool rather in event loop thread itself where udev events are delivered. However

[libvirt] [PATCH v3 REBASE 2 02/12] qemu: track hostdev delete intention

2019-10-29 Thread Nikolay Shirokovskiy
So we are going to support replug of usb device on host. We need to delete device from qemu when the device is unplugged on host and to add device when the device is plugged back. As to deleting let's use same code as when we detach device from domain. But we need to keep the usb hostdev etc in

[libvirt] [PATCH v3 REBASE 2 10/12] qemu: don't mess with non mandatory hostdevs on reattaching

2019-10-29 Thread Nikolay Shirokovskiy
First I don't want to add code to handle dummy device that is used when host usb device is not present at the moment of starting/migrating etc. Second supporting non mandatory policies would require to handle races when host usb device is plugged to host and libvirtd starts adding device but if in

[libvirt] [PATCH v3 REBASE 2 00/12] hostdev: handle usb detach/attach on node

2019-10-29 Thread Nikolay Shirokovskiy
Diff to v2[1] version: - add 'replug' attribute for hostdev element to allow replug semantics - avoid accuiring domain lock in event loop thread on udev events as suggested by Peter - nit picks after review by Daniel Henrique Barboza * is used to mark patches that were 'Reviewed-by' by Daniel

[libvirt] [PATCH v3 REBASE 2 12/12] conf: parse hostdev missing flag

2019-10-29 Thread Nikolay Shirokovskiy
We want to keep this flag across libvirtd restarts. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/conf/domain_conf.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 06a23cd127..a57de9354a 100644

[libvirt] [PATCH v3 REBASE 2 08/12] qemu: hotplug: update device list on device deleted event

2019-10-29 Thread Nikolay Shirokovskiy
I guess this is the missing piece for [1]. It did not hurt before (like we didn't even see any errors/warns in logs) because in qemuProcessUpdateDevices function virDomainDefFindDevice does not find device deleted from libvirt config. But now in case of unpluggind usb device from host we leave

[libvirt] [PATCH v3 REBASE 2 01/12] conf: add replug option for usb hostdev

2019-10-29 Thread Nikolay Shirokovskiy
If usb device attached to a domain is unplugged from host and then plugged back then it will no longer be available in guest. We are going to support this case so that device will be detached from qemu on unplug and attached back on replug. As sometimes this behaviour is not desirable and for

[libvirt] [PATCH v3 REBASE 2 11/12] qemu: handle detaching of unplugged hostdev

2019-10-29 Thread Nikolay Shirokovskiy
If hostdev is unplugged we don't need to delete it's correspondent device from qemu etc. Just remove it from config immediately. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_hotplug.c | 16 +++- src/util/virhostdev.c | 2 ++ 2 files changed, 17 insertions(+), 1

[libvirt] [PATCH v3 REBASE 2 07/12] qemu: handle race on device deletion and usb host device plugging

2019-10-29 Thread Nikolay Shirokovskiy
Imagine host usb device is unplugged from host and as a result we send command to qemu to delete appropriate device. Then before qemu device is deleted host usb device is plugged back. Currently code supposes there is no remnant device in qemu and will try to add new device and the attempt will

[libvirt] [PATCH v3 REBASE 2 03/12] qemu: support host usb device unplug

2019-10-29 Thread Nikolay Shirokovskiy
Handle host usb device unplug in DEVICE_DELETED handle execution path. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_hotplug.c | 38 +++--- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git

[libvirt] [PATCH v3 REBASE 2 09/12] qemu: handle host usb device plug/unplug when libvirtd is down

2019-10-29 Thread Nikolay Shirokovskiy
Somebody can easily unplug usb device from host while libvirtd is being stopped. Also usb device can be plugged or unplugged/plugged back and so forth. Let's handle such cases. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_process.c | 56

[libvirt] [PATCH v3 REBASE 2 04/12] qemu: support usb hostdev plugging back

2019-10-29 Thread Nikolay Shirokovskiy
We are going to use qemuDomainAttachHostUSBDevice when host usb device is plugged back to node. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_hotplug.c | 29 - 1 file changed, 24 insertions(+), 5 deletions(-) diff --git

[libvirt] [PATCH v3 REBASE 2 06/12] qemu: handle libvirtd restart after host usb device unplug

2019-10-29 Thread Nikolay Shirokovskiy
It is possible for libvirtd to go down before DEVICE_DELETED event is delivered upon usb hostdev unplug and to receive the event after the libvirtd is up. In order to handle this case we need to save usb hostdev deleteAction in status file. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel