[libvirt] [PATCH 01/12] conf: numatune: Extract code for requesting memory nodeset from formatting

2015-01-28 Thread Peter Krempa
Extract the logic to determine which nodeset has to be used for a domain from the formatting step so that it can be reused separately when the nodeset is used in a different way. --- src/conf/numatune_conf.c | 33 ++--- src/conf/numatune_conf.h | 5 +

[libvirt] [PATCH 06/12] qemu: command: Add helper to format -object strings from JSON representation

2015-01-28 Thread Peter Krempa
Unlike -device, qemu uses a JSON object to add backend objects via the monitor rather than the string that would be passed on the commandline. To be able to reuse code parts that configure backends for various devices, this patch adds a helper that will allow generating the command line

[libvirt] [PATCH 00/12] memory hotplug: Preliminary fixes and cleanups

2015-01-28 Thread Peter Krempa
This series was split out from my memory hotplug series that is not quite ready yet. The aim of this series is to refactor the code that creates commandline for the memory-backend-* qemu object so that it can be later reused for hotplug via monitor. Additionally this series also fixes a bug in

[libvirt] [PATCH 02/12] test: utils: Add helpers for automatic numbering of test cases

2015-01-28 Thread Peter Krempa
Adding or reordering test cases is usually a pain due to static test case names that are then passed to virtTestRun(). To ease the numbering of test cases, this patch adds two simple helpers that generate the test names according to the order they are run. The test name can be configured via the

[libvirt] [PATCH 04/12] util: json: Add functions to convert JSON arrays from/to virBitmaps

2015-01-28 Thread Peter Krempa
To be able to easily represent nodesets and other data stored in virBitmaps in libvirt, this patch introduces a set of helpers that allow to convert the bitmap to and from JSON value objects. --- src/libvirt_private.syms | 2 + src/util/virjson.c | 113

Re: [libvirt] [PATCHv2 1/2] storage: introduce btrfsCloneFile() for COW copy

2015-01-28 Thread Chen, Hanxiao
-Original Message- From: Ján Tomko [mailto:jto...@redhat.com] Sent: Tuesday, January 27, 2015 8:46 PM To: Chen, Hanxiao/陈 晗霄; libvir-list@redhat.com Subject: Re: [libvirt] [PATCHv2 1/2] storage: introduce btrfsCloneFile() for COW copy On 01/23/2015 11:22 AM, Chen Hanxiao

Re: [libvirt] [PATCH v2 1/9] virstoragefile: Add virStorageSourceGetBackingStore

2015-01-28 Thread Michal Privoznik
On 21.01.2015 16:29, Matthias Gatto wrote: Create virStorageSourceGetBackingStore function in preparation for quorum: Actually, if we want to get a backing store inside a virStorageSource we have to do it manually(src-backingStore = backingStore). The problem is that with a quorum, a

Re: [libvirt] [PATCH v2 3/9] virstoragefile: Add virStorageSourceSetBackingStore

2015-01-28 Thread Michal Privoznik
On 21.01.2015 16:29, Matthias Gatto wrote: As explained for virStorageSourceGetBackingStore, quorum allows multiple backing store, this make the operation to set bs complex because we have to check if the backingStore is used as an array or a pointer, and set it differently in both case. In

Re: [libvirt] [PATCH v2 5/9] virstoragefile: Treat backingStore as a pointer or an array

2015-01-28 Thread Michal Privoznik
On 21.01.2015 16:29, Matthias Gatto wrote: As explain in the former patchs, backingStore can be treat an array or a pointer. If we have only one backingStore we have to use it as a normal ptr but if there is more backing store, we use it as a pointer's array. Because it would be complicated

Re: [libvirt] [PATCH v2 2/9] virstoragefile: Always use virStorageSourceGetBackingStore to get backing store

2015-01-28 Thread Michal Privoznik
On 21.01.2015 16:29, Matthias Gatto wrote: Uniformize backing store usage by calling virStorageSourceGetBackingStore instead of setting backing store manually. Signed-off-by: Matthias Gatto matthias.ga...@outscale.com --- src/conf/domain_conf.c| 7 ---

[libvirt] [PATCHv2 1/2] Split qemuDomainChrInsert into two parts

2015-01-28 Thread Ján Tomko
Do the allocation first, then add the actual device. The second part should never fail. This is good for live hotplug where we don't want to remove the device on OOM after the monitor command succeeded. The only change in behavior is that on failure, the vmdef-consoles array is freed, not just

[libvirt] [PATCHv2 2/2] hotplug: only add a chardev to vmdef after monitor call

2015-01-28 Thread Ján Tomko
https://bugzilla.redhat.com/show_bug.cgi?id=1161024 This way the device is in vmdef only if ret = 0 and the caller (qemuDomainAttachDeviceFlags) does not free it. Otherwise it might get double freed by qemuProcessStop and qemuDomainAttachDeviceFlags if the domain crashed in monitor after we've

[libvirt] [PATCHv2 0/2] Really fix the crash on qemu crash on chardev hotplug

2015-01-28 Thread Ján Tomko
An alternative solution that only adds the chardev to the definition after the command succeeded. Ján Tomko (2): Split qemuDomainChrInsert into two parts hotplug: only add a chardev to vmdef after monitor call src/conf/domain_conf.c | 18 -- src/conf/domain_conf.h | 7 ++--

Re: [libvirt] [PATCH v2 4/9] virstoragefile: Always use virStorageSourceSetBackingStore to set backing store

2015-01-28 Thread Michal Privoznik
On 21.01.2015 16:29, Matthias Gatto wrote: Replace the parts of the code where a backing store is set manually with virStorageSourceSetBackingStore Signed-off-by: Matthias Gatto matthias.ga...@outscale.com --- src/conf/domain_conf.c | 2 +- src/conf/storage_conf.c | 4

[libvirt] [PATCH 12/12] qemu: command: Don't combine old and modern NUMA node creation

2015-01-28 Thread Peter Krempa
Change done by commit f309db1f4d51009bad0d32e12efc75530b66836b wrongly assumes that qemu can start with a combination of NUMA nodes specified with the memdev option and the appropriate backends, and the legacy way by specifying only mem as a size argument. QEMU rejects such commandline though: $

[libvirt] [PATCH 11/12] qemu: command: Refactor NUMA backend object formatting to use JSON objs

2015-01-28 Thread Peter Krempa
With the new JSON to argv formatter we are now able to represent the memory backend definitions in the JSON object format that is reusable for monitor use (hotplug) and then convert it into the shell string. This will avoid having two separate instances of the same code that would create the

[libvirt] [PATCH 09/12] qemu: command: Unify values for boolean values when formating memory backends

2015-01-28 Thread Peter Krempa
QEMU's qapi visitor code allows yes/on/y for true and no/off/n for false value of boolean properities. Unify the used style so that we can generate it later and fix test cases. --- src/qemu/qemu_command.c | 4 ++--

[libvirt] [PATCH 10/12] qemu: command: Switch to bytes when formatting size for memory backends

2015-01-28 Thread Peter Krempa
QEMU's command line visitor as well as the JSON interface take bytes by default for memory object sizes. Convert mebibytes to bytes so that we can later refactor the existing code for hotplug purposes. --- src/qemu/qemu_command.c| 2 +-

Re: [libvirt] [PATCHv2 0/2] Really fix the crash on qemu crash on chardev hotplug

2015-01-28 Thread Michal Privoznik
On 28.01.2015 10:14, Ján Tomko wrote: An alternative solution that only adds the chardev to the definition after the command succeeded. Ján Tomko (2): Split qemuDomainChrInsert into two parts hotplug: only add a chardev to vmdef after monitor call src/conf/domain_conf.c | 18

Re: [libvirt] [PATCH v2 5/9] virstoragefile: Treat backingStore as a pointer or an array

2015-01-28 Thread Matthias Gatto
On Wed, Jan 28, 2015 at 11:10 AM, Michal Privoznik mpriv...@redhat.com wrote: On 21.01.2015 16:29, Matthias Gatto wrote: As explain in the former patchs, backingStore can be treat an array or a pointer. If we have only one backingStore we have to use it as a normal ptr but if there is more

[libvirt] [PATCH 03/12] util: json: make value object creator universal by supporting adding

2015-01-28 Thread Peter Krempa
To allow constructing of value objects stepwise explode the helper into separate steps and allow appending into existing value objects. --- src/libvirt_private.syms | 2 ++ src/util/virjson.c | 74 +++- src/util/virjson.h | 5 3 files

[libvirt] [PATCH 05/12] util: json: add helper to iterate JSON object key=value pairs

2015-01-28 Thread Peter Krempa
This helper easies iterating all key=value pairs stored in a JSON object. Usually we pick only certain known keys from a JSON object, but this will allow to walk complete objects and have the callback act on those. --- src/libvirt_private.syms | 1 + src/util/virjson.c | 33

[libvirt] [PATCH 08/12] qemu: command: Shuffle around formating of alias for memory backend objs

2015-01-28 Thread Peter Krempa
Move the alias as the second formated argument and tweak the tests so that a future refactor that will change the order doesn't break tests. --- src/qemu/qemu_command.c| 9 - .../qemuxml2argvdata/qemuxml2argv-hugepages-pages.args | 16

[libvirt] [PATCH 07/12] qemu: Extract code to setup memory backing objects

2015-01-28 Thread Peter Krempa
Extract the memory backend device code into a separate function so that it can be later easily refactored and reused. Few small changes for future reusability, namely: - new (currently unused) parameter for user specified page size - size of the memory is specified in kibibytes, divided up in the

Re: [libvirt] [PATCHv2 2/2] hotplug: only add a chardev to vmdef after monitor call

2015-01-28 Thread Michal Privoznik
On 28.01.2015 10:14, Ján Tomko wrote: https://bugzilla.redhat.com/show_bug.cgi?id=1161024 This way the device is in vmdef only if ret = 0 and the caller (qemuDomainAttachDeviceFlags) does not free it. Otherwise it might get double freed by qemuProcessStop and qemuDomainAttachDeviceFlags

[libvirt] [java] [PATCH 0/6] Fix JNA wrapping, fix memory leaks and wrap security model / label function

2015-01-28 Thread Claudio Bley
Hi. First and foremost, this series fixes a few mistakes in the wrapping code found by inspecting the org.libvirt.jna.Libvirt interface and the corresponding C types of the XML API file. The last two patches add two missing functions introduced in libvirt 0.6.1. At the end of the day, this

[libvirt] [java] [PATCH 4/6] Use the CString class for Arrays of CStrings too

2015-01-28 Thread Claudio Bley
Change the prototypes of the JNA library interface in order to take advantage of the CString class. This removes a fair amount of code in the org.libvirt.Library class and puts the decoding of C string data into a single place. --- src/main/java/org/libvirt/Connect.java | 20 +++---

Re: [libvirt] [PATCH] qemu: fix cannot set graphic passwd via qemuDomainSaveImageDefineXML

2015-01-28 Thread lhuang
On 01/29/2015 12:25 AM, Michal Privoznik wrote: On 20.01.2015 10:04, Luyao Huang wrote: https://bugzilla.redhat.com/show_bug.cgi?id=1183890 When we try to update a xml to a image file, we will clear the graphics passwd settings, because we do not pass VIR_DOMAIN_XML_SECURE to

[libvirt] [java] [PATCH 5/6] Implement Domain.getSecurityLabel and add SecurityLabel class

2015-01-28 Thread Claudio Bley
This wraps the native virDomainGetSecurityLabel libvirt function available since version 0.6.1. --- src/main/java/org/libvirt/Domain.java| 18 ++ src/main/java/org/libvirt/SecurityLabel.java | 49 src/main/java/org/libvirt/jna/Libvirt.java | 24

[libvirt] [java] [PATCH 3/6] JNA: simplify freeing memory for C strings

2015-01-28 Thread Claudio Bley
Make use of the CString class introduced recently and get rid of some boilerplate code required to release memory at the calling side. --- src/main/java/org/libvirt/Connect.java| 22 +++--- src/main/java/org/libvirt/Domain.java | 33 +++

[libvirt] [java] [PATCH 6/6] Implement Connect.getSecurityModel and add SecurityModel class

2015-01-28 Thread Claudio Bley
--- src/main/java/org/libvirt/Connect.java | 15 +++ src/main/java/org/libvirt/SecurityModel.java | 37 src/main/java/org/libvirt/jna/Libvirt.java | 16 +++- 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644

[libvirt] [java] [PATCH 2/6] JNA: add CString class and fix memory leaks

2015-01-28 Thread Claudio Bley
Some libvirt functions were wrapped using a Java String as return type, although they return a char*. That means the memory allocated by libvirt for those strings is never freed because JNA assumes a const char*. Start to refactor the String handling by using a type-safe Pointer for C Strings,

[libvirt] [java] [PATCH 1/6] JNA: fix wrong return type void vs. int

2015-01-28 Thread Claudio Bley
The functions virEventUpdateTimeout and virConnResetLastError have no return value, they return void. In Java they had been mistakenly wrapped as returning int. --- src/main/java/org/libvirt/jna/Libvirt.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

Re: [libvirt] [PATCHv2 0/6] Resolve issues in disk pool backend

2015-01-28 Thread Michal Privoznik
On 22.01.2015 20:20, John Ferlan wrote: https://bugzilla.redhat.com/show_bug.cgi?id=1138516 v1: http://www.redhat.com/archives/libvir-list/2015-January/msg00465.html In my previous attempt to resolve the issue, I created a stateDir and saved the volume XML for each pool in order to attempt

[libvirt] [PATCH 0/7] Resolve issues saving domain to NFS root squashed client

2015-01-28 Thread John Ferlan
Lots of details here: https://bugzilla.redhat.com/show_bug.cgi?id=1158034 During my investigation I uncovered some other issues which are covered by the first 4 patches. The issues are error path related. The first two patches could be combined, but for now they're apart so that it's proveable

[libvirt] [PATCH 7/7] qemu: qemuOpenFileAs - set flag VIR_FILE_OPEN_FORCE_MODE

2015-01-28 Thread John Ferlan
In the event we're falling into the code that tries to create the file in a forked environment (VIR_FILE_OPEN_FORK) we pass different mode bits, but those are never set because the virFileOpenForceOwnerMode has a check if the OPEN_FORCE_MODE bit is set before attempting to change the mode. Since

[libvirt] [PATCH 5/7] qemu: Don't unconditionally delete file in qemuOpenFileAs

2015-01-28 Thread John Ferlan
If we're expecting to create a file somewhere and that fails for some reason during qemuOpenFileAs, then we unlink the path we're attempting to create leaving no way to determine what the existing privileges, protections, or labels are that caused the failure (open, change owner and group, change

[libvirt] [PATCH 6/7] qemu: remove failed create prior to root squash share path

2015-01-28 Thread John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1158034 In qemuOpenFileAs if we fall into the path where we'll be opening / creating the file using VIR_FILE_OPEN_FORK, we need to first unlink/delete the file we created in the first path; otherwise, the attempt by the child process to open as some

[libvirt] [PATCH 1/7] qemu: Save/restore error in error path for qemuDomainSaveInternal

2015-01-28 Thread John Ferlan
If we get to endjob: because of some error earlier such as perhaps failure from qemuDomainSaveMemory to open/create the save file and the attempt to restart the CPU's fails, then we get the error from that restart attempt displayed to the user rather than the error from the failed attempt to

[libvirt] [PATCH 4/7] virfile: Adjust error path for virFileOpenForked

2015-01-28 Thread John Ferlan
Rather than have a dummy waitpid loop and return of the failure status from recvfd, adjust the logic to save the recvfd error fd and then in priority order: if waitpid failed, use that if waitpid succeeded, but the child reported failure, use that regardless of recvfd status if waitpid succeeded

[libvirt] [PATCH 3/7] virfile: Need to check for ENOTCONN from recvfd failure

2015-01-28 Thread John Ferlan
A gnulib change (commit id 'beae0bdc') causes ENOTCONN to be returned from recvfd which causes us to fall into the throwaway waitpid() call and return ENOTCONN to the caller, this then gets displayed during a 'virsh save' when using a root squashed NFS environment that's trying to save the file as

[libvirt] [PATCH 2/7] qemu: Adjust EndAsyncJob for qemuDomainSaveInternal error path

2015-01-28 Thread John Ferlan
Commit id '540c339a' to fix issues with reference counting and transient domains moved the qemuDomainObjEndAsyncJob call prior to the attempt to restart the guest CPU's resulting in an error: error: Failed to save domain rhel70 to /tmp/pl/rhel70.save error: internal error: unexpected

[libvirt] [PATCH] virsh: man: Document behavior of some blkdeviotune's flags when querying

2015-01-28 Thread Peter Krempa
--live and --config can't be specified together when querying the configuration, but are valid when setting. The man page was hinting that they are valid always. --- tools/virsh.pod | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/virsh.pod b/tools/virsh.pod index

Re: [libvirt] [PATCH] qemu: fix cannot set graphic passwd via qemuDomainSaveImageDefineXML

2015-01-28 Thread Michal Privoznik
On 20.01.2015 10:04, Luyao Huang wrote: https://bugzilla.redhat.com/show_bug.cgi?id=1183890 When we try to update a xml to a image file, we will clear the graphics passwd settings, because we do not pass VIR_DOMAIN_XML_SECURE to qemuDomainDefCopy, qemuDomainDefFormatBuf won't format the

[libvirt] [PATCH] libvirt.spec: remove vbox storage and network .so files

2015-01-28 Thread Pavel Hrdina
Commit 55ea7be7 removed separated modules for vbox_network and vbox_storage drivers but forget to update libvirt.spec.in file. This patch will fix rpm build. Signed-off-by: Pavel Hrdina phrd...@redhat.com --- Pushed under trivial rule. libvirt.spec.in | 2 -- 1 file changed, 2 deletions(-)

Re: [libvirt] [PATCHv2] util: bitmap: Tolerate NULL bitmaps in virBitmapEqual

2015-01-28 Thread Ján Tomko
On 01/26/2015 10:39 AM, Peter Krempa wrote: After virBitmapEqual is able to compare NULL bitmaps few bits of code can be cleaned up. --- Version 2 cleans up code paths that would do a duplicate check now. src/conf/domain_conf.c | 40 ++--

[libvirt] [PATCH] schemas: Allow all generic elements and attributes for all interfaces

2015-01-28 Thread Michal Privoznik
There are some interface types (notably 'server' and 'client') which instead of allowing the default set of elements and attributes (like the rest do), try to enumerate only the elements they know of. This way it's, however, easy to miss something. For instance, the address/ element was not