[libvirt] [PATCH v3 3/4] m4: checking if ssh_session_update_known_hosts() exists.

2018-11-23 Thread Julio Faracco
This commit adds some checks inside libssh m4 checking to verify if ssh_session_update_known_hosts function is available. This new function scope replaces the old ssh_write_knownhost() from libssh 0.8.0 and below versions. Signed-off-by: Julio Faracco --- m4/virt-libssh.m4 | 4 1 file chang

[libvirt] [PATCH v3 4/4] rpc: replacing ssh_write_knownhost() by ssh_session_update_known_hosts().

2018-11-23 Thread Julio Faracco
After version 0.8.0, libssh deprecated the function scope ssh_write_knownhost() and moved to ssh_session_update_known_hosts(). So, libvirt is failing to compile using this new function name. Signed-off-by: Julio Faracco --- src/rpc/virnetlibsshsession.c | 2 +- 1 file changed, 1 insertion(+), 1

[libvirt] [PATCH v3 2/4] rpc: replacing ssh_is_server_known() by ssh_session_is_known_server().

2018-11-23 Thread Julio Faracco
After version 0.8.0, libssh deprecated the function scope ssh_is_server_known() and moved to ssh_session_is_known_server(). So, libvirt is failing to compile using this new function name. Signed-off-by: Julio Faracco --- src/rpc/virnetlibsshsession.c | 16 1 file changed, 16 ins

[libvirt] [PATCH v3 0/4] rpc: fixing compilation error due to deprecated functions.

2018-11-23 Thread Julio Faracco
After 0.8.0 release, libssh deprecated some functions like: ssh_is_server_known() and ssh_write_knownhost(). They were replaced by ssh_session_is_known_server() and ssh_session_update_known_hosts() respectively. This serie creates the alias to keep the compatibility and create an auxiliar enum to h

[libvirt] [PATCH v3 1/4] m4: checking if ssh_session_is_known_server() exists.

2018-11-23 Thread Julio Faracco
This commit adds some checks inside libssh m4 checking to verify if ssh_session_is_known_server function is available. This new function scope replaces the old ssh_is_server_known() from libssh 0.8.0 and below versions. Another auxiliar enumerator was added to keep the compatibility with the old s

Re: [libvirt] [PATCHv2 01/16] qemu: Add KVM CPUs into cache only if KVM is present

2018-11-23 Thread Roman Bolshakov
On Fri, Nov 23, 2018 at 06:16:46PM +0100, Jiri Denemark wrote: > On Fri, Nov 23, 2018 at 18:55:00 +0300, Roman Bolshakov wrote: > > On Fri, Nov 23, 2018 at 04:30:13PM +0100, Jiri Denemark wrote: > > > On Fri, Nov 23, 2018 at 17:16:12 +0300, Roman Bolshakov wrote: > > > > On Wed, Nov 21, 2018 at 07:

Re: [libvirt] [PATCHv9 1/2] qemu: Report cache occupancy (CMT) with domstats

2018-11-23 Thread John Ferlan
On 11/20/18 8:56 AM, Wang Huaqiang wrote: > Adding the interface in qemu to report CMT statistic information > through command 'virsh domstats --cpu-total'. > > Below is a typical output: > > # virsh domstats 1 --cpu-total > Domain: 'ubuntu16.04-base' >... >

Re: [libvirt] [PATCHv2 01/16] qemu: Add KVM CPUs into cache only if KVM is present

2018-11-23 Thread Jiri Denemark
On Fri, Nov 23, 2018 at 18:55:00 +0300, Roman Bolshakov wrote: > On Fri, Nov 23, 2018 at 04:30:13PM +0100, Jiri Denemark wrote: > > On Fri, Nov 23, 2018 at 17:16:12 +0300, Roman Bolshakov wrote: > > > On Wed, Nov 21, 2018 at 07:43:43PM +0100, Jiri Denemark wrote: > > > > virQEMUCapsInitHostCPUModel

Re: [libvirt] [PATCHv2 01/16] qemu: Add KVM CPUs into cache only if KVM is present

2018-11-23 Thread Roman Bolshakov
On Fri, Nov 23, 2018 at 04:30:13PM +0100, Jiri Denemark wrote: > On Fri, Nov 23, 2018 at 17:16:12 +0300, Roman Bolshakov wrote: > > On Wed, Nov 21, 2018 at 07:43:43PM +0100, Jiri Denemark wrote: > > > virQEMUCapsInitHostCPUModel always fills in something and your check > > > should probably remain

Re: [libvirt] [PATCHv2 01/16] qemu: Add KVM CPUs into cache only if KVM is present

2018-11-23 Thread Jiri Denemark
On Fri, Nov 23, 2018 at 17:16:12 +0300, Roman Bolshakov wrote: > On Wed, Nov 21, 2018 at 07:43:43PM +0100, Jiri Denemark wrote: > > On Wed, Nov 21, 2018 at 20:50:50 +0300, Roman Bolshakov wrote: > > > On Wed, Nov 21, 2018 at 05:04:07PM +0100, Jiri Denemark wrote: > > > > On Wed, Nov 21, 2018 at 17:

Re: [libvirt] [PATCH v2 0/4] rpc: fixing compilation error due to deprecated functions.

2018-11-23 Thread no-reply
Hi, This series was run against 'syntax-check' test by patchew.org, which failed, please find the details below: Type: series Subject: [libvirt] [PATCH v2 0/4] rpc: fixing compilation error due to deprecated functions. Message-id: 20181123150154.28335-1-jcfara...@gmail.com === TEST SCRIPT BEGI

Re: [libvirt] [PATCHv2 07/16] qemu: Introduce virQEMUCapsTypeIsAccelerated

2018-11-23 Thread Roman Bolshakov
On Fri, Nov 23, 2018 at 03:27:50PM +0100, Pino Toscano wrote: > On Wednesday, 21 November 2018 15:01:50 CET Roman Bolshakov wrote: > > +static bool > > +virQEMUCapsTypeIsAccelerated(virDomainVirtType type) > > +{ > > +return type == VIR_DOMAIN_VIRT_KVM; > > +} > > [...] > > @@ -4966,7 +4971,8 @

Re: [libvirt] [PATCH v2 3/4] qemuMigrationDstPrepareAny: Parse cookie before adding domain onto list

2018-11-23 Thread Jiri Denemark
On Fri, Nov 23, 2018 at 14:23:50 +0100, Michal Privoznik wrote: > There are some checks done when parsing a migration cookie. For > instance, one of the checks ensures that the domain is not being > migrated onto the same host. If that is the case, then we are in > big trouble because the @vm is th

Re: [libvirt] [PATCH v2 2/4] qemuMigrationEatCookie: Pass virDomainDef instead of virDomainObj

2018-11-23 Thread Jiri Denemark
On Fri, Nov 23, 2018 at 14:23:49 +0100, Michal Privoznik wrote: > The function currently takes virDomainObjPtr because it's using > both: the domain definition and domain private data. > Unfortunately, this means that in prepare phase we can't parse > migration cookie before putting incoming domain

[libvirt] [PATCH v2 1/4] m4: checking if ssh_session_is_known_server() exists.

2018-11-23 Thread Julio Faracco
This commit adds some checks inside libssh m4 checking to verify if ssh_session_is_known_server function is available. This new function scope replaces the old ssh_is_server_known() from libssh 0.8.0 and below versions. Another auxiliar enumerator was added to keep the compatibility with the old s

[libvirt] [PATCH v2 2/4] rpc: replacing ssh_is_server_known() by ssh_session_is_known_server().

2018-11-23 Thread Julio Faracco
After version 0.8.0, libssh deprecated the function scope ssh_is_server_known() and moved to ssh_session_is_known_server(). So, libvirt is failing to compile using this new function name. Signed-off-by: Julio Faracco --- src/rpc/virnetlibsshsession.c | 29 ++--- 1 file ch

[libvirt] [PATCH v2 4/4] rpc: replacing ssh_write_knownhost() by ssh_session_update_known_hosts().

2018-11-23 Thread Julio Faracco
After version 0.8.0, libssh deprecated the function scope ssh_write_knownhost() and moved to ssh_session_update_known_hosts(). So, libvirt is failing to compile using this new function name. Signed-off-by: Julio Faracco --- src/rpc/virnetlibsshsession.c | 2 +- 1 file changed, 1 insertion(+), 1

[libvirt] [PATCH v2 0/4] rpc: fixing compilation error due to deprecated functions.

2018-11-23 Thread Julio Faracco
After 0.8.0 release, libssh deprecated some functions like: ssh_is_server_known() and ssh_write_knownhost(). They were replaced by ssh_session_is_known_server() and ssh_session_update_known_hosts() respectively. This serie creates the alias to keep the compatibility and create an auxiliar enum to h

[libvirt] [PATCH v2 3/4] m4: checking if ssh_session_update_known_hosts() exists.

2018-11-23 Thread Julio Faracco
This commit adds some checks inside libssh m4 checking to verify if ssh_session_update_known_hosts function is available. This new function scope replaces the old ssh_write_knownhost() from libssh 0.8.0 and below versions. Signed-off-by: Julio Faracco --- m4/virt-libssh.m4 | 4 1 file chang

Re: [libvirt] [PATCHv2 07/16] qemu: Introduce virQEMUCapsTypeIsAccelerated

2018-11-23 Thread Pino Toscano
On Wednesday, 21 November 2018 15:01:50 CET Roman Bolshakov wrote: > +static bool > +virQEMUCapsTypeIsAccelerated(virDomainVirtType type) > +{ > +return type == VIR_DOMAIN_VIRT_KVM; > +} > [...] > @@ -4966,7 +4971,8 @@ virQEMUCapsCacheLookupDefault(virFileCachePtr cache, > if (virttype ==

Re: [libvirt] [PATCHv2 01/16] qemu: Add KVM CPUs into cache only if KVM is present

2018-11-23 Thread Roman Bolshakov
On Wed, Nov 21, 2018 at 07:43:43PM +0100, Jiri Denemark wrote: > On Wed, Nov 21, 2018 at 20:50:50 +0300, Roman Bolshakov wrote: > > On Wed, Nov 21, 2018 at 05:04:07PM +0100, Jiri Denemark wrote: > > > On Wed, Nov 21, 2018 at 17:01:44 +0300, Roman Bolshakov wrote: > > > > diff --git a/src/qemu/qemu_

[libvirt] [PATCH v2 4/4] qemuMigrationSrcConfirm: Don't remove domain config if confirm phase fails

2018-11-23 Thread Michal Privoznik
If migration is cancelled or confirm phase fails the domain should be kept on the source even if VIR_MIGRATE_UNDEFINE_SOURCE was requested. Signed-off-by: Michal Privoznik Reviewed-by: Jiri Denemark --- src/qemu/qemu_migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[libvirt] [PATCH v2 1/4] qemuMigrationDstPrepareAny: Don't overwrite error in cleanup path

2018-11-23 Thread Michal Privoznik
There are several functions called in the cleanup path. Some of them do report error (e.g. qemuDomainRemoveInactiveJob()) which may result in overwriting an error reported earlier with some less useful message. Signed-off-by: Michal Privoznik Reviewed-by: Jiri Denemark --- src/qemu/qemu_migrati

[libvirt] [PATCH v2 0/4] qemu: Fix offline migration onto the same host

2018-11-23 Thread Michal Privoznik
v2 of: https://www.redhat.com/archives/libvir-list/2018-November/msg00832.html diff to v1: - in 2/4 I'm passing @priv whenever possible - only doing s/priv/NULL/ in 3/4 as suggested in review Patches 1/4 and 4/4 are reviewed already (not pushed yet though). Michal Prívozník (4): qemuMigration

[libvirt] [PATCH v2 3/4] qemuMigrationDstPrepareAny: Parse cookie before adding domain onto list

2018-11-23 Thread Michal Privoznik
There are some checks done when parsing a migration cookie. For instance, one of the checks ensures that the domain is not being migrated onto the same host. If that is the case, then we are in big trouble because the @vm is the same domain object used by source and it has some jobs sets and everyt

[libvirt] [PATCH v2 2/4] qemuMigrationEatCookie: Pass virDomainDef instead of virDomainObj

2018-11-23 Thread Michal Privoznik
The function currently takes virDomainObjPtr because it's using both: the domain definition and domain private data. Unfortunately, this means that in prepare phase we can't parse migration cookie before putting incoming domain def onto domain objects list (addressed in the very next commit). Chang

Re: [libvirt] [PATCH 3/4] qemuMigrationDstPrepareAny: Parse cookie before adding domain onto list

2018-11-23 Thread Jiri Denemark
On Thu, Nov 22, 2018 at 14:16:17 +0100, Michal Privoznik wrote: > There are some checks done when parsing a migration cookie. For > instance, one of the checks ensures that the domain is not being > migrated onto the same host. If that is the case, then we are in > big trouble because the @vm is th

Re: [libvirt] [PATCH 2/4] qemuMigrationEatCookie: Pass virDomainDef instead of virDomainObj

2018-11-23 Thread Jiri Denemark
On Thu, Nov 22, 2018 at 14:16:16 +0100, Michal Privoznik wrote: > The function currently takes virDomainObjPtr because it's using > both: the domain definition and domain private data. > Unfortunately, this means that in prepare phase we can't parse > migration cookie before putting incoming domain

Re: [libvirt] [PATCH 1/4] qemuMigrationDstPrepareAny: Don't overwrite error in cleanup path

2018-11-23 Thread Jiri Denemark
On Thu, Nov 22, 2018 at 14:16:15 +0100, Michal Privoznik wrote: > There are several functions called in the cleanup path. Some of > them do report error (e.g. qemuDomainRemoveInactiveJob()) which > may result in overwriting an error reported earlier with some > less useful message. > > Signed-off-

Re: [libvirt] [PATCH 4/4] qemuMigrationSrcConfirm: Don't remove domain config if confirm phase fails

2018-11-23 Thread Jiri Denemark
On Thu, Nov 22, 2018 at 14:16:18 +0100, Michal Privoznik wrote: > If migration is cancelled or confirm phase fails the domain > should be kept on the source even if VIR_MIGRATE_UNDEFINE_SOURCE > was requested. > > Signed-off-by: Michal Privoznik > --- > src/qemu/qemu_migration.c | 2 +- > 1 file

Re: [libvirt] [PATCH] virsh: Strip XML declaration when extracting CPU XMLs

2018-11-23 Thread Jiri Denemark
On Thu, Nov 22, 2018 at 17:39:16 +0100, Ján Tomko wrote: > On Thu, Nov 22, 2018 at 04:46:33PM +0100, Jiri Denemark wrote: > >Since commit v4.3.0-336-gc84726fbdd all > >{hypervisor-,}cpu-{baseline,compare} commands use a generic > >vshExtractCPUDefXMLs helper for extracting individual CPU definition

Re: [libvirt] [jenkins-ci PATCH] Revert "Enable {media, tree}uri tests for libosinfo"

2018-11-23 Thread Fabiano Fidêncio
On Fri, 2018-11-23 at 10:14 +0100, Andrea Bolognani wrote: > While a very good idea in theory, it turns out that running > these tests on CI results in a lot of false positives due to > issues on the remote side, which are of course entirely out > of our control. > > This reverts commit ad8cdcf7a1

[libvirt] [jenkins-ci PATCH] Revert "Enable {media, tree}uri tests for libosinfo"

2018-11-23 Thread Andrea Bolognani
While a very good idea in theory, it turns out that running these tests on CI results in a lot of false positives due to issues on the remote side, which are of course entirely out of our control. This reverts commit ad8cdcf7a1e0e293e3cea19f36187b943bb881dd. Signed-off-by: Andrea Bolognani ---

[libvirt] [PATCH 07/18] virSecurityDACRestoreAllLabel: Restore more labels

2018-11-23 Thread Michal Privoznik
We are setting label on kernel, initrd, dtb and slic_table files. But we never restored it. Signed-off-by: Michal Privoznik --- src/security/security_dac.c | 16 1 file changed, 16 insertions(+) diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 9b3069

[libvirt] [PATCH 15/18] virSecuritySELinuxRestoreAllLabel: Reorder device relabeling

2018-11-23 Thread Michal Privoznik
It helps whe trying to match calls with virSecuritySELinuxSetAllLabel if the order in which devices are set/restored is the same in both functions. Signed-off-by: Michal Privoznik --- src/security/security_selinux.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git

[libvirt] [PATCH 14/18] virSecuritySELinuxTransactionRun: Implement rollback

2018-11-23 Thread Michal Privoznik
When iterating over list of paths/disk sources to relabel it may happen that the process fails at some point. In that case, for the sake of keeping seclabel refcount (stored in XATTRs) in sync with reality we have to perform rollback. However, if that fails too the only thing we can do is warn user

[libvirt] [PATCH 11/18] security_selinux: Track if transaction is restore

2018-11-23 Thread Michal Privoznik
It is going to be important to know if the current transaction we are running is a restore operation or set label operation. Signed-off-by: Michal Privoznik --- src/security/security_selinux.c | 36 +++-- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a

[libvirt] [PATCH 10/18] virSecurityDACRestoreImageLabelInt: Restore even shared/RO disks

2018-11-23 Thread Michal Privoznik
Now that we have seclabel remembering we can safely restore labels for shared and RO disks. In fact we need to do that to keep seclabel refcount stored in XATTRs in sync with reality. Signed-off-by: Michal Privoznik --- src/security/security_dac.c | 8 1 file changed, 8 deletions(-) di

[libvirt] [PATCH 08/18] security_dac: Allow callers to enable/disable label remembering/recall

2018-11-23 Thread Michal Privoznik
Because the implementation that will be used for label remembering/recall is not atomic we have to give callers a chance to enable or disable it. That is, enable it if and only if metadata locking is enabled. Otherwise the feature MUST be turned off. Signed-off-by: Michal Privoznik --- src/secur

[libvirt] [PATCH 16/18] virSecuritySELinuxRestoreAllLabel: Restore more labels

2018-11-23 Thread Michal Privoznik
We are setting label on kernel, initrd, dtb and slic_table files. But we never restored it. Signed-off-by: Michal Privoznik --- src/security/security_selinux.c | 16 1 file changed, 16 insertions(+) diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c

[libvirt] [PATCH 03/18] security: Include security_util

2018-11-23 Thread Michal Privoznik
Signed-off-by: Michal Privoznik --- src/security/Makefile.inc.am | 2 + src/security/security_util.c | 198 +++ src/security/security_util.h | 32 ++ 3 files changed, 232 insertions(+) create mode 100644 src/security/security_util.c create mode 100644 src/

[libvirt] [PATCH 04/18] security_dac: Restore label on failed chown() attempt

2018-11-23 Thread Michal Privoznik
It's important to keep XATTRs untouched (well, in the same state they were in when entering the function). Otherwise our refcounting would be messed up. Signed-off-by: Michal Privoznik --- src/security/security_dac.c | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) dif

[libvirt] [PATCH 12/18] security_selinux: Remember old labels

2018-11-23 Thread Michal Privoznik
Signed-off-by: Michal Privoznik --- src/security/security_selinux.c | 161 ++-- 1 file changed, 114 insertions(+), 47 deletions(-) diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 715d9a428b..4990d94b5f 100644 --- a/src/security/sec

[libvirt] [PATCH 17/18] tools: Provide a script to recover fubar'ed XATTRs setup

2018-11-23 Thread Michal Privoznik
Our code is not bug free. The refcounting I introduced will almost certainly not work in some use cases. Provide a script that will remove all the XATTRs set by libvirt so that it can start cleanly. Signed-off-by: Michal Privoznik --- tools/Makefile.am | 1 + tools/libvirt_recover

[libvirt] [PATCH 05/18] virSecurityDACTransactionRun: Implement rollback

2018-11-23 Thread Michal Privoznik
When iterating over list of paths/disk sources to relabel it may happen that the process fails at some point. In that case, for the sake of keeping seclabel refcount (stored in XATTRs) in sync with reality we have to perform rollback. However, if that fails too the only thing we can do is warn user

[libvirt] [PATCH 18/18] qemu.conf: Allow users to enable/disable label remembering

2018-11-23 Thread Michal Privoznik
Signed-off-by: Michal Privoznik --- src/qemu/libvirtd_qemu.aug | 1 + src/qemu/qemu.conf | 6 ++ src/qemu/qemu_conf.c | 4 src/qemu/test_libvirtd_qemu.aug.in | 1 + 4 files changed, 12 insertions(+) diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu

[libvirt] [PATCH 13/18] security_selinux: Restore label on failed setfilecon() attempt

2018-11-23 Thread Michal Privoznik
It's important to keep XATTRs untouched (well, in the same state they were in when entering the function). Otherwise our refcounting would be messed up. Signed-off-by: Michal Privoznik --- src/security/security_selinux.c | 40 +++-- 1 file changed, 28 insertions(+), 1

[libvirt] [PATCH 06/18] virSecurityDACRestoreAllLabel: Reorder device relabeling

2018-11-23 Thread Michal Privoznik
It helps whe trying to match calls with virSecurityDACSetAllLabel if the order in which devices are set/restored is the same in both functions. Signed-off-by: Michal Privoznik --- src/security/security_dac.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletion

[libvirt] [PATCH 09/18] security_dac: Remember old labels

2018-11-23 Thread Michal Privoznik
Signed-off-by: Michal Privoznik --- src/security/security_dac.c | 48 ++--- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/src/security/security_dac.c b/src/security/security_dac.c index cdbe07543c..9d31faa9d4 100644 --- a/src/security/security_dac.

[libvirt] [PATCH 01/18] security: Unify header conditionals

2018-11-23 Thread Michal Privoznik
To avoid including a header file twice the following pattern is used: #ifndef __SOMETHING__ # define __SOMETHING__ where __SOMETHING__ should correspond to the header file name. However, some of our header files break that pattern. Signed-off-by: Michal Privoznik --- src/security/security_ap

[libvirt] [PATCH 02/18] util: Introduce xattr getter/setter/remover

2018-11-23 Thread Michal Privoznik
Signed-off-by: Michal Privoznik --- src/libvirt_private.syms | 3 + src/util/virfile.c | 121 +++ src/util/virfile.h | 11 3 files changed, 135 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 8889aaa379.

[libvirt] [PATCH 00/18] Implement original label remembering

2018-11-23 Thread Michal Privoznik
Dear list, there were several attempts in the past to implement this feature, but none of them was successful. The problem is that we change security labels when starting a domain but never record the original labels therefore when restoring the labels back in domain shutdown phase we have to go w