Re: [libvirt] [PATCH] virt-aa-helper: Allow parsing supported features for qemu/kvm

2018-01-12 Thread Michal Privoznik
On 01/11/2018 11:09 AM, Shivaprasad G Bhat wrote:
> The virt-aa-helper fails to parse the xmls with the memory/cpu
> hotplug features or user assigned aliases. Set the features in
> xmlopt->config for the parsing to succeed.
> 
> Signed-off-by: Shivaprasad G Bhat 
> ---
>  src/conf/domain_conf.c|   21 -
>  src/conf/domain_conf.h|   21 +
>  src/security/virt-aa-helper.c |7 +++
>  3 files changed, 28 insertions(+), 21 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index a1c2506..20ce83e 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -64,27 +64,6 @@
>  
>  VIR_LOG_INIT("conf.domain_conf");
>  
> -/* This structure holds various callbacks and data needed
> - * while parsing and creating domain XMLs */
> -struct _virDomainXMLOption {
> -virObject parent;
> -
> -/* XML parser callbacks and defaults */
> -virDomainDefParserConfig config;
> -
> -/* domain private data management callbacks */
> -virDomainXMLPrivateDataCallbacks privateData;
> -
> -/* XML namespace callbacks */
> -virDomainXMLNamespace ns;
> -
> -/* ABI stability callbacks */
> -virDomainABIStability abi;
> -
> -/* Private data for save image stored in snapshot XML */
> -virSaveCookieCallbacks saveCookie;
> -};
> -
>  #define VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS \
>  (VIR_DOMAIN_DEF_FORMAT_SECURE | \
>   VIR_DOMAIN_DEF_FORMAT_INACTIVE | \
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 6f7f96b..aacb88a 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -2662,6 +2662,27 @@ struct _virDomainABIStability {
>  virDomainABIStabilityDomain domain;
>  };
>  
> +/* This structure holds various callbacks and data needed
> + * while parsing and creating domain XMLs */
> +struct _virDomainXMLOption {
> +virObject parent;
> +
> +/* XML parser callbacks and defaults */
> +virDomainDefParserConfig config;
> +
> +/* domain private data management callbacks */
> +virDomainXMLPrivateDataCallbacks privateData;
> +
> +/* XML namespace callbacks */
> +virDomainXMLNamespace ns;
> +
> +/* ABI stability callbacks */
> +virDomainABIStability abi;
> +
> +/* Private data for save image stored in snapshot XML */
> +virSaveCookieCallbacks saveCookie;
> +};


No. We want to keep this struct private and use just the accessors.

> +
>  virDomainXMLOptionPtr virDomainXMLOptionNew(virDomainDefParserConfigPtr 
> config,
>  
> virDomainXMLPrivateDataCallbacksPtr priv,
>  virDomainXMLNamespacePtr xmlns,
> diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
> index f7ccae0..8b0ca46 100644
> --- a/src/security/virt-aa-helper.c
> +++ b/src/security/virt-aa-helper.c
> @@ -699,6 +699,13 @@ get_definition(vahControl * ctl, const char *xmlStr)
>  goto exit;
>  }
>  
> +if (virtType == VIR_DOMAIN_VIRT_QEMU || virtType == VIR_DOMAIN_VIRT_KVM) 
> {

Firstly, I don't really understand why this needs to be just limited to
qemu/kvm virt types.

> +ctl->xmlopt->config.features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG 
> |
> +   
> VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN |
> +   
> VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS |
> +   VIR_DOMAIN_DEF_FEATURE_USER_ALIAS;

Secondly, you can set these features when creating the xmlopt object
just a few lines above (not to be seen in the context though). I mean,
what we can have is:

diff --git i/src/security/virt-aa-helper.c w/src/security/virt-aa-helper.c
index f7ccae0b0..e45ccc8b4 100644
--- i/src/security/virt-aa-helper.c
+++ w/src/security/virt-aa-helper.c
@@ -654,6 +654,12 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
 return rc;
 }

+virDomainDefParserConfig virAAHelperDomainDefParserConfig = {
+.features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG |
+VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN |
+VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS |
+VIR_DOMAIN_DEF_FEATURE_USER_ALIAS,
+};

 static int
 get_definition(vahControl * ctl, const char *xmlStr)
@@ -673,7 +679,8 @@ get_definition(vahControl * ctl, const char *xmlStr)
 goto exit;
 }

-if (!(ctl->xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL, NULL,
NULL))) {
+if (!(ctl->xmlopt =
virDomainXMLOptionNew(,
+  NULL, NULL, NULL, NULL))) {
 vah_error(ctl, 0, _("Failed to create XML config object"));
 goto exit;
 }

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2] libvirtd: clarify the TLS conf default vaule setting

2018-01-12 Thread Chen Hanxiao
From: Chen Hanxiao 

As the description of daemon/libvirtd.conf, setting
key_file, cert_file or key_file will override the default value.
But if we set any one of them, we need to set all the rest of them.

This patch clarify that description.

Signed-off-by: Chen Hanxiao 
---
v2:
 fix a typo

 daemon/libvirtd.conf | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf
index 8e0c0d96d..7040ff26b 100644
--- a/daemon/libvirtd.conf
+++ b/daemon/libvirtd.conf
@@ -183,6 +183,9 @@
 #
 
 
+# NB, if the default value of 'key_file', 'cert_file' or
+# 'ca_file' would be changed,
+# all of them should be changed together.
 # Override the default server key file path
 #
 #key_file = "/etc/pki/libvirt/private/serverkey.pem"
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [jenkins-ci PATCH] guests: Install rpcgen when building libvirt

2018-01-12 Thread Andrea Bolognani
The dependency on rpcgen had not been made explicit up until now
because the command was part of the base glibc development packages;
however, Fedora Rawhide now ships it in a separate package, so we
need to list it along with all other dependencies in order for it
to get installed.

Signed-off-by: Andrea Bolognani 
---
 guests/vars/mappings.yml | 6 ++
 guests/vars/projects/libvirt.yml | 1 +
 2 files changed, 7 insertions(+)

diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index eca8dbe..b79757e 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -604,6 +604,12 @@ mappings:
 pkg: readline
 rpm: readline-devel
 
+  rpcgen:
+deb: libc-dev-bin
+rpm: glibc-common
+FedoraRawhide: glibc-rpcgen
+FreeBSD:
+
   rpmbuild:
 rpm: rpm-build
 
diff --git a/guests/vars/projects/libvirt.yml b/guests/vars/projects/libvirt.yml
index 407881d..ba1e4c3 100644
--- a/guests/vars/projects/libvirt.yml
+++ b/guests/vars/projects/libvirt.yml
@@ -67,6 +67,7 @@ packages:
   - qemu-img
   - radvd
   - readline
+  - rpcgen
   - sanlock
   - scrub
   - sheepdog
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] fixed bug:if expand thread pool, will lose some one

2018-01-12 Thread Peter Krempa
On Thu, Jan 11, 2018 at 23:30:41 +0800, Di Wei wrote:
> ---

Could you please provide more information on when this is happening and
what the consequences are? It's really not obvious from the summary and
it's required to be part of the commit message.


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] m4: Don't enable bash-completion by default

2018-01-12 Thread Pavel Hrdina
On Thu, Jan 11, 2018 at 10:22:16PM +0100, Michal Privoznik wrote:
> Due to the way that check logic was written we basically enabled
> bash completion whenever readline was enabled. This is not right
> because it made bash-completion pkg-config module required.
> 
> Signed-off-by: Michal Privoznik 
> ---

Reviewed-by: Pavel Hrdina 


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [resend][PATCH] deamon: use default value if ca_file, cert_file or key_file not set

2018-01-12 Thread Pavel Hrdina
On Fri, Jan 12, 2018 at 05:09:10PM +0800, Chen Hanxiao wrote:
> From: Chen Hanxiao 
> 
> As the description of daemon/libvirtd.conf, setting
> key_file, cert_file or key_file will override the default value.
> But if we set any one of them, we need to set all the rest of them.
> 
> This patch set default value to them as daemon/libvirtd.conf
> described.

NACK, I don't thing this is a good idea.  I would rather fix the
description in the config file.  If you change one of these values
you definitely need to change all of them.

Pavel


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [resend][PATCH] deamon: use default value if ca_file, cert_file or key_file not set

2018-01-12 Thread Jiri Denemark
On Fri, Jan 12, 2018 at 17:09:10 +0800, Chen Hanxiao wrote:
> From: Chen Hanxiao 
> 
> As the description of daemon/libvirtd.conf, setting
> key_file, cert_file or key_file will override the default value.
> But if we set any one of them, we need to set all the rest of them.

I think this is a reasonable behavior. If a default value is not usable
for one of them, the other will likely need to be changed too.

Although ca_file could be separated. In other words, I can imagine
someone wants to change ca_file but keep default values for
cert_file/key_file or keep default ca_file and override
cert_file/key_file. Overriding cert_file or key_file only without also
changing the other one doesn't make a lot of sense.

Anyway, the patch is incorrect...

> This patch set default value to them as daemon/libvirtd.conf
> described.
> 
> Signed-off-by: Chen Hanxiao 
> ---
>  daemon/libvirtd.c | 27 ++-
>  1 file changed, 18 insertions(+), 9 deletions(-)
> 
> diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
> index 6d3b83355..93983f63b 100644
> --- a/daemon/libvirtd.c
> +++ b/daemon/libvirtd.c
> @@ -493,19 +493,28 @@ daemonSetupNetworking(virNetServerPtr srv,
>  config->cert_file ||
>  config->key_file) {
>  if (!config->ca_file) {
> -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -   _("No CA certificate path set to match 
> server key/cert"));
> -goto cleanup;
> +VIR_WARN("Using default path for ca_file");
> +if (VIR_STRDUP(config->ca_file, LIBVIRT_CACERT) < 0) {
> +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +   _("No CA certificate path set to 
> match server key/cert"));

This error message doesn't make any sense now. Not to mention you're
overriding the error which was already set by VIR_STRDUP.

> +goto cleanup;
> +}
>  }
>  if (!config->cert_file) {
> -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -   _("No server certificate path set to 
> match server key"));
> -goto cleanup;
> +VIR_WARN("Using default path for cert_file");
> +if (VIR_STRDUP(config->cert_file, LIBVIRT_SERVERCERT) < 
> 0) {
> +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +   _("No server certificate path set to 
> match server key"));

Dtto.

> +goto cleanup;
> +}
>  }
>  if (!config->key_file) {
> -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -   _("No server key path set to match server 
> cert"));
> -goto cleanup;
> +VIR_WARN("Using default path for key_file");
> +if (VIR_STRDUP(config->key_file, LIBVIRT_SERVERKEY) < 0) 
> {
> +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +   _("No server key path set to match 
> server cert"));

Dtto.

> +goto cleanup;
> +}
>  }
>  VIR_DEBUG("Using CA='%s' cert='%s' key='%s'",
>config->ca_file, config->cert_file, 
> config->key_file);

Jirka

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [resend][PATCH] deamon: use default value if ca_file, cert_file or key_file not set

2018-01-12 Thread Chen Hanxiao


At 2018-01-12 17:44:38, "Jiri Denemark"  wrote:
>On Fri, Jan 12, 2018 at 17:09:10 +0800, Chen Hanxiao wrote:
>> From: Chen Hanxiao 
>> 
>> As the description of daemon/libvirtd.conf, setting
>> key_file, cert_file or key_file will override the default value.
>> But if we set any one of them, we need to set all the rest of them.
>
>I think this is a reasonable behavior. If a default value is not usable
>for one of them, the other will likely need to be changed too.
>
>Although ca_file could be separated. In other words, I can imagine
>someone wants to change ca_file but keep default values for
>cert_file/key_file or keep default ca_file and override
>cert_file/key_file. Overriding cert_file or key_file only without also
>changing the other one doesn't make a lot of sense.
>
>Anyway, the patch is incorrect...
>

Thanks for the review.

I'll post another patch for the description of the conf.

Regards,
- Chen

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [resend][PATCH] deamon: use default value if ca_file, cert_file or key_file not set

2018-01-12 Thread Chen Hanxiao
From: Chen Hanxiao 

As the description of daemon/libvirtd.conf, setting
key_file, cert_file or key_file will override the default value.
But if we set any one of them, we need to set all the rest of them.

This patch set default value to them as daemon/libvirtd.conf
described.

Signed-off-by: Chen Hanxiao 
---
 daemon/libvirtd.c | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 6d3b83355..93983f63b 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -493,19 +493,28 @@ daemonSetupNetworking(virNetServerPtr srv,
 config->cert_file ||
 config->key_file) {
 if (!config->ca_file) {
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-   _("No CA certificate path set to match 
server key/cert"));
-goto cleanup;
+VIR_WARN("Using default path for ca_file");
+if (VIR_STRDUP(config->ca_file, LIBVIRT_CACERT) < 0) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+   _("No CA certificate path set to match 
server key/cert"));
+goto cleanup;
+}
 }
 if (!config->cert_file) {
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-   _("No server certificate path set to match 
server key"));
-goto cleanup;
+VIR_WARN("Using default path for cert_file");
+if (VIR_STRDUP(config->cert_file, LIBVIRT_SERVERCERT) < 0) 
{
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+   _("No server certificate path set to 
match server key"));
+goto cleanup;
+}
 }
 if (!config->key_file) {
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-   _("No server key path set to match server 
cert"));
-goto cleanup;
+VIR_WARN("Using default path for key_file");
+if (VIR_STRDUP(config->key_file, LIBVIRT_SERVERKEY) < 0) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+   _("No server key path set to match 
server cert"));
+goto cleanup;
+}
 }
 VIR_DEBUG("Using CA='%s' cert='%s' key='%s'",
   config->ca_file, config->cert_file, 
config->key_file);
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] qemu: Fix type of a completed job

2018-01-12 Thread Pavel Hrdina
On Thu, Jan 11, 2018 at 10:48:55PM +0100, Jiri Denemark wrote:
> Libvirt 3.7.0 and earlier libvirt reported a migration job as completed
> immediately after QEMU finished sending migration data at which point
> migration was not really complete yet. Commit v3.7.0-29-g3f2d6d829e
> fixed this, but caused a regression in reporting statistics for
> completed jobs which started reporting the job as still running. This
> happened because the completed job statistics including the job status
> are copied from the running job before we finally mark it as completed.
> 
> Let's make sure QEMU_DOMAIN_JOB_STATUS_COMPLETED is always set in the
> completed job info even when the job has not finished yet.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1523036
> 
> Signed-off-by: Jiri Denemark 
> ---
>  src/qemu/qemu_migration.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

Reviewed-by: Pavel Hrdina 


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] libvirtd: clarify the TLS conf default vaule setting

2018-01-12 Thread Chen Hanxiao
From: Chen Hanxiao 

As the description of daemon/libvirtd.conf, setting
key_file, cert_file or key_file will override the default value.
But if we set any one of them, we need to set all the rest of them.

This patch clarify that description.

Signed-off-by: Chen Hanxiao 
---
 daemon/libvirtd.conf | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf
index 8e0c0d96d..7040ff26b 100644
--- a/daemon/libvirtd.conf
+++ b/daemon/libvirtd.conf
@@ -183,6 +183,9 @@
 #
 
 
+# NB, if the default value of 'key_file', 'cert_file" or
+# 'ca_file' would be changed,
+# all of them should be changed together.
 # Override the default server key file path
 #
 #key_file = "/etc/pki/libvirt/private/serverkey.pem"
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [jenkins-ci PATCH] guests: Install rpcgen when building libvirt

2018-01-12 Thread Michal Privoznik
On 01/12/2018 11:44 AM, Andrea Bolognani wrote:
> The dependency on rpcgen had not been made explicit up until now
> because the command was part of the base glibc development packages;
> however, Fedora Rawhide now ships it in a separate package, so we
> need to list it along with all other dependencies in order for it
> to get installed.
> 
> Signed-off-by: Andrea Bolognani 
> ---
>  guests/vars/mappings.yml | 6 ++
>  guests/vars/projects/libvirt.yml | 1 +
>  2 files changed, 7 insertions(+)
> 

ACK

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH python 2/7] Allow override of which sub-RPMs to build

2018-01-12 Thread Pavel Hrdina
On Thu, Jan 11, 2018 at 04:43:34PM +, Daniel P. Berrange wrote:
> Allow using
> 
>   rpmbuild --define "with_python2 0"
> 
> to override the default logic about which python sub-RPMs to build
> 
> Signed-off-by: Daniel P. Berrange 
> ---
>  libvirt-python.spec.in | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

Reviewed-by: Pavel Hrdina 


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH python 5/7] Adapt to rename of py2 RPMs from python- to python2- prefix

2018-01-12 Thread Pavel Hrdina
On Thu, Jan 11, 2018 at 04:43:37PM +, Daniel P. Berrange wrote:
> Signed-off-by: Daniel P. Berrange 
> ---
>  libvirt-python.spec.in | 12 
>  1 file changed, 12 insertions(+)

Reviewed-by: Pavel Hrdina 

In addition we should rename __python RPM macro to __python2 for fedora
and rhel > 7.  This applies to python_sitearch as well.


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH v2 0/2] processor frequency information on S390

2018-01-12 Thread Bjoern Walk
Since kernel version 4.7, processor frequency information is available
on S390. This patch series extends the parser for system information.

Let's also add a testcase to the test suite for a S390 CPU configuration
running kernel version 4.14 on LPAR.

This is basically patch 3 of this series:
https://www.redhat.com/archives/libvir-list/2017-December/msg00633.html

v1 -> v2:
- add debug logging
- don't discard the whole hostsysinfo when the parsing fails
- don't try to parse a value for external_clock, that information is
  not available on S390
- add test case for to sysinfotest.c

Bjoern Walk (2):
  util: virsysinfo: parse frequency information on S390
  tests: sysinfotest: add new test case for S390

 src/util/virsysinfo.c |  41 ++-
 tests/sysinfodata/s390-freqcpuinfo.data   |  52 +
 tests/sysinfodata/s390-freqsysinfo.data   | 173 ++
 tests/sysinfodata/s390-freqsysinfo.expect |  63 +++
 tests/sysinfotest.c   |   1 +
 5 files changed, 325 insertions(+), 5 deletions(-)
 create mode 100644 tests/sysinfodata/s390-freqcpuinfo.data
 create mode 100644 tests/sysinfodata/s390-freqsysinfo.data
 create mode 100644 tests/sysinfodata/s390-freqsysinfo.expect

-- 
2.13.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 2/2] tests: sysinfotest: add new test case for S390

2018-01-12 Thread Bjoern Walk
Let's add a test case for S390 with CPU frequency information available.
Test data is sampled from an IBM z13 system running kernel 4.14 on LPAR.

Reviewed-by: Boris Fiuczynski 
Signed-off-by: Bjoern Walk 
---
 tests/sysinfodata/s390-freqcpuinfo.data   |  52 +
 tests/sysinfodata/s390-freqsysinfo.data   | 173 ++
 tests/sysinfodata/s390-freqsysinfo.expect |  63 +++
 tests/sysinfotest.c   |   1 +
 4 files changed, 289 insertions(+)
 create mode 100644 tests/sysinfodata/s390-freqcpuinfo.data
 create mode 100644 tests/sysinfodata/s390-freqsysinfo.data
 create mode 100644 tests/sysinfodata/s390-freqsysinfo.expect

diff --git a/tests/sysinfodata/s390-freqcpuinfo.data 
b/tests/sysinfodata/s390-freqcpuinfo.data
new file mode 100644
index ..0edc371d
--- /dev/null
+++ b/tests/sysinfodata/s390-freqcpuinfo.data
@@ -0,0 +1,52 @@
+vendor_id   : IBM/S390
+# processors: 8
+bogomips per cpu: 20325.00
+max thread id   : 1
+features   : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te 
vx sie 
+facilities  : 0 1 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 
24 25 26 27 28 30 31 32 33 34 35 36 37 40 41 42 43 44 45 46 47 48 49 50 51 52 
53 55 57 64 65 66 67 68 69 70 71 72 73 75 76 77 78 80 128 129 131 132 142 143
+cache0  : level=1 type=Data scope=Private size=128K line_size=256 
associativity=8
+cache1  : level=1 type=Instruction scope=Private size=96K 
line_size=256 associativity=6
+cache2  : level=2 type=Data scope=Private size=2048K line_size=256 
associativity=8
+cache3  : level=2 type=Instruction scope=Private size=2048K 
line_size=256 associativity=8
+cache4  : level=3 type=Unified scope=Shared size=65536K line_size=256 
associativity=16
+cache5  : level=4 type=Unified scope=Shared size=491520K line_size=256 
associativity=30
+processor 0: version = 00,  identification = 145F07,  machine = 2964
+processor 1: version = 00,  identification = 145F07,  machine = 2964
+processor 2: version = 00,  identification = 145F07,  machine = 2964
+processor 3: version = 00,  identification = 145F07,  machine = 2964
+processor 4: version = 00,  identification = 145F07,  machine = 2964
+processor 5: version = 00,  identification = 145F07,  machine = 2964
+processor 6: version = 00,  identification = 145F07,  machine = 2964
+processor 7: version = 00,  identification = 145F07,  machine = 2964
+
+cpu number  : 0
+cpu MHz dynamic : 5000
+cpu MHz static  : 5000
+
+cpu number  : 1
+cpu MHz dynamic : 5000
+cpu MHz static  : 5000
+
+cpu number  : 2
+cpu MHz dynamic : 5000
+cpu MHz static  : 5000
+
+cpu number  : 3
+cpu MHz dynamic : 5000
+cpu MHz static  : 5000
+
+cpu number  : 4
+cpu MHz dynamic : 5000
+cpu MHz static  : 5000
+
+cpu number  : 5
+cpu MHz dynamic : 5000
+cpu MHz static  : 5000
+
+cpu number  : 6
+cpu MHz dynamic : 5000
+cpu MHz static  : 5000
+
+cpu number  : 7
+cpu MHz dynamic : 5000
+cpu MHz static  : 5000
diff --git a/tests/sysinfodata/s390-freqsysinfo.data 
b/tests/sysinfodata/s390-freqsysinfo.data
new file mode 100644
index ..1941ef0b
--- /dev/null
+++ b/tests/sysinfodata/s390-freqsysinfo.data
@@ -0,0 +1,173 @@
+Manufacturer: IBM
+Type: 2964
+Model:704  NC9
+Sequence Code:00085F07
+Plant:02
+Model Capacity:   704  0740
+Model Perm. Capacity: 704  0740
+Model Temp. Capacity: 704  0740
+Nominal Cap. Rating:  0740
+Nominal Perm. Rating: 0740
+Nominal Temp. Rating: 0740
+Capacity Adj. Ind.:   100
+Capacity Ch. Reason:  0
+Capacity Transient:   0
+Type 1 Percentage:0
+Type 2 Percentage:0
+Type 3 Percentage:0
+Type 4 Percentage:0
+Type 5 Percentage:0
+
+CPU Topology HW:  0 0 4 2 3 8
+CPU Topology SW:  0 0 4 2 3 8
+CPUs Total:   129
+CPUs Configured:  4
+CPUs Standby: 0
+CPUs Reserved:125
+CPUs G-MTID:  0
+CPUs S-MTID:  1
+Capability:   492
+Nominal Capability:   492
+Secondary Capability: 492
+Adjustment 02-way:61470
+Adjustment 03-way:59694
+Adjustment 04-way:58336
+Adjustment 05-way:56860
+Adjustment 06-way:55918
+Adjustment 07-way:54956
+Adjustment 08-way:53949
+Adjustment 09-way:52689
+Adjustment 10-way:51635
+Adjustment 11-way:50577
+Adjustment 12-way:49584
+Adjustment 13-way:48821
+Adjustment 14-way:47979
+Adjustment 15-way:47170
+Adjustment 16-way:46270
+Adjustment 17-way:45730
+Adjustment 18-way:45292
+Adjustment 19-way:44737
+Adjustment 20-way:44517
+Adjustment 21-way:44019
+Adjustment 22-way:43770
+Adjustment 23-way:43478
+Adjustment 24-way:43216
+Adjustment 25-way:42964
+Adjustment 26-way:42763
+Adjustment 27-way:42529
+Adjustment 28-way:

[libvirt] [PATCH v2 1/2] util: virsysinfo: parse frequency information on S390

2018-01-12 Thread Bjoern Walk
Let's also parse the available processor frequency information on S390
so that it can be utilized by virsh sysinfo:

# virsh sysinfo


  ...
  
2964
IBM/S390
00
5000
145F07
  
  ...


Reviewed-by: Marc Hartmayer 
Reviewed-by: Boris Fiuczynski 
Signed-off-by: Bjoern Walk 
---
 src/util/virsysinfo.c | 41 -
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index ab81b1f7..dc309a7c 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -34,6 +34,7 @@
 #include "virsysinfo.h"
 #include "viralloc.h"
 #include "vircommand.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "virstring.h"
 
@@ -42,6 +43,7 @@
 
 #define VIR_FROM_THIS VIR_FROM_SYSINFO
 
+VIR_LOG_INIT("util.sysinfo");
 
 VIR_ENUM_IMPL(virSysinfo, VIR_SYSINFO_LAST,
   "smbios");
@@ -495,11 +497,12 @@ virSysinfoParseS390Processor(const char *base, 
virSysinfoDefPtr ret)
 char *tmp_base;
 char *manufacturer = NULL;
 char *procline = NULL;
+char *ncpu = NULL;
 int result = -1;
 virSysinfoProcessorDefPtr processor;
 
 if (!(tmp_base = virSysinfoParseS390Line(base, "vendor_id", 
)))
-goto cleanup;
+goto error;
 
 /* Find processor N: line and gather the processor manufacturer,
version, serial number, and family */
@@ -507,10 +510,10 @@ virSysinfoParseS390Processor(const char *base, 
virSysinfoDefPtr ret)
&& (tmp_base = virSysinfoParseS390Line(tmp_base, "processor ",
   ))) {
 if (VIR_EXPAND_N(ret->processor, ret->nprocessor, 1) < 0)
-goto cleanup;
+goto error;
 processor = >processor[ret->nprocessor - 1];
 if (VIR_STRDUP(processor->processor_manufacturer, manufacturer) < 0)
-goto cleanup;
+goto error;
 if (!virSysinfoParseS390Delimited(procline, "version",
   >processor_version,
   '=', ',') ||
@@ -520,15 +523,43 @@ virSysinfoParseS390Processor(const char *base, 
virSysinfoDefPtr ret)
 !virSysinfoParseS390Delimited(procline, "machine",
   >processor_family,
   '=', '\n'))
-goto cleanup;
+goto error;
 
 VIR_FREE(procline);
 }
-result = 0;
+
+/* now, for each processor found, extract the frequency information */
+tmp_base = (char *) base;
+
+while ((tmp_base = strstr(tmp_base, "cpu number")) &&
+   (tmp_base = virSysinfoParseS390Line(tmp_base, "cpu number", 
))) {
+unsigned int n;
+char *mhz = NULL;
+
+if (virStrToLong_uip(ncpu, NULL, 10, ) < 0)
+goto error;
+
+if (n >= ret->nprocessor) {
+VIR_DEBUG("CPU number '%d' out of range", n);
+goto cleanup;
+}
+
+if (!(tmp_base = strstr(tmp_base, "cpu MHz static")) ||
+!virSysinfoParseS390Line(tmp_base, "cpu MHz static", ))
+goto cleanup;
+
+ret->processor[n].processor_max_speed = mhz;
+
+VIR_FREE(ncpu);
+}
 
  cleanup:
+result = 0;
+
+ error:
 VIR_FREE(manufacturer);
 VIR_FREE(procline);
+VIR_FREE(ncpu);
 return result;
 }
 
-- 
2.13.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 0/2] travis: Fix build failure

2018-01-12 Thread Andrea Bolognani
It would be nice to have all greens before the release :)

Andrea Bolognani (2):
  travis: Sync packages with libvirt-jenkins-ci
  travis: Skip nfs-common installation

 .travis.yml | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/2] travis: Sync packages with libvirt-jenkins-ci

2018-01-12 Thread Andrea Bolognani
Make sure we install the same packages lcitool would install on
the CentOS CI so that we have consistent results. The package
list is current as of libvirt-jenkins-ci commit 3a559ae7bc08.
---
 .travis.yml | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index bef991cb9..a62c8eb04 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,11 +19,13 @@ addons:
   apt:
 # Please keep this list sorted alphabetically
 packages:
+  - augeas-tools
   - autoconf
   - automake
   - autopoint
   - ccache
   - dnsmasq-base
+  - dwarves
   - ebtables
   - gcc
   - gettext
@@ -34,6 +36,7 @@ addons:
   - libaudit-dev
   - libavahi-client-dev
   - libblkid-dev
+  - libc-dev-bin
   - libc6-dev
   - libcap-ng-dev
   - libcurl4-gnutls-dev
@@ -52,8 +55,9 @@ addons:
   - librbd-dev
   - libreadline-dev
   - libsasl2-dev
+  - libselinux1-dev
   - libssh2-1-dev
-  - libssl-dev
+  - libssh-dev
   - libtool
   - libudev-dev
   - libxen-dev
@@ -66,8 +70,11 @@ addons:
   - open-iscsi
   - parted
   - patch
+  - perl
   - pkg-config
   - policykit-1
+  - qemu-utils
+  - radvd
   - scrub
   - sheepdog
   - systemtap-sdt-dev
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/2] travis: Skip nfs-common installation

2018-01-12 Thread Andrea Bolognani
Installing nfs-common is broken on trusty since build #807

  https://travis-ci.org/libvirt/libvirt/builds/326705054

It's probably a transient error on Travis' side, so just comment
it out for the time being to allow builds to proceed.

Signed-off-by: Andrea Bolognani 
---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index a62c8eb04..3f26a1eee 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -66,7 +66,7 @@ addons:
   - libyajl-dev
   - lvm2
   - make
-  - nfs-common
+# - nfs-common# broken on trusty since build #807 (2018-01-09)
   - open-iscsi
   - parted
   - patch
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH python 4/7] Add emacs mode marker to activate rpm-spec highlighting

2018-01-12 Thread Pavel Hrdina
On Thu, Jan 11, 2018 at 04:43:36PM +, Daniel P. Berrange wrote:
> Signed-off-by: Daniel P. Berrange 
> ---
>  libvirt-python.spec.in | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Pavel Hrdina 


How about adding the same marker for vim? :)

# vim: set filetype=spec :

However, on Fedora and probably other distributions vim can recognize
the filetype based on the file content.


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [jenkins-ci PATCH] guests: Make rpcgen mapping more future-proof

2018-01-12 Thread Andrea Bolognani
Since whatever is in Fedora Rawhide will end up in future Fedora
releases, it makes sense to use the newer package as default and
override it for existing releases (as well as CentOS), so that
no tweaking will be needed when Fedora 28 and later are added to
the CI setup.

Suggested-by: Peter Krempa 
Signed-off-by: Andrea Bolognani 
---
 guests/vars/mappings.yml | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index b79757e..0b32f90 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -606,8 +606,10 @@ mappings:
 
   rpcgen:
 deb: libc-dev-bin
-rpm: glibc-common
-FedoraRawhide: glibc-rpcgen
+rpm: glibc-rpcgen
+CentOS: glibc-common
+Fedora26: glibc-common
+Fedora27: glibc-common
 FreeBSD:
 
   rpmbuild:
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v2 2/2] tests: sysinfotest: add new test case for S390

2018-01-12 Thread Pino Toscano
On Friday, 12 January 2018 12:38:02 CET Bjoern Walk wrote:
> Let's add a test case for S390 with CPU frequency information available.
> Test data is sampled from an IBM z13 system running kernel 4.14 on LPAR.
> 
> Reviewed-by: Boris Fiuczynski 
> Signed-off-by: Bjoern Walk 
> ---

LGTM, just a couple of notes that came into my mind when reading the
existing sysinfodata for s390.

> diff --git a/tests/sysinfodata/s390-freqcpuinfo.data 
> b/tests/sysinfodata/s390-freqcpuinfo.data
> new file mode 100644
> index ..0edc371d
> --- /dev/null
> +++ b/tests/sysinfodata/s390-freqcpuinfo.data
> [...]
> +processor 0: version = 00,  identification = 145F07,  machine = 2964
> +processor 1: version = 00,  identification = 145F07,  machine = 2964
> +processor 2: version = 00,  identification = 145F07,  machine = 2964
> +processor 3: version = 00,  identification = 145F07,  machine = 2964
> +processor 4: version = 00,  identification = 145F07,  machine = 2964
> +processor 5: version = 00,  identification = 145F07,  machine = 2964
> +processor 6: version = 00,  identification = 145F07,  machine = 2964
> +processor 7: version = 00,  identification = 145F07,  machine = 2964

All the various "identification", and ...

> diff --git a/tests/sysinfodata/s390-freqsysinfo.data 
> b/tests/sysinfodata/s390-freqsysinfo.data
> new file mode 100644
> index ..1941ef0b
> --- /dev/null
> +++ b/tests/sysinfodata/s390-freqsysinfo.data
> @@ -0,0 +1,173 @@
> +Manufacturer: IBM
> +Type: 2964
> +Model:704  NC9
> +Sequence Code:00085F07

.. this value are replaced by what look like dummy values, so maybe
the same should be done for this data too (in case they are sensitive
information)?

-- 
Pino Toscano

signature.asc
Description: This is a digitally signed message part.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH python 6/7] Turn on python3 sub-RPMs for RHEL > 7

2018-01-12 Thread Pavel Hrdina
On Thu, Jan 11, 2018 at 04:43:38PM +, Daniel P. Berrange wrote:
> It is expected that future RHEL-8 will have python3 by default, so enable 
> that.
> It is unclear whether python2 will still be available, so leave that enabled
> for now.
> 
> Signed-off-by: Daniel P. Berrange 
> ---
>  libvirt-python.spec.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Pavel Hrdina 


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2 1/2] util: virsysinfo: parse frequency information on S390

2018-01-12 Thread Pino Toscano
On Friday, 12 January 2018 12:38:01 CET Bjoern Walk wrote:
> +while ((tmp_base = strstr(tmp_base, "cpu number")) &&
> +   (tmp_base = virSysinfoParseS390Line(tmp_base, "cpu number", 
> ))) {
> +unsigned int n;
> +char *mhz = NULL;
> [...]
> +if (n >= ret->nprocessor) {
> +VIR_DEBUG("CPU number '%d' out of range", n);

Since 'n' is unsigned int, then the right printf format is %u.

The rest of the patch seems good to me.

Thanks,
-- 
Pino Toscano

signature.asc
Description: This is a digitally signed message part.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH python 1/7] Allow disabling of python2 RPM build

2018-01-12 Thread Pavel Hrdina
On Thu, Jan 11, 2018 at 04:43:33PM +, Daniel P. Berrange wrote:
> With Fedora modularity, it is possible to have add-on repos for multiple
> versions of python3. It is thus desirable to be able to build libvirt-python
> in these repos, with only the python3 sub-RPMs enabled.
> 
> Thus also helps if future RHEL/Fedora drop python2 entirely from their default
> repos.

Prior to this patch we should also fix the "wrong" usage of
"python_sitearch" on line 26:

# Don't want provides for python shared objects
%{?filter_provides_in: %filter_provides_in %{python_sitearch}/.*\.so}
%{?filter_setup}

We should use python{2,3}_sitearch instead since the old python_sitearch
points only to the default version.  Currently we will not filter
the *.so files for python3.

Otherwise, the patch itself looks good.

Pavel


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH python 3/7] Add checks for min supported distros

2018-01-12 Thread Pavel Hrdina
On Thu, Jan 11, 2018 at 04:43:35PM +, Daniel P. Berrange wrote:
> Be clear about which distros we aim to support with the specfile, so we know
> what we can cleanup in the spec later.

Do we really want to have this limitation?  If so, maybe we can alter
the "requires" message to only warn that it's not tested/supported.

Pavel


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH python 3/7] Add checks for min supported distros

2018-01-12 Thread Ján Tomko

On Fri, Jan 12, 2018 at 12:36:23PM +0100, Pavel Hrdina wrote:

On Thu, Jan 11, 2018 at 04:43:35PM +, Daniel P. Berrange wrote:

Be clear about which distros we aim to support with the specfile, so we know
what we can cleanup in the spec later.


Do we really want to have this limitation?


Yes, please.

Building upstream libvirt on such ancient distros will surely require
more complicated patches than just deleting these checks from the
specfile.


If so, maybe we can alter
the "requires" message to only warn that it's not tested/supported.



Nobody reads warnings, that's why we build with -Werror ;)

Jan


Pavel





--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list




signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 8/8] virsh: Introduce virshSnapshotNameCompleter

2018-01-12 Thread Michal Privoznik
Signed-off-by: Michal Privoznik 
---
 tools/virsh-completer.c | 51 +
 tools/virsh-completer.h |  4 
 tools/virsh-snapshot.c  | 21 +---
 3 files changed, 69 insertions(+), 7 deletions(-)

diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index 7332fa97a..9db7c59d2 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -484,3 +484,54 @@ virshSecretUUIDCompleter(vshControl *ctl,
 VIR_FREE(ret);
 return NULL;
 }
+
+
+char **
+virshSnapshotNameCompleter(vshControl *ctl,
+   const vshCmd *cmd,
+   unsigned int flags)
+{
+virshControlPtr priv = ctl->privData;
+virDomainPtr dom = NULL;
+virDomainSnapshotPtr *snapshots = NULL;
+int nsnapshots = 0;
+size_t i = 0;
+char **ret = NULL;
+
+virCheckFlags(0, NULL);
+
+if (!priv->conn || virConnectIsAlive(priv->conn) <= 0)
+return NULL;
+
+if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
+return NULL;
+
+if ((nsnapshots = virDomainListAllSnapshots(dom, , flags)) < 0)
+goto error;
+
+if (VIR_ALLOC_N(ret, nsnapshots + 1) < 0)
+goto error;
+
+for (i = 0; i < nsnapshots; i++) {
+const char *name = virDomainSnapshotGetName(snapshots[i]);
+
+if (VIR_STRDUP(ret[i], name) < 0)
+goto error;
+
+virshDomainSnapshotFree(snapshots[i]);
+}
+VIR_FREE(snapshots);
+virshDomainFree(dom);
+
+return ret;
+
+ error:
+for (; i < nsnapshots; i++)
+virshDomainSnapshotFree(snapshots[i]);
+VIR_FREE(snapshots);
+for (i = 0; i < nsnapshots; i++)
+VIR_FREE(ret[i]);
+VIR_FREE(ret);
+virshDomainFree(dom);
+return NULL;
+}
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index 0e518873c..fa443d3ad 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -66,4 +66,8 @@ char ** virshSecretUUIDCompleter(vshControl *ctl,
  const vshCmd *cmd,
  unsigned int flags);
 
+char ** virshSnapshotNameCompleter(vshControl *ctl,
+   const vshCmd *cmd,
+   unsigned int flags);
+
 #endif
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index c44a36f98..e4908eea7 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -511,7 +511,8 @@ static const vshCmdOptDef opts_snapshot_edit[] = {
 VIRSH_COMMON_OPT_DOMAIN_FULL(0),
 {.name = "snapshotname",
  .type = VSH_OT_STRING,
- .help = N_("snapshot name")
+ .help = N_("snapshot name"),
+ .completer = virshSnapshotNameCompleter,
 },
 VIRSH_COMMON_OPT_CURRENT(N_("also set edited snapshot as current")),
 {.name = "rename",
@@ -631,7 +632,8 @@ static const vshCmdOptDef opts_snapshot_current[] = {
 },
 {.name = "snapshotname",
  .type = VSH_OT_STRING,
- .help = N_("name of existing snapshot to make current")
+ .help = N_("name of existing snapshot to make current"),
+ .completer = virshSnapshotNameCompleter,
 },
 {.name = NULL}
 };
@@ -854,7 +856,8 @@ static const vshCmdOptDef opts_snapshot_info[] = {
 VIRSH_COMMON_OPT_DOMAIN_FULL(0),
 {.name = "snapshotname",
  .type = VSH_OT_STRING,
- .help = N_("snapshot name")
+ .help = N_("snapshot name"),
+ .completer = virshSnapshotNameCompleter,
 },
 VIRSH_COMMON_OPT_CURRENT(N_("info on current snapshot")),
 {.name = NULL}
@@ -1661,7 +1664,8 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] = {
 {.name = "snapshotname",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
- .help = N_("snapshot name")
+ .help = N_("snapshot name"),
+ .completer = virshSnapshotNameCompleter,
 },
 {.name = "security-info",
  .type = VSH_OT_BOOL,
@@ -1723,7 +1727,8 @@ static const vshCmdOptDef opts_snapshot_parent[] = {
 VIRSH_COMMON_OPT_DOMAIN_FULL(0),
 {.name = "snapshotname",
  .type = VSH_OT_STRING,
- .help = N_("find parent of snapshot name")
+ .help = N_("find parent of snapshot name"),
+ .completer = virshSnapshotNameCompleter,
 },
 VIRSH_COMMON_OPT_CURRENT(N_("find parent of current snapshot")),
 {.name = NULL}
@@ -1782,7 +1787,8 @@ static const vshCmdOptDef opts_snapshot_revert[] = {
 VIRSH_COMMON_OPT_DOMAIN_FULL(0),
 {.name = "snapshotname",
  .type = VSH_OT_STRING,
- .help = N_("snapshot name")
+ .help = N_("snapshot name"),
+ .completer = virshSnapshotNameCompleter,
 },
 VIRSH_COMMON_OPT_CURRENT(N_("revert to current snapshot")),
 {.name = "running",
@@ -1866,7 +1872,8 @@ static const vshCmdOptDef opts_snapshot_delete[] = {
 VIRSH_COMMON_OPT_DOMAIN_FULL(0),
 {.name = "snapshotname",
  .type = VSH_OT_STRING,
- .help = N_("snapshot name")
+ .help = N_("snapshot name"),
+ .completer = 

[libvirt] [PATCH 4/8] virsh: Introduce virshNetworkNameCompleter

2018-01-12 Thread Michal Privoznik
Signed-off-by: Michal Privoznik 
---
 tools/virsh-completer.c | 51 +
 tools/virsh-completer.h |  4 
 tools/virsh-network.c   | 24 ---
 3 files changed, 68 insertions(+), 11 deletions(-)

diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index f5b1e4261..2c0d4f640 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -297,3 +297,54 @@ virshInterfaceNameCompleter(vshControl *ctl,
 VIR_FREE(ret);
 return NULL;
 }
+
+
+char **
+virshNetworkNameCompleter(vshControl *ctl,
+  const vshCmd *cmd ATTRIBUTE_UNUSED,
+  unsigned int flags)
+{
+virshControlPtr priv = ctl->privData;
+virNetworkPtr *nets = NULL;
+int nnets = 0;
+size_t i = 0;
+char **ret = NULL;
+
+virCheckFlags(VIR_CONNECT_LIST_NETWORKS_INACTIVE |
+  VIR_CONNECT_LIST_NETWORKS_ACTIVE |
+  VIR_CONNECT_LIST_NETWORKS_PERSISTENT |
+  VIR_CONNECT_LIST_NETWORKS_TRANSIENT |
+  VIR_CONNECT_LIST_NETWORKS_AUTOSTART |
+  VIR_CONNECT_LIST_NETWORKS_NO_AUTOSTART,
+  NULL);
+
+if (!priv->conn || virConnectIsAlive(priv->conn) <= 0)
+return NULL;
+
+if ((nnets = virConnectListAllNetworks(priv->conn, , flags)) < 0)
+return NULL;
+
+if (VIR_ALLOC_N(ret, nnets + 1) < 0)
+goto error;
+
+for (i = 0; i < nnets; i++) {
+const char *name = virNetworkGetName(nets[i]);
+
+if (VIR_STRDUP(ret[i], name) < 0)
+goto error;
+
+virNetworkFree(nets[i]);
+}
+VIR_FREE(nets);
+
+return ret;
+
+ error:
+for (; i < nnets; i++)
+virNetworkFree(nets[i]);
+VIR_FREE(nets);
+for (i = 0; i < nnets; i++)
+VIR_FREE(ret[i]);
+VIR_FREE(ret);
+return NULL;
+}
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index 2323aaba3..20ba4cb55 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -50,4 +50,8 @@ char ** virshInterfaceNameCompleter(vshControl *ctl,
 const vshCmd *cmd,
 unsigned int flags);
 
+char ** virshNetworkNameCompleter(vshControl *ctl,
+  const vshCmd *cmd,
+  unsigned int flags);
+
 #endif
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index cd55e384f..3b472ea67 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -34,11 +34,13 @@
 #include "virtime.h"
 #include "conf/network_conf.h"
 
-#define VIRSH_COMMON_OPT_NETWORK \
+#define VIRSH_COMMON_OPT_NETWORK(cflags) \
 {.name = "network", \
  .type = VSH_OT_DATA, \
  .flags = VSH_OFLAG_REQ, \
- .help = N_("network name or uuid") \
+ .help = N_("network name or uuid"), \
+ .completer = virshNetworkNameCompleter, \
+ .completer_flags = cflags, \
 }
 
 virNetworkPtr
@@ -93,7 +95,7 @@ static const vshCmdInfo info_network_autostart[] = {
 };
 
 static const vshCmdOptDef opts_network_autostart[] = {
-VIRSH_COMMON_OPT_NETWORK,
+VIRSH_COMMON_OPT_NETWORK(0),
 {.name = "disable",
  .type = VSH_OT_BOOL,
  .help = N_("disable autostarting")
@@ -240,7 +242,7 @@ static const vshCmdInfo info_network_destroy[] = {
 };
 
 static const vshCmdOptDef opts_network_destroy[] = {
-VIRSH_COMMON_OPT_NETWORK,
+VIRSH_COMMON_OPT_NETWORK(VIR_CONNECT_LIST_NETWORKS_ACTIVE),
 {.name = NULL}
 };
 
@@ -279,7 +281,7 @@ static const vshCmdInfo info_network_dumpxml[] = {
 };
 
 static const vshCmdOptDef opts_network_dumpxml[] = {
-VIRSH_COMMON_OPT_NETWORK,
+VIRSH_COMMON_OPT_NETWORK(0),
 {.name = "inactive",
  .type = VSH_OT_BOOL,
  .help = N_("show inactive defined XML")
@@ -330,7 +332,7 @@ static const vshCmdInfo info_network_info[] = {
 };
 
 static const vshCmdOptDef opts_network_info[] = {
-VIRSH_COMMON_OPT_NETWORK,
+VIRSH_COMMON_OPT_NETWORK(0),
 {.name = NULL}
 };
 
@@ -779,7 +781,7 @@ static const vshCmdInfo info_network_start[] = {
 };
 
 static const vshCmdOptDef opts_network_start[] = {
-VIRSH_COMMON_OPT_NETWORK,
+VIRSH_COMMON_OPT_NETWORK(VIR_CONNECT_LIST_NETWORKS_INACTIVE),
 {.name = NULL}
 };
 
@@ -817,7 +819,7 @@ static const vshCmdInfo info_network_undefine[] = {
 };
 
 static const vshCmdOptDef opts_network_undefine[] = {
-VIRSH_COMMON_OPT_NETWORK,
+VIRSH_COMMON_OPT_NETWORK(0),
 {.name = NULL}
 };
 
@@ -856,7 +858,7 @@ static const vshCmdInfo info_network_update[] = {
 };
 
 static const vshCmdOptDef opts_network_update[] = {
-VIRSH_COMMON_OPT_NETWORK,
+VIRSH_COMMON_OPT_NETWORK(0),
 {.name = "command",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
@@ -1057,7 +1059,7 @@ static const vshCmdInfo info_network_edit[] = {
 };
 
 static const vshCmdOptDef opts_network_edit[] = {
-VIRSH_COMMON_OPT_NETWORK,
+

[libvirt] Ping Re: [PATCH V4] blockjob: Fix error checking of blockjob status

2018-01-12 Thread WangJie (Captain)
ping

On 2018/1/5 10:53, Jie Wang wrote:
> offset and len can also be equal to 0 on failed if blockjob return
> status:"BLOCK_JOB_COMPLETED" with error:"File descriptor in bad state",
> so we need to check 'error' in this case.
> ---
>  src/qemu/qemu_monitor_json.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index e45868b..39c0909 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -886,7 +886,7 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
>  case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
>  error = virJSONValueObjectGetString(data, "error");
>  /* Make sure the whole device has been processed */
> -if (offset != len)
> +if (offset != len || error)
>  event = VIR_DOMAIN_BLOCK_JOB_FAILED;
>  break;
>  case VIR_DOMAIN_BLOCK_JOB_CANCELED:
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 9/8] docs: Mention bash completion feature

2018-01-12 Thread Michal Privoznik
Signed-off-by: Michal Privoznik 
---
 docs/news.xml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/docs/news.xml b/docs/news.xml
index 064b9ae83..e5ed89504 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -47,6 +47,17 @@
   qemu: Add support for hot unplugging redirdev device
 
   
+  
+
+  virsh: Enhance bash completion
+
+
+  New bash completion script is introduced to enable completion even
+  for non-interactive virsh. At the same time, virsh offers completion
+  of some basic libvirt objects like domains, networks, storage pools,
+  etc. to virsh commands accepting them.
+
+  
 
 
 
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH python v2 9/9] Use python*_sitearch macros instead of manually defining the dir

2018-01-12 Thread Daniel P. Berrange
Note we use python_sitearch not python2_sitearch, since the former
is more portable.

Signed-off-by: Daniel P. Berrange 
---
 libvirt-python.spec.in | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index f658496..7953c82 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -143,27 +143,27 @@ CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
 %files -n python2-libvirt
 %defattr(-,root,root)
 %doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/
-%{_libdir}/python2*/site-packages/libvirt.py*
-%{_libdir}/python2*/site-packages/libvirt_qemu.py*
-%{_libdir}/python2*/site-packages/libvirt_lxc.py*
-%{_libdir}/python2*/site-packages/libvirtmod*
-%{_libdir}/python2*/site-packages/*egg-info
+%{python_sitearch}/libvirt.py*
+%{python_sitearch}/libvirt_qemu.py*
+%{python_sitearch}/libvirt_lxc.py*
+%{python_sitearch}/libvirtmod*
+%{python_sitearch}/*egg-info
 %endif
 
 %if %{with_python3}
 %files -n python3-libvirt
 %defattr(-,root,root)
 %doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/
-%{_libdir}/python3*/site-packages/libvirt.py*
-%{_libdir}/python3*/site-packages/libvirtaio.py*
-%{_libdir}/python3*/site-packages/libvirt_qemu.py*
-%{_libdir}/python3*/site-packages/libvirt_lxc.py*
-%{_libdir}/python3*/site-packages/__pycache__/libvirt.cpython-*.py*
-%{_libdir}/python3*/site-packages/__pycache__/libvirt_qemu.cpython-*.py*
-%{_libdir}/python3*/site-packages/__pycache__/libvirt_lxc.cpython-*.py*
-%{_libdir}/python3*/site-packages/__pycache__/libvirtaio.cpython-*.py*
-%{_libdir}/python3*/site-packages/libvirtmod*
-%{_libdir}/python3*/site-packages/*egg-info
+%{python3_sitearch}/libvirt.py*
+%{python3_sitearch}/libvirtaio.py*
+%{python3_sitearch}/libvirt_qemu.py*
+%{python3_sitearch}/libvirt_lxc.py*
+%{python3_sitearch}/__pycache__/libvirt.cpython-*.py*
+%{python3_sitearch}/__pycache__/libvirt_qemu.cpython-*.py*
+%{python3_sitearch}/__pycache__/libvirt_lxc.cpython-*.py*
+%{python3_sitearch}/__pycache__/libvirtaio.cpython-*.py*
+%{python3_sitearch}/libvirtmod*
+%{python3_sitearch}/*egg-info
 %endif
 
 %changelog
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] vshReadlineOptionsPrune: Fix possible leak

2018-01-12 Thread Michal Privoznik
The function should prune list of --options so that options
already specified are not offered to user for completion again.
However, if the list of offered options contains a string that
doesn't start with double dash the function returns leaking
partially constructed list. There's not much benefit from trying
to roll back. Just free everything up - our only caller would do
that anyway.

Signed-off-by: Michal Privoznik 
---
 tools/vsh.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/vsh.c b/tools/vsh.c
index 4426c08d6..7db0a16f1 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -2798,8 +2798,17 @@ vshReadlineOptionsPrune(char ***list,
 vshCmdOpt *opt =  last->opts;
 
 /* Should never happen (TM) */
-if (!list_opt)
+if (!list_opt) {
+/* But in case it does, we're in a tough situation
+ * because @list[0..i-1] is possibly sparse. That
+ * means if caller were to call virStringListFree
+ * over it some memory is definitely going to be
+ * leaked. The best we can do is to free from list[i]
+ * as our only caller is just fine with it. */
+virStringListFree(list[i]);
+virStringListFree(newList);
 return -1;
+}
 
 while (opt) {
 if (STREQ(opt->def->name, list_opt)) {
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH python v2 7/9] Require libvirt native version matching py version by default

2018-01-12 Thread Daniel P. Berrange
Although we're capable of building against any libvirt >= 0.9.11, 99% of the
time we want RPM builds to be done against matching libvirt version, otherwise
we might silently build against an unexpected/wrong version.

We don't support building against a native libvirt that's newer than the
python binding, since the generator may incorrectly handle new APIs. So use
== instead of >= too.

Signed-off-by: Daniel P. Berrange 
---
 libvirt-python.spec.in | 2 +-
 setup.py   | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index 48a4933..2dfc84a 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -35,7 +35,7 @@ Source0: 
http://libvirt.org/sources/python/%{name}-%{version}.tar.gz
 Url: http://libvirt.org
 License: LGPLv2+
 Group: Development/Libraries
-BuildRequires: libvirt-devel >= @C_VERSION@
+BuildRequires: libvirt-devel == %{version}
 %if %{with_python2}
 %if %{py2_versioned_deps}
 BuildRequires: python2-devel
diff --git a/setup.py b/setup.py
index 85af965..5e29c8a 100755
--- a/setup.py
+++ b/setup.py
@@ -175,8 +175,7 @@ class my_sdist(sdist):
 f2 = open('libvirt-python.spec', 'w')
 for line in f1:
 f2.write(line
- .replace('@PY_VERSION@', self.distribution.get_version())
- .replace('@C_VERSION@', MIN_LIBVIRT))
+ .replace('@PY_VERSION@', self.distribution.get_version()))
 f1.close()
 f2.close()
 
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 5/8] virsh: Introduce virshNodeDeviceNameCompleter

2018-01-12 Thread Michal Privoznik
Yet again, we don't need listing by device capabilities, so flags
are unused.

Signed-off-by: Michal Privoznik 
---
 tools/virsh-completer.c | 45 +
 tools/virsh-completer.h |  4 
 tools/virsh-nodedev.c   | 16 +++-
 3 files changed, 60 insertions(+), 5 deletions(-)

diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index 2c0d4f640..c50143142 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -348,3 +348,48 @@ virshNetworkNameCompleter(vshControl *ctl,
 VIR_FREE(ret);
 return NULL;
 }
+
+
+char **
+virshNodeDeviceNameCompleter(vshControl *ctl,
+ const vshCmd *cmd ATTRIBUTE_UNUSED,
+ unsigned int flags)
+{
+virshControlPtr priv = ctl->privData;
+virNodeDevicePtr *devs = NULL;
+int ndevs = 0;
+size_t i = 0;
+char **ret = NULL;
+
+virCheckFlags(0, NULL);
+
+if (!priv->conn || virConnectIsAlive(priv->conn) <= 0)
+return NULL;
+
+if ((ndevs = virConnectListAllNodeDevices(priv->conn, , flags)) < 0)
+return NULL;
+
+if (VIR_ALLOC_N(ret, ndevs + 1) < 0)
+goto error;
+
+for (i = 0; i < ndevs; i++) {
+const char *name = virNodeDeviceGetName(devs[i]);
+
+if (VIR_STRDUP(ret[i], name) < 0)
+goto error;
+
+virNodeDeviceFree(devs[i]);
+}
+VIR_FREE(devs);
+
+return ret;
+
+ error:
+for (; i < ndevs; i++)
+virNodeDeviceFree(devs[i]);
+VIR_FREE(devs);
+for (i = 0; i < ndevs; i++)
+VIR_FREE(ret[i]);
+VIR_FREE(ret);
+return NULL;
+}
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index 20ba4cb55..19fa2113d 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -54,4 +54,8 @@ char ** virshNetworkNameCompleter(vshControl *ctl,
   const vshCmd *cmd,
   unsigned int flags);
 
+char ** virshNodeDeviceNameCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
+
 #endif
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index c7ef6bfde..d25fe0e09 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -109,7 +109,8 @@ static const vshCmdOptDef opts_node_device_destroy[] = {
 {.name = "device",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
- .help = N_("device name or wwn pair in 'wwnn,wwpn' format")
+ .help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
+ .completer = virshNodeDeviceNameCompleter,
 },
 {.name = NULL}
 };
@@ -534,6 +535,7 @@ static const vshCmdOptDef opts_node_device_dumpxml[] = {
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
  .help = N_("device name or wwn pair in 'wwnn,wwpn' format"),
+ .completer = virshNodeDeviceNameCompleter,
 },
 {.name = NULL}
 };
@@ -604,7 +606,8 @@ static const vshCmdOptDef opts_node_device_detach[] = {
 {.name = "device",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
- .help = N_("device key")
+ .help = N_("device key"),
+ .completer = virshNodeDeviceNameCompleter,
 },
 {.name = "driver",
  .type = VSH_OT_STRING,
@@ -670,7 +673,8 @@ static const vshCmdOptDef opts_node_device_reattach[] = {
 {.name = "device",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
- .help = N_("device key")
+ .help = N_("device key"),
+ .completer = virshNodeDeviceNameCompleter,
 },
 {.name = NULL}
 };
@@ -720,7 +724,8 @@ static const vshCmdOptDef opts_node_device_reset[] = {
 {.name = "device",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
- .help = N_("device key")
+ .help = N_("device key"),
+ .completer = virshNodeDeviceNameCompleter,
 },
 {.name = NULL}
 };
@@ -866,7 +871,8 @@ static const vshCmdInfo info_node_device_event[] = {
 static const vshCmdOptDef opts_node_device_event[] = {
 {.name = "device",
  .type = VSH_OT_STRING,
- .help = N_("filter by node device name")
+ .help = N_("filter by node device name"),
+ .completer = virshNodeDeviceNameCompleter,
 },
 {.name = "event",
  .type = VSH_OT_STRING,
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/8] virsh: Introduce virshStoragePoolNameCompleter

2018-01-12 Thread Michal Privoznik
Signed-off-by: Michal Privoznik 
---
 tools/virsh-completer.c | 51 +
 tools/virsh-completer.h |  4 
 tools/virsh-pool.c  | 28 +--
 tools/virsh-volume.c| 42 +---
 tools/virsh.h   |  6 --
 5 files changed, 95 insertions(+), 36 deletions(-)

diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index 48dd9fbc2..8ca2fffd9 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -147,3 +147,54 @@ virshDomainInterfaceCompleter(vshControl *ctl,
 virStringListFree(ret);
 return NULL;
 }
+
+
+char **
+virshStoragePoolNameCompleter(vshControl *ctl,
+  const vshCmd *cmd ATTRIBUTE_UNUSED,
+  unsigned int flags)
+{
+virshControlPtr priv = ctl->privData;
+virStoragePoolPtr *pools = NULL;
+int npools = 0;
+size_t i = 0;
+char **ret = NULL;
+
+virCheckFlags(VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE |
+  VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE |
+  VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT |
+  VIR_CONNECT_LIST_STORAGE_POOLS_TRANSIENT |
+  VIR_CONNECT_LIST_STORAGE_POOLS_AUTOSTART |
+  VIR_CONNECT_LIST_STORAGE_POOLS_NO_AUTOSTART,
+  NULL);
+
+if (!priv->conn || virConnectIsAlive(priv->conn) <= 0)
+return NULL;
+
+if ((npools = virConnectListAllStoragePools(priv->conn, , flags)) < 
0)
+return NULL;
+
+if (VIR_ALLOC_N(ret, npools + 1) < 0)
+goto error;
+
+for (i = 0; i < npools; i++) {
+const char *name = virStoragePoolGetName(pools[i]);
+
+if (VIR_STRDUP(ret[i], name) < 0)
+goto error;
+
+virStoragePoolFree(pools[i]);
+}
+VIR_FREE(pools);
+
+return ret;
+
+ error:
+for (; i < npools; i++)
+virStoragePoolFree(pools[i]);
+VIR_FREE(pools);
+for (i = 0; i < npools; i++)
+VIR_FREE(ret[i]);
+VIR_FREE(ret);
+return NULL;
+}
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index 1a2dd685f..249e793b9 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -38,4 +38,8 @@ char ** virshDomainInterfaceCompleter(vshControl *ctl,
   const vshCmd *cmd,
   unsigned int flags);
 
+char ** virshStoragePoolNameCompleter(vshControl *ctl,
+  const vshCmd *cmd,
+  unsigned int flags);
+
 #endif
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 094874b64..cea4cfc12 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -34,8 +34,8 @@
 #include "virstring.h"
 #include "virtime.h"
 
-#define VIRSH_COMMON_OPT_POOL_FULL \
-VIRSH_COMMON_OPT_POOL(N_("pool name or uuid"))
+#define VIRSH_COMMON_OPT_POOL_FULL(cflags) \
+VIRSH_COMMON_OPT_POOL(N_("pool name or uuid"), cflags)
 
 #define VIRSH_COMMON_OPT_POOL_BUILD \
 {.name = "build", \
@@ -182,7 +182,7 @@ static const vshCmdInfo info_pool_autostart[] = {
 };
 
 static const vshCmdOptDef opts_pool_autostart[] = {
-VIRSH_COMMON_OPT_POOL_FULL,
+VIRSH_COMMON_OPT_POOL_FULL(0),
 
 {.name = "disable",
  .type = VSH_OT_BOOL,
@@ -575,7 +575,7 @@ static const vshCmdInfo info_pool_build[] = {
 };
 
 static const vshCmdOptDef opts_pool_build[] = {
-VIRSH_COMMON_OPT_POOL_FULL,
+VIRSH_COMMON_OPT_POOL_FULL(0),
 VIRSH_COMMON_OPT_POOL_NO_OVERWRITE,
 VIRSH_COMMON_OPT_POOL_OVERWRITE,
 
@@ -625,7 +625,7 @@ static const vshCmdInfo info_pool_destroy[] = {
 };
 
 static const vshCmdOptDef opts_pool_destroy[] = {
-VIRSH_COMMON_OPT_POOL_FULL,
+VIRSH_COMMON_OPT_POOL_FULL(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE),
 
 {.name = NULL}
 };
@@ -665,7 +665,7 @@ static const vshCmdInfo info_pool_delete[] = {
 };
 
 static const vshCmdOptDef opts_pool_delete[] = {
-VIRSH_COMMON_OPT_POOL_FULL,
+VIRSH_COMMON_OPT_POOL_FULL(0),
 
 {.name = NULL}
 };
@@ -705,7 +705,7 @@ static const vshCmdInfo info_pool_refresh[] = {
 };
 
 static const vshCmdOptDef opts_pool_refresh[] = {
-VIRSH_COMMON_OPT_POOL_FULL,
+VIRSH_COMMON_OPT_POOL_FULL(0),
 
 {.name = NULL}
 };
@@ -745,7 +745,7 @@ static const vshCmdInfo info_pool_dumpxml[] = {
 };
 
 static const vshCmdOptDef opts_pool_dumpxml[] = {
-VIRSH_COMMON_OPT_POOL_FULL,
+VIRSH_COMMON_OPT_POOL_FULL(0),
 
 {.name = "inactive",
  .type = VSH_OT_BOOL,
@@ -1636,7 +1636,7 @@ static const vshCmdInfo info_pool_info[] = {
 };
 
 static const vshCmdOptDef opts_pool_info[] = {
-VIRSH_COMMON_OPT_POOL_FULL,
+VIRSH_COMMON_OPT_POOL_FULL(0),
 
 {.name = "bytes",
  .type = VSH_OT_BOOL,
@@ -1726,7 +1726,7 @@ static const vshCmdInfo info_pool_name[] = {
 };
 
 static const vshCmdOptDef opts_pool_name[] = {
-VIRSH_COMMON_OPT_POOL_FULL,
+

[libvirt] [PATCH 0/8] virsh: Introduce more completers

2018-01-12 Thread Michal Privoznik
It'd be nice if we could autocomplete the basic types like pools,
volumes, networks, ... before the release.

Michal Privoznik (8):
  virsh: Introduce virshStoragePoolNameCompleter
  virsh: Introduce virshStorageVolNameCompleter
  virsh: Introduce virshInterfaceNameCompleter
  virsh: Introduce virshNetworkNameCompleter
  virsh: Introduce virshNodeDeviceNameCompleter
  virsh: Introduce virshNWFilterNameCompleter
  virsh: Introduce virshSecretUUIDCompleter
  virsh: Introduce virshSnapshotNameCompleter

 tools/virsh-completer.c | 388 
 tools/virsh-completer.h |  32 
 tools/virsh-interface.c |  16 +-
 tools/virsh-network.c   |  24 +--
 tools/virsh-nodedev.c   |  16 +-
 tools/virsh-nwfilter.c  |   9 +-
 tools/virsh-pool.c  |  28 ++--
 tools/virsh-secret.c|  15 +-
 tools/virsh-snapshot.c  |  21 ++-
 tools/virsh-volume.c|  45 +++---
 tools/virsh.h   |   6 +-
 11 files changed, 525 insertions(+), 75 deletions(-)

-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 6/8] virsh: Introduce virshNWFilterNameCompleter

2018-01-12 Thread Michal Privoznik
The virConnectListAllNWFilters() has no extra flags yet, which
simplifies things a bit.

Signed-off-by: Michal Privoznik 
---
 tools/virsh-completer.c | 45 +
 tools/virsh-completer.h |  4 
 tools/virsh-nwfilter.c  |  9 ++---
 3 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index c50143142..9e6f086c0 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -393,3 +393,48 @@ virshNodeDeviceNameCompleter(vshControl *ctl,
 VIR_FREE(ret);
 return NULL;
 }
+
+
+char **
+virshNWFilterNameCompleter(vshControl *ctl,
+   const vshCmd *cmd ATTRIBUTE_UNUSED,
+   unsigned int flags)
+{
+virshControlPtr priv = ctl->privData;
+virNWFilterPtr *nwfilters = NULL;
+int nnwfilters = 0;
+size_t i = 0;
+char **ret = NULL;
+
+virCheckFlags(0, NULL);
+
+if (!priv->conn || virConnectIsAlive(priv->conn) <= 0)
+return NULL;
+
+if ((nnwfilters = virConnectListAllNWFilters(priv->conn, , 
flags)) < 0)
+return NULL;
+
+if (VIR_ALLOC_N(ret, nnwfilters + 1) < 0)
+goto error;
+
+for (i = 0; i < nnwfilters; i++) {
+const char *name = virNWFilterGetName(nwfilters[i]);
+
+if (VIR_STRDUP(ret[i], name) < 0)
+goto error;
+
+virNWFilterFree(nwfilters[i]);
+}
+VIR_FREE(nwfilters);
+
+return ret;
+
+ error:
+for (; i < nnwfilters; i++)
+virNWFilterFree(nwfilters[i]);
+VIR_FREE(nwfilters);
+for (i = 0; i < nnwfilters; i++)
+VIR_FREE(ret[i]);
+VIR_FREE(ret);
+return NULL;
+}
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index 19fa2113d..3c3b17f1e 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -58,4 +58,8 @@ char ** virshNodeDeviceNameCompleter(vshControl *ctl,
  const vshCmd *cmd,
  unsigned int flags);
 
+char ** virshNWFilterNameCompleter(vshControl *ctl,
+   const vshCmd *cmd,
+   unsigned int flags);
+
 #endif
diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c
index 40bc193ad..06a002dff 100644
--- a/tools/virsh-nwfilter.c
+++ b/tools/virsh-nwfilter.c
@@ -136,7 +136,8 @@ static const vshCmdOptDef opts_nwfilter_undefine[] = {
 {.name = "nwfilter",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
- .help = N_("network filter name or uuid")
+ .help = N_("network filter name or uuid"),
+ .completer = virshNWFilterNameCompleter,
 },
 {.name = NULL}
 };
@@ -179,7 +180,8 @@ static const vshCmdOptDef opts_nwfilter_dumpxml[] = {
 {.name = "nwfilter",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
- .help = N_("network filter name or uuid")
+ .help = N_("network filter name or uuid"),
+ .completer = virshNWFilterNameCompleter,
 },
 {.name = NULL}
 };
@@ -396,7 +398,8 @@ static const vshCmdOptDef opts_nwfilter_edit[] = {
 {.name = "nwfilter",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
- .help = N_("network filter name or uuid")
+ .help = N_("network filter name or uuid"),
+ .completer = virshNWFilterNameCompleter,
 },
 {.name = NULL}
 };
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH python 1/7] Allow disabling of python2 RPM build

2018-01-12 Thread Daniel P. Berrange
On Fri, Jan 12, 2018 at 03:42:57PM +, Daniel P. Berrange wrote:
> On Fri, Jan 12, 2018 at 12:15:19PM +0100, Pavel Hrdina wrote:
> > On Thu, Jan 11, 2018 at 04:43:33PM +, Daniel P. Berrange wrote:
> > > With Fedora modularity, it is possible to have add-on repos for multiple
> > > versions of python3. It is thus desirable to be able to build 
> > > libvirt-python
> > > in these repos, with only the python3 sub-RPMs enabled.
> > > 
> > > Thus also helps if future RHEL/Fedora drop python2 entirely from their 
> > > default
> > > repos.
> > 
> > Prior to this patch we should also fix the "wrong" usage of
> > "python_sitearch" on line 26:
> > 
> > # Don't want provides for python shared objects
> > %{?filter_provides_in: %filter_provides_in %{python_sitearch}/.*\.so}
> > %{?filter_setup}
> > 
> > We should use python{2,3}_sitearch instead since the old python_sitearch
> > points only to the default version.  Currently we will not filter
> > the *.so files for python3.
> 
> On Fedora 27, this filter stuff apparently has no effect. I see the same
> data in both py2 and py3 sub RPMs
> 
>  rpm -q --requires  --provides 
> python2-libvirt-debuginfo-3.10.0-1.fc27.x86_64.rpm
> libvirt-python-debuginfo(x86-64) = 3.10.0-1.fc27
> rpmlib(CompressedFileNames) <= 3.0.4-1
> rpmlib(FileDigests) <= 4.6.0-1
> rpmlib(PayloadFilesHavePrefix) <= 4.0-1
> rpmlib(PayloadIsXz) <= 5.2-1
> debuginfo(build-id) = 5fb8c6a9dce927333cecf765adaf40c420a04f21
> debuginfo(build-id) = d59579a7c85ce5b002cc6b3e0a0be7932c041fe4
> debuginfo(build-id) = e791f98736c9006bbe3b324abf035b0b119506f9
> python2-libvirt-debuginfo = 3.10.0-1.fc27
> python2-libvirt-debuginfo(x86-64) = 3.10.0-1.fc27
> 
> [berrange@t460 libvirt-python]
> $ rpm -q --requires  --provides 
> python3-libvirt-debuginfo-3.10.0-1.fc27.x86_64.rpm
> libvirt-python-debuginfo(x86-64) = 3.10.0-1.fc27
> rpmlib(CompressedFileNames) <= 3.0.4-1
> rpmlib(FileDigests) <= 4.6.0-1
> rpmlib(PayloadFilesHavePrefix) <= 4.0-1
> rpmlib(PayloadIsXz) <= 5.2-1
> debuginfo(build-id) = 28d17edad0f257efbc68790ecd8c970fc153fe74
> debuginfo(build-id) = 4c4aceebea990736cdcf58d122a231a6260f5474
> debuginfo(build-id) = 7ff2ac4cefcee10d44b6dc73ebe0f1ed3f68f6ec
> python3-libvirt-debuginfo = 3.10.0-1.fc27
> python3-libvirt-debuginfo(x86-64) = 3.10.0-1.fc27
> 
> 
> Perhaps this was working around a bug on older RHEL ?

Sigh, ignore this. It helps if i use the actual RPms, not the debuginfo
RPMs.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH python 3/7] Add checks for min supported distros

2018-01-12 Thread Pavel Hrdina
On Fri, Jan 12, 2018 at 03:43:55PM +, Daniel P. Berrange wrote:
> On Fri, Jan 12, 2018 at 12:36:23PM +0100, Pavel Hrdina wrote:
> > On Thu, Jan 11, 2018 at 04:43:35PM +, Daniel P. Berrange wrote:
> > > Be clear about which distros we aim to support with the specfile, so we 
> > > know
> > > what we can cleanup in the spec later.
> > 
> > Do we really want to have this limitation?  If so, maybe we can alter
> > the "requires" message to only warn that it's not tested/supported.
> 
> This matches what we do for the native libvirt RPM build.

I was mostly thinking about the possibility to take upstream libvirt
or libvirt-python and be able to simply run "make rpm" on openSUSE.

I'm not even sure if it would work.

Pavel


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] fixed bug:if expand thread pool, will lose some one

2018-01-12 Thread diwei
Sorry for that the information is not obvious.
I hope that the information below is sufficient.If need more information,let me 
know.


Bug’s consequence:
Assume that there is a threadpool like 

[ thread 1 | thread 2 | thread 3 ]

After expanding this threadpool with virThreadPoolExpand(ptr,1,priority), it 
should be

[ thread 1 | thread 2 | thread 3 | thread 4 ]

but the result will be

[ thread 4 | thread 2 | thread 3 | NULL ] 

the first one thread 1 is lost.





> 在 2018年1月12日,下午5:19,Peter Krempa  写道:
> 
> On Thu, Jan 11, 2018 at 23:30:41 +0800, Di Wei wrote:
>> ---
> 
> Could you please provide more information on when this is happening and
> what the consequences are? It's really not obvious from the summary and
> it's required to be part of the commit message.



--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH python v2 6/9] Turn on python3 sub-RPMs for RHEL > 7

2018-01-12 Thread Daniel P. Berrange
It is expected that future RHEL-8 will have python3 by default, so enable that.
It is unclear whether python2 will still be available, so leave that enabled
for now.

Reviewed-by: Pavel Hrdina 
Signed-off-by: Daniel P. Berrange 
---
 libvirt-python.spec.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index b13e961..48a4933 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -14,7 +14,7 @@
 
 %define _with_python2 1
 %define _with_python3 0
-%if 0%{?fedora}
+%if 0%{?fedora} || 0%{?rhel} > 7
 %define _with_python3 1
 %endif
 
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH python v2 3/9] Add checks for min supported distros

2018-01-12 Thread Daniel P. Berrange
Be clear about which distros we aim to support with the specfile, so we know
what we can cleanup in the spec later.

Signed-off-by: Daniel P. Berrange 
---
 libvirt-python.spec.in | 16 
 1 file changed, 16 insertions(+)

diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index 1619e26..a98b902 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -1,3 +1,14 @@
+# This spec file assumes you are building on a Fedora or RHEL version
+# that's still supported by the vendor. It may work on other distros
+# or versions, but no effort will be made to ensure that going forward
+%define min_rhel 6
+%define min_fedora 25
+
+%if (0%{?fedora} && 0%{?fedora} >= %{min_fedora}) || (0%{?rhel} && 0%{?rhel} 
>= %{min_rhel})
+%define supported_platform 1
+%else
+%define supported_platform 0
+%endif
 
 %define _with_python2 1
 %define _with_python3 0
@@ -81,6 +92,11 @@ of recent versions of Linux (and other OSes).
 find examples -type f -exec chmod 0644 \{\} \;
 
 %build
+%if ! %{supported_platform}
+echo "This RPM requires either Fedora >= %{min_fedora} or RHEL >= %{min_rhel}"
+exit 1
+%endif
+
 %if %{with_python2}
 CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
 %endif
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH python v2 5/9] Adapt to rename of py2 RPMs from python- to python2- prefix

2018-01-12 Thread Daniel P. Berrange
Reviewed-by: Pavel Hrdina 
Signed-off-by: Daniel P. Berrange 
---
 libvirt-python.spec.in | 12 
 1 file changed, 12 insertions(+)

diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index b667ebe..b13e961 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -18,6 +18,12 @@
 %define _with_python3 1
 %endif
 
+# Whether py2 packages are assumed to have python2- name prefix
+%define py2_versioned_deps 0
+%if 0%{?fedora} || 0%{?rhel} > 7
+%define py2_versioned_deps 1
+%endif
+
 %{!?with_python2: %define with_python2 %{_with_python2}}
 %{!?with_python3: %define with_python3 %{_with_python3}}
 
@@ -31,10 +37,16 @@ License: LGPLv2+
 Group: Development/Libraries
 BuildRequires: libvirt-devel >= @C_VERSION@
 %if %{with_python2}
+%if %{py2_versioned_deps}
+BuildRequires: python2-devel
+BuildRequires: python2-nose
+BuildRequires: python2-lxml
+%else
 BuildRequires: python-devel
 BuildRequires: python-nose
 BuildRequires: python-lxml
 %endif
+%endif
 %if %{with_python3}
 BuildRequires: python3-devel
 BuildRequires: python3-nose
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH python v2 8/9] Fix filtering of RPM provides for .so files

2018-01-12 Thread Daniel P. Berrange
Signed-off-by: Daniel P. Berrange 
---
 libvirt-python.spec.in | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index 2dfc84a..f658496 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -54,7 +54,12 @@ BuildRequires: python3-lxml
 %endif
 
 # Don't want provides for python shared objects
+%if %{with_python2}
 %{?filter_provides_in: %filter_provides_in %{python_sitearch}/.*\.so}
+%endif
+%if %{with_python3}
+%{?filter_provides_in: %filter_provides_in %{python3_sitearch}/.*\.so}
+%endif
 %{?filter_setup}
 
 %description
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH python 3/7] Add checks for min supported distros

2018-01-12 Thread Daniel P. Berrange
On Fri, Jan 12, 2018 at 05:32:32PM +0100, Pavel Hrdina wrote:
> On Fri, Jan 12, 2018 at 03:43:55PM +, Daniel P. Berrange wrote:
> > On Fri, Jan 12, 2018 at 12:36:23PM +0100, Pavel Hrdina wrote:
> > > On Thu, Jan 11, 2018 at 04:43:35PM +, Daniel P. Berrange wrote:
> > > > Be clear about which distros we aim to support with the specfile, so we 
> > > > know
> > > > what we can cleanup in the spec later.
> > > 
> > > Do we really want to have this limitation?  If so, maybe we can alter
> > > the "requires" message to only warn that it's not tested/supported.
> > 
> > This matches what we do for the native libvirt RPM build.
> 
> I was mostly thinking about the possibility to take upstream libvirt
> or libvirt-python and be able to simply run "make rpm" on openSUSE.

That's explicitly not a goal for the RPM specs at this time,


Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [jenkins-ci PATCH v2 0/2] guests: Make rpcgen mapping more future-proof

2018-01-12 Thread Daniel P. Berrange
On Fri, Jan 12, 2018 at 02:50:47PM +0100, Andrea Bolognani wrote:
> Changes from [v1]:
> 
>   * use the rpcgen name instead of glibc-rpcgen, which is a just
> temporary hack and will go away.
> 
> [v1] https://www.redhat.com/archives/libvir-list/2018-January/msg00422.html
> 
> Andrea Bolognani (2):
>   guests: Fix package name for rpcgen
>   guests: Make rpcgen mapping more future-proof
> 
>  guests/vars/mappings.yml | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrange 

Seeing latest build failures though, I appears we need to add in
libtirpc-devel too, since the RPC library has been removed from
glibc, as well as rpcgen.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 13/18] vsh: Filter --options

2018-01-12 Thread John Ferlan


On 01/02/2018 12:12 PM, Michal Privoznik wrote:
> Similarly to the previous commit, once we've presented an
> --option for a command to the user it makes no sense to offer it
> again. Therefore, we can prune all already specified options. For
> instance, after this patch:
> 
>   virsh # migrate --verbose 
> 
> will no longer offer --verbose option.
> 
> Signed-off-by: Michal Privoznik 
> ---
>  tools/vsh.c | 60 +++-
>  1 file changed, 59 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/vsh.c b/tools/vsh.c
> index 49e8033bd..f061783e0 100644
> --- a/tools/vsh.c
> +++ b/tools/vsh.c
> @@ -2769,6 +2769,60 @@ vshCompleterFilter(char ***list,
>  }
>  
>  
> +static int
> +vshReadlineOptionsPrune(char ***list,
> +vshCmd *last)
> +{
> +char **newList = NULL;
> +size_t newList_len = 0;
> +size_t list_len;
> +size_t i;
> +
> +if (!list || !*list)
> +return -1;
> +
> +if (!last->opts)
> +return 0;
> +
> +list_len = virStringListLength((const char **) *list);
> +
> +if (VIR_ALLOC_N(newList, list_len + 1) < 0)
> +return -1;
> +
> +for (i = 0; i < list_len; i++) {
> +const char *list_opt = STRSKIP((*list)[i], "--");
> +bool exist = false;
> +vshCmdOpt *opt =  last->opts;
> +
> +/* Should never happen (TM) */
> +if (!list_opt)
> +return -1;

But if it does, then you'll lean newList

As reported by everyone's favorite tool!

John

> +
> +while (opt) {
> +if (STREQ(opt->def->name, list_opt)) {
> +exist = true;
> +break;
> +}
> +
> +opt = opt->next;
> +}
> +
> +if (exist) {
> +VIR_FREE((*list)[i]);
> +continue;
> +}
> +
> +VIR_STEAL_PTR(newList[newList_len], (*list)[i]);
> +newList_len++;
> +}
> +
> +ignore_value(VIR_REALLOC_N_QUIET(newList, newList_len + 1));
> +VIR_FREE(*list);
> +*list = newList;
> +return 0;
> +}
> +
> +
>  static char *
>  vshReadlineParse(const char *text, int state)
>  {
> @@ -2817,9 +2871,13 @@ vshReadlineParse(const char *text, int state)
>  if (!cmd) {
>  list = vshReadlineCommandGenerator(text);
>  } else {
> -if (!opt || opt->type != VSH_OT_DATA)
> +if (!opt || opt->type != VSH_OT_DATA) {
>  list = vshReadlineOptionsGenerator(text, cmd);
>  
> +if (vshReadlineOptionsPrune(, partial) < 0)
> +goto cleanup;
> +}
> +
>  if (opt && opt->completer) {
>  char **completer_list = opt->completer(autoCompleteOpaque,
> partial,
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH python 5/7] Adapt to rename of py2 RPMs from python- to python2- prefix

2018-01-12 Thread Daniel P. Berrange
On Fri, Jan 12, 2018 at 12:31:46PM +0100, Pavel Hrdina wrote:
> On Thu, Jan 11, 2018 at 04:43:37PM +, Daniel P. Berrange wrote:
> > Signed-off-by: Daniel P. Berrange 
> > ---
> >  libvirt-python.spec.in | 12 
> >  1 file changed, 12 insertions(+)
> 
> Reviewed-by: Pavel Hrdina 
> 
> In addition we should rename __python RPM macro to __python2 for fedora
> and rhel > 7.  This applies to python_sitearch as well.

I don't think we should do that (yet) as python_sitearch still works and
AFAIK isn't going to be changed to point to the py3 binary. This avoids
need for more conditionals.

Once RHEL8 comes out and we drop RHEL6 as a target for libvirt, we can
do the swtich, since IIUC RHEL-7 has the python2_* macros available.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH python v2 0/9] Various improvements to RPM spec

2018-01-12 Thread Pavel Hrdina
On Fri, Jan 12, 2018 at 04:06:36PM +, Daniel P. Berrange wrote:
> Daniel P. Berrange (9):
>   Allow disabling of python2 RPM build
>   Allow override of which sub-RPMs to build
>   Add checks for min supported distros
>   Add emacs mode marker to activate rpm-spec highlighting
>   Adapt to rename of py2 RPMs from python- to python2- prefix
>   Turn on python3 sub-RPMs for RHEL > 7
>   Require libvirt native version matching py version by default
>   Fix filtering of RPM provides for .so files
>   Use python*_sitearch macros instead of manually defining the dir

Reviewed-by: Pavel Hrdina 


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH python 3/7] Add checks for min supported distros

2018-01-12 Thread Daniel P. Berrange
On Fri, Jan 12, 2018 at 12:36:23PM +0100, Pavel Hrdina wrote:
> On Thu, Jan 11, 2018 at 04:43:35PM +, Daniel P. Berrange wrote:
> > Be clear about which distros we aim to support with the specfile, so we know
> > what we can cleanup in the spec later.
> 
> Do we really want to have this limitation?  If so, maybe we can alter
> the "requires" message to only warn that it's not tested/supported.

This matches what we do for the native libvirt RPM build.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH python v2 1/9] Allow disabling of python2 RPM build

2018-01-12 Thread Daniel P. Berrange
With Fedora modularity, it is possible to have add-on repos for multiple
versions of python3. It is thus desirable to be able to build libvirt-python
in these repos, with only the python3 sub-RPMs enabled.

Thus also helps if future RHEL/Fedora drop python2 entirely from their default
repos.

Signed-off-by: Daniel P. Berrange 
---
 libvirt-python.spec.in | 13 +
 1 file changed, 13 insertions(+)

diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index 4d0262d..5bbebeb 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -1,4 +1,5 @@
 
+%define with_python2 1
 %define with_python3 0
 %if 0%{?fedora}
 %define with_python3 1
@@ -13,9 +14,11 @@ Url: http://libvirt.org
 License: LGPLv2+
 Group: Development/Libraries
 BuildRequires: libvirt-devel >= @C_VERSION@
+%if %{with_python2}
 BuildRequires: python-devel
 BuildRequires: python-nose
 BuildRequires: python-lxml
+%endif
 %if %{with_python3}
 BuildRequires: python3-devel
 BuildRequires: python3-nose
@@ -32,6 +35,7 @@ written in the Python programming language to use the 
interface
 supplied by the libvirt library to use the virtualization capabilities
 of recent versions of Linux (and other OSes).
 
+%if %{with_python2}
 %package -n python2-libvirt
 Summary: The libvirt virtualization API python2 binding
 Url: http://libvirt.org
@@ -46,6 +50,7 @@ The python2-libvirt package contains a module that permits 
applications
 written in the Python programming language to use the interface
 supplied by the libvirt library to use the virtualization capabilities
 of recent versions of Linux (and other OSes).
+%endif
 
 %if %{with_python3}
 %package -n python3-libvirt
@@ -73,23 +78,30 @@ of recent versions of Linux (and other OSes).
 find examples -type f -exec chmod 0644 \{\} \;
 
 %build
+%if %{with_python2}
 CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
+%endif
 %if %{with_python3}
 CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
 %endif
 
 %install
+%if %{with_python2}
 %{__python} setup.py install --skip-build --root=%{buildroot}
+%endif
 %if %{with_python3}
 %{__python3} setup.py install --skip-build --root=%{buildroot}
 %endif
 
 %check
+%if %{with_python2}
 %{__python} setup.py test
+%endif
 %if %{with_python3}
 %{__python3} setup.py test
 %endif
 
+%if %{with_python2}
 %files -n python2-libvirt
 %defattr(-,root,root)
 %doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/
@@ -98,6 +110,7 @@ CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
 %{_libdir}/python2*/site-packages/libvirt_lxc.py*
 %{_libdir}/python2*/site-packages/libvirtmod*
 %{_libdir}/python2*/site-packages/*egg-info
+%endif
 
 %if %{with_python3}
 %files -n python3-libvirt
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH python v2 0/9] Various improvements to RPM spec

2018-01-12 Thread Daniel P. Berrange
Daniel P. Berrange (9):
  Allow disabling of python2 RPM build
  Allow override of which sub-RPMs to build
  Add checks for min supported distros
  Add emacs mode marker to activate rpm-spec highlighting
  Adapt to rename of py2 RPMs from python- to python2- prefix
  Turn on python3 sub-RPMs for RHEL > 7
  Require libvirt native version matching py version by default
  Fix filtering of RPM provides for .so files
  Use python*_sitearch macros instead of manually defining the dir

 libvirt-python.spec.in | 89 +++---
 setup.py   |  3 +-
 2 files changed, 71 insertions(+), 21 deletions(-)

-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH python v2 2/9] Allow override of which sub-RPMs to build

2018-01-12 Thread Daniel P. Berrange
Allow using

  rpmbuild --define "with_python2 0"

to override the default logic about which python sub-RPMs to build

Reviewed-by: Pavel Hrdina 
Signed-off-by: Daniel P. Berrange 
---
 libvirt-python.spec.in | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index 5bbebeb..1619e26 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -1,10 +1,13 @@
 
-%define with_python2 1
-%define with_python3 0
+%define _with_python2 1
+%define _with_python3 0
 %if 0%{?fedora}
-%define with_python3 1
+%define _with_python3 1
 %endif
 
+%{!?with_python2: %define with_python2 %{_with_python2}}
+%{!?with_python3: %define with_python3 %{_with_python3}}
+
 Summary: The libvirt virtualization API python2 binding
 Name: libvirt-python
 Version: @PY_VERSION@
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH python v2 4/9] Add emacs mode marker to activate rpm-spec highlighting

2018-01-12 Thread Daniel P. Berrange
Reviewed-by: Pavel Hrdina 
Signed-off-by: Daniel P. Berrange 
---
 libvirt-python.spec.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index a98b902..b667ebe 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -1,3 +1,5 @@
+# -*- rpm-spec -*-
+
 # This spec file assumes you are building on a Fedora or RHEL version
 # that's still supported by the vendor. It may work on other distros
 # or versions, but no effort will be made to ensure that going forward
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 3/8] virsh: Introduce virshInterfaceNameCompleter

2018-01-12 Thread Michal Privoznik
Signed-off-by: Michal Privoznik 
---
 tools/virsh-completer.c | 47 +++
 tools/virsh-completer.h |  4 
 tools/virsh-interface.c | 16 +---
 3 files changed, 60 insertions(+), 7 deletions(-)

diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index d6ac0ccb8..f5b1e4261 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -250,3 +250,50 @@ virshStorageVolNameCompleter(vshControl *ctl,
 virStoragePoolFree(pool);
 return NULL;
 }
+
+
+char **
+virshInterfaceNameCompleter(vshControl *ctl,
+const vshCmd *cmd ATTRIBUTE_UNUSED,
+unsigned int flags)
+{
+virshControlPtr priv = ctl->privData;
+virInterfacePtr *ifaces = NULL;
+int nifaces = 0;
+size_t i = 0;
+char **ret = NULL;
+
+virCheckFlags(VIR_CONNECT_LIST_INTERFACES_ACTIVE |
+  VIR_CONNECT_LIST_INTERFACES_INACTIVE,
+  NULL);
+
+if (!priv->conn || virConnectIsAlive(priv->conn) <= 0)
+return NULL;
+
+if ((nifaces = virConnectListAllInterfaces(priv->conn, , flags)) < 
0)
+return NULL;
+
+if (VIR_ALLOC_N(ret, nifaces + 1) < 0)
+goto error;
+
+for (i = 0; i < nifaces; i++) {
+const char *name = virInterfaceGetName(ifaces[i]);
+
+if (VIR_STRDUP(ret[i], name) < 0)
+goto error;
+
+virInterfaceFree(ifaces[i]);
+}
+VIR_FREE(ifaces);
+
+return ret;
+
+ error:
+for (; i < nifaces; i++)
+virInterfaceFree(ifaces[i]);
+VIR_FREE(ifaces);
+for (i = 0; i < nifaces; i++)
+VIR_FREE(ret[i]);
+VIR_FREE(ret);
+return NULL;
+}
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index 1e4ce5932..2323aaba3 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -46,4 +46,8 @@ char ** virshStorageVolNameCompleter(vshControl *ctl,
  const vshCmd *cmd,
  unsigned int flags);
 
+char ** virshInterfaceNameCompleter(vshControl *ctl,
+const vshCmd *cmd,
+unsigned int flags);
+
 #endif
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index c1a2b21de..50518c667 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -23,11 +23,13 @@
  *
  */
 
-#define VIRSH_COMMON_OPT_INTERFACE \
+#define VIRSH_COMMON_OPT_INTERFACE(cflags) \
 {.name = "interface", \
  .type = VSH_OT_DATA, \
  .flags = VSH_OFLAG_REQ, \
- .help = N_("interface name or MAC address") \
+ .help = N_("interface name or MAC address"), \
+ .completer = virshInterfaceNameCompleter, \
+ .completer_flags = cflags, \
 }
 
 #include 
@@ -107,7 +109,7 @@ static const vshCmdInfo info_interface_edit[] = {
 };
 
 static const vshCmdOptDef opts_interface_edit[] = {
-VIRSH_COMMON_OPT_INTERFACE,
+VIRSH_COMMON_OPT_INTERFACE(0),
 {.name = NULL}
 };
 
@@ -467,7 +469,7 @@ static const vshCmdInfo info_interface_dumpxml[] = {
 };
 
 static const vshCmdOptDef opts_interface_dumpxml[] = {
-VIRSH_COMMON_OPT_INTERFACE,
+VIRSH_COMMON_OPT_INTERFACE(0),
 {.name = "inactive",
  .type = VSH_OT_BOOL,
  .help = N_("show inactive defined XML")
@@ -564,7 +566,7 @@ static const vshCmdInfo info_interface_undefine[] = {
 };
 
 static const vshCmdOptDef opts_interface_undefine[] = {
-VIRSH_COMMON_OPT_INTERFACE,
+VIRSH_COMMON_OPT_INTERFACE(0),
 {.name = NULL}
 };
 
@@ -603,7 +605,7 @@ static const vshCmdInfo info_interface_start[] = {
 };
 
 static const vshCmdOptDef opts_interface_start[] = {
-VIRSH_COMMON_OPT_INTERFACE,
+VIRSH_COMMON_OPT_INTERFACE(VIR_CONNECT_LIST_INTERFACES_INACTIVE),
 {.name = NULL}
 };
 
@@ -642,7 +644,7 @@ static const vshCmdInfo info_interface_destroy[] = {
 };
 
 static const vshCmdOptDef opts_interface_destroy[] = {
-VIRSH_COMMON_OPT_INTERFACE,
+VIRSH_COMMON_OPT_INTERFACE(VIR_CONNECT_LIST_INTERFACES_ACTIVE),
 {.name = NULL}
 };
 
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/8] virsh: Introduce virshStorageVolNameCompleter

2018-01-12 Thread Michal Privoznik
This one is a bit simpler since virStoragePoolListAllVolumes()
has no flags yet.

Signed-off-by: Michal Privoznik 
---
 tools/virsh-completer.c | 52 +
 tools/virsh-completer.h |  4 
 tools/virsh-volume.c|  3 ++-
 3 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index 8ca2fffd9..d6ac0ccb8 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -24,6 +24,7 @@
 
 #include "virsh-completer.h"
 #include "virsh.h"
+#include "virsh-pool.h"
 #include "virsh-util.h"
 #include "internal.h"
 #include "viralloc.h"
@@ -198,3 +199,54 @@ virshStoragePoolNameCompleter(vshControl *ctl,
 VIR_FREE(ret);
 return NULL;
 }
+
+
+char **
+virshStorageVolNameCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags)
+{
+virshControlPtr priv = ctl->privData;
+virStoragePoolPtr pool = NULL;
+virStorageVolPtr *vols = NULL;
+int nvols = 0;
+size_t i = 0;
+char **ret = NULL;
+
+virCheckFlags(0, NULL);
+
+if (!priv->conn || virConnectIsAlive(priv->conn) <= 0)
+return NULL;
+
+if (!(pool = virshCommandOptPool(ctl, cmd, "pool", NULL)))
+return false;
+
+if ((nvols = virStoragePoolListAllVolumes(pool, , flags)) < 0)
+goto error;
+
+if (VIR_ALLOC_N(ret, nvols + 1) < 0)
+goto error;
+
+for (i = 0; i < nvols; i++) {
+const char *name = virStorageVolGetName(vols[i]);
+
+if (VIR_STRDUP(ret[i], name) < 0)
+goto error;
+
+virStorageVolFree(vols[i]);
+}
+VIR_FREE(vols);
+virStoragePoolFree(pool);
+
+return ret;
+
+ error:
+for (; i < nvols; i++)
+virStorageVolFree(vols[i]);
+VIR_FREE(vols);
+for (i = 0; i < nvols; i++)
+VIR_FREE(ret[i]);
+VIR_FREE(ret);
+virStoragePoolFree(pool);
+return NULL;
+}
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index 249e793b9..1e4ce5932 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -42,4 +42,8 @@ char ** virshStoragePoolNameCompleter(vshControl *ctl,
   const vshCmd *cmd,
   unsigned int flags);
 
+char ** virshStorageVolNameCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
+
 #endif
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index b96e205f7..c1f36d9b9 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -61,7 +61,8 @@
 {.name = "vol", \
  .type = VSH_OT_DATA, \
  .flags = VSH_OFLAG_REQ, \
- .help = N_("vol name, key or path") \
+ .help = N_("vol name, key or path"), \
+ .completer = virshStorageVolNameCompleter, \
 }
 
 virStorageVolPtr
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 7/8] virsh: Introduce virshSecretUUIDCompleter

2018-01-12 Thread Michal Privoznik
This is a slight change from previous patches since virSecret
does not have a name only UUID strings.

Signed-off-by: Michal Privoznik 
---
 tools/virsh-completer.c | 46 ++
 tools/virsh-completer.h |  4 
 tools/virsh-secret.c| 15 ++-
 3 files changed, 60 insertions(+), 5 deletions(-)

diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index 9e6f086c0..7332fa97a 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -438,3 +438,49 @@ virshNWFilterNameCompleter(vshControl *ctl,
 VIR_FREE(ret);
 return NULL;
 }
+
+
+char **
+virshSecretUUIDCompleter(vshControl *ctl,
+ const vshCmd *cmd ATTRIBUTE_UNUSED,
+ unsigned int flags)
+{
+virshControlPtr priv = ctl->privData;
+virSecretPtr *secrets = NULL;
+int nsecrets = 0;
+size_t i = 0;
+char **ret = NULL;
+
+virCheckFlags(0, NULL);
+
+if (!priv->conn || virConnectIsAlive(priv->conn) <= 0)
+return NULL;
+
+if ((nsecrets = virConnectListAllSecrets(priv->conn, , flags)) < 0)
+return NULL;
+
+if (VIR_ALLOC_N(ret, nsecrets + 1) < 0)
+goto error;
+
+for (i = 0; i < nsecrets; i++) {
+char uuid[VIR_UUID_STRING_BUFLEN];
+
+if (virSecretGetUUIDString(secrets[i], uuid) < 0 ||
+VIR_STRDUP(ret[i], uuid) < 0)
+goto error;
+
+virSecretFree(secrets[i]);
+}
+VIR_FREE(secrets);
+
+return ret;
+
+ error:
+for (; i < nsecrets; i++)
+virSecretFree(secrets[i]);
+VIR_FREE(secrets);
+for (i = 0; i < nsecrets; i++)
+VIR_FREE(ret[i]);
+VIR_FREE(ret);
+return NULL;
+}
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index 3c3b17f1e..0e518873c 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -62,4 +62,8 @@ char ** virshNWFilterNameCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
 
+char ** virshSecretUUIDCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
+
 #endif
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index 52f067652..9e4ec61a8 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -132,7 +132,8 @@ static const vshCmdOptDef opts_secret_dumpxml[] = {
 {.name = "secret",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
- .help = N_("secret UUID")
+ .help = N_("secret UUID"),
+ .completer = virshSecretUUIDCompleter,
 },
 {.name = NULL}
 };
@@ -177,7 +178,8 @@ static const vshCmdOptDef opts_secret_set_value[] = {
 {.name = "secret",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
- .help = N_("secret UUID")
+ .help = N_("secret UUID"),
+ .completer = virshSecretUUIDCompleter,
 },
 {.name = "base64",
  .type = VSH_OT_DATA,
@@ -245,7 +247,8 @@ static const vshCmdOptDef opts_secret_get_value[] = {
 {.name = "secret",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
- .help = N_("secret UUID")
+ .help = N_("secret UUID"),
+ .completer = virshSecretUUIDCompleter,
 },
 {.name = NULL}
 };
@@ -297,7 +300,8 @@ static const vshCmdOptDef opts_secret_undefine[] = {
 {.name = "secret",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
- .help = N_("secret UUID")
+ .help = N_("secret UUID"),
+ .completer = virshSecretUUIDCompleter,
 },
 {.name = NULL}
 };
@@ -667,7 +671,8 @@ static const vshCmdInfo info_secret_event[] = {
 static const vshCmdOptDef opts_secret_event[] = {
 {.name = "secret",
  .type = VSH_OT_STRING,
- .help = N_("filter by secret name or uuid")
+ .help = N_("filter by secret name or uuid"),
+ .completer = virshSecretUUIDCompleter,
 },
 {.name = "event",
  .type = VSH_OT_STRING,
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] Entering freeze for libvirt-4.0.0

2018-01-12 Thread Daniel Veillard
  Hi all,

as planned I just tagged the Release Candidate 1 in git for 4.0.0,
I also pushed signed tarball and rpms to the usual place:

   ftp://libvirt.org/libvirt/


  No issue found in my limited testing, weirdly the CI says master is
red for 4 days but it build just fine here so there has to be something
on jenkins: https://ci.centos.org/view/libvirt/

  Please give it a try, I will likely push an RC2 end of Monday, and
then we can have the final release around Wed if everything looks fine.
Feedback on other architectures and OSes always welcome :-)

  thanks !

Daniel

-- 
Daniel Veillard  | Red Hat Developers Tools http://developer.redhat.com/
veill...@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH python 1/7] Allow disabling of python2 RPM build

2018-01-12 Thread Daniel P. Berrange
On Fri, Jan 12, 2018 at 12:15:19PM +0100, Pavel Hrdina wrote:
> On Thu, Jan 11, 2018 at 04:43:33PM +, Daniel P. Berrange wrote:
> > With Fedora modularity, it is possible to have add-on repos for multiple
> > versions of python3. It is thus desirable to be able to build libvirt-python
> > in these repos, with only the python3 sub-RPMs enabled.
> > 
> > Thus also helps if future RHEL/Fedora drop python2 entirely from their 
> > default
> > repos.
> 
> Prior to this patch we should also fix the "wrong" usage of
> "python_sitearch" on line 26:
> 
> # Don't want provides for python shared objects
> %{?filter_provides_in: %filter_provides_in %{python_sitearch}/.*\.so}
> %{?filter_setup}
> 
> We should use python{2,3}_sitearch instead since the old python_sitearch
> points only to the default version.  Currently we will not filter
> the *.so files for python3.

On Fedora 27, this filter stuff apparently has no effect. I see the same
data in both py2 and py3 sub RPMs

 rpm -q --requires  --provides 
python2-libvirt-debuginfo-3.10.0-1.fc27.x86_64.rpm
libvirt-python-debuginfo(x86-64) = 3.10.0-1.fc27
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
debuginfo(build-id) = 5fb8c6a9dce927333cecf765adaf40c420a04f21
debuginfo(build-id) = d59579a7c85ce5b002cc6b3e0a0be7932c041fe4
debuginfo(build-id) = e791f98736c9006bbe3b324abf035b0b119506f9
python2-libvirt-debuginfo = 3.10.0-1.fc27
python2-libvirt-debuginfo(x86-64) = 3.10.0-1.fc27

[berrange@t460 libvirt-python]
$ rpm -q --requires  --provides 
python3-libvirt-debuginfo-3.10.0-1.fc27.x86_64.rpm
libvirt-python-debuginfo(x86-64) = 3.10.0-1.fc27
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
debuginfo(build-id) = 28d17edad0f257efbc68790ecd8c970fc153fe74
debuginfo(build-id) = 4c4aceebea990736cdcf58d122a231a6260f5474
debuginfo(build-id) = 7ff2ac4cefcee10d44b6dc73ebe0f1ed3f68f6ec
python3-libvirt-debuginfo = 3.10.0-1.fc27
python3-libvirt-debuginfo(x86-64) = 3.10.0-1.fc27


Perhaps this was working around a bug on older RHEL ?

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] Entering freeze for libvirt-4.0.0

2018-01-12 Thread Andrea Bolognani
On Fri, 2018-01-12 at 16:12 +0100, Daniel Veillard wrote:
>   No issue found in my limited testing, weirdly the CI says master is
> red for 4 days but it build just fine here so there has to be something
> on jenkins: https://ci.centos.org/view/libvirt/

Yeah, the CentOS CI failures are due to changes in Rawhide and
they're already being looked after. They shouldn't interfere with
the release schedule.

>   Please give it a try, I will likely push an RC2 end of Monday, and
> then we can have the final release around Wed if everything looks fine.
> Feedback on other architectures and OSes always welcome :-)

Unfortunately the macOS build is currently broken:

  https://travis-ci.org/libvirt/libvirt/jobs/328121035

I'm not sure whether there's some way to work around the issue
by eg. passing some flags to configure; if that's not the case,
I don't think we should release until it's fixed. Michal?

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] docs: formatdomain: Document the CPU feature 'name' attribute

2018-01-12 Thread Kashyap Chamarthy
Currently, the CPU feature 'name' XML attribute, as in:

[...]

  IvyBridge
  Intel
  

[...]

isn't explicitly documented in formatdomain.html.

Document it now.

Signed-off-by: Kashyap Chamarthy 
---
 docs/formatdomain.html.in | 17 +
 1 file changed, 17 insertions(+)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index d272cc1ba..e717fb3aa 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1454,6 +1454,23 @@
 
 Since 0.8.5 the policy
 attribute can be omitted and will default to require.
+
+Individual CPU feature names can be specified as part of the
+name attribute. The list of known CPU feature
+names (e.g. 'vmx', 'cmt', et cetera) can be found in the same
+file as CPU models -- cpu_map.xml. For example,
+to explicitly specify the 'pcid' feature with Intel IvyBridge
+CPU model:
+
+
+...
+cpu match='exact'
+  model fallback='forbid'IvyBridge/model
+  vendorIntel/vendor
+  feature policy='require' name='pcid'/
+/cpu
+...
+
   
 
   cache
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] virsh: fix build without readline

2018-01-12 Thread Roman Bogorodskiy
Completion in virsh is enabled when readline is available. However,
when it's not available, we should:

 * avoid defining completers with completion functions;
 * in cmdComplete(), mark unused arguments when there's no readline with
   ATTRIBUTE_UNUSED.
---
 tools/virsh-domain-monitor.c |  6 ++
 tools/virsh-domain.c |  6 ++
 tools/virsh.h| 11 ++-
 tools/virt-admin.c   | 14 ++
 tools/vsh.c  |  2 +-
 5 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 32a42707e..0df20eea0 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -659,7 +659,9 @@ static const vshCmdOptDef opts_domif_getlink[] = {
 {.name = "interface",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
+#if WITH_READLINE
  .completer = virshDomainInterfaceCompleter,
+#endif
  .help = N_("interface device (MAC Address)")
 },
 {.name = "persistent",
@@ -996,7 +998,9 @@ static const vshCmdOptDef opts_domifstat[] = {
 {.name = "interface",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
  .completer = virshDomainInterfaceCompleter,
+#endif
  .help = N_("interface device specified by name or MAC Address")
 },
 {.name = NULL}
@@ -2151,7 +2155,9 @@ static const vshCmdOptDef opts_domifaddr[] = {
 {.name = "interface",
  .type = VSH_OT_STRING,
  .flags = VSH_OFLAG_NONE,
+#ifdef WITH_READLINE
  .completer = virshDomainInterfaceCompleter,
+#endif
  .help = N_("network interface name")},
 {.name = "full",
  .type = VSH_OT_BOOL,
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 0f329d6d7..c5511adbf 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2977,7 +2977,9 @@ static const vshCmdOptDef opts_domif_setlink[] = {
 {.name = "interface",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
  .completer = virshDomainInterfaceCompleter,
+#endif
  .help = N_("interface device (MAC Address)")
 },
 {.name = "state",
@@ -3148,7 +3150,9 @@ static const vshCmdOptDef opts_domiftune[] = {
 {.name = "interface",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
  .completer = virshDomainInterfaceCompleter,
+#endif
  .help = N_("interface device (MAC Address)")
 },
 {.name = "inbound",
@@ -11985,8 +11989,10 @@ static const vshCmdOptDef opts_detach_interface[] = {
 },
 {.name = "mac",
  .type = VSH_OT_STRING,
+#ifdef WITH_READLINE
  .completer = virshDomainInterfaceCompleter,
  .completer_flags = VIRSH_DOMAIN_INTERFACE_COMPLETER_MAC,
+#endif
  .help = N_("MAC address")
 },
 VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
diff --git a/tools/virsh.h b/tools/virsh.h
index 528e04558..b3cb15ac4 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -71,7 +71,8 @@
  .help = _helpstr \
 }
 
-# define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \
+# ifdef WITH_READLINE
+#  define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \
 {.name = "domain", \
  .type = VSH_OT_DATA, \
  .flags = VSH_OFLAG_REQ, \
@@ -79,6 +80,14 @@
  .completer = virshDomainNameCompleter, \
  .completer_flags = cflags, \
 }
+# else
+#  define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \
+{.name = "domain", \
+ .type = VSH_OT_DATA, \
+ .flags = VSH_OFLAG_REQ, \
+ .help = _helpstr, \
+}
+# endif
 
 # define VIRSH_COMMON_OPT_CONFIG(_helpstr) \
 {.name = "config", \
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index c86b5763a..ac4d00dd7 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -429,7 +429,9 @@ static const vshCmdOptDef opts_srv_threadpool_info[] = {
 {.name = "server",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
  .completer = vshAdmServerCompleter,
+#endif
  .help = N_("Server to retrieve threadpool attributes from."),
 },
 {.name = NULL}
@@ -491,7 +493,9 @@ static const vshCmdOptDef opts_srv_threadpool_set[] = {
 {.name = "server",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
  .completer = vshAdmServerCompleter,
+#endif
  .help = N_("Server to alter threadpool attributes on."),
 },
 {.name = "min-workers",
@@ -598,7 +602,9 @@ static const vshCmdOptDef opts_srv_clients_list[] = {
 {.name = "server",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
  .completer = vshAdmServerCompleter,
+#endif
  .help = N_("server which to list connected clients from"),
 },
 {.name = NULL}
@@ -680,7 +686,9 @@ static const vshCmdOptDef opts_client_info[] = {
 {.name = "server",
  .type = VSH_OT_DATA,
  .flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
  .completer = vshAdmServerCompleter,
+#endif
  .help = N_("server to which  is connected to"),
 },
 {.name = 

Re: [libvirt] [PATCH] vshReadlineOptionsPrune: Fix possible leak

2018-01-12 Thread John Ferlan


On 01/12/2018 11:08 AM, Michal Privoznik wrote:
> The function should prune list of --options so that options
> already specified are not offered to user for completion again.
> However, if the list of offered options contains a string that
> doesn't start with double dash the function returns leaking
> partially constructed list. There's not much benefit from trying
> to roll back. Just free everything up - our only caller would do
> that anyway.
> 
> Signed-off-by: Michal Privoznik 
> ---
>  tools/vsh.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/vsh.c b/tools/vsh.c
> index 4426c08d6..7db0a16f1 100644
> --- a/tools/vsh.c
> +++ b/tools/vsh.c
> @@ -2798,8 +2798,17 @@ vshReadlineOptionsPrune(char ***list,
>  vshCmdOpt *opt =  last->opts;
>  
>  /* Should never happen (TM) */
> -if (!list_opt)
> +if (!list_opt) {
> +/* But in case it does, we're in a tough situation
> + * because @list[0..i-1] is possibly sparse. That
> + * means if caller were to call virStringListFree
> + * over it some memory is definitely going to be
> + * leaked. The best we can do is to free from list[i]
> + * as our only caller is just fine with it. */
> +virStringListFree(list[i]);

Sorry for opening Pandora's box of pain and suffering.

There's something about this that is just strange... Since list is a
VIR_ALLOC_N list with N entries filled in

Passing virStringListFree(list[i]) would be the current entry and I
think would be fine in the "while (tmp && *tmp) loop; however, when the
code gets to VIR_FREE(strings), wouldn't that be the "wrong place" (e.g.
list[i] instead of list)?  Later we would then VIR_FREE(list) because of
the -1 return, which would be correct.

So all that said, should this be something like:

while (list_len > i)
VIR_FREE((*list)[--list_len]);

(could be gated with an i > 0 too).

then later when the caller runs virStringListFree it does the
VIR_FREE(strings) avoiding of course the while(tmp && *tmp) loop.

John

> +virStringListFree(newList);
>  return -1;
> +}
>  
>  while (opt) {
>  if (STREQ(opt->def->name, list_opt)) {
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v2 2/2] qemu_hotplug: introduce VIR_ERR_DEVICE_MISSING for failing to find desired device

2018-01-12 Thread John Ferlan

$SUBJ:

There should be two patches... One just for the error message (see
commit id 'f0e7f90bff' for the last change to add a new error)...

Thus commit message 1 becomes:

qemu: Introduce VIR_ERR_DEVICE_MISSING

and commit message 2 becomes:

qemu: Use VIR_ERR_DEVICE_MISSING for various hotplug messages

On 01/05/2018 05:28 AM, Chen Hanxiao wrote:
> From: Chen Hanxiao 
> 
> We used VIR_ERR_OPERATION_FAILED when target detaching device
> is not found.
> That error code VIR_ERR_OPERATION_FAILED is widely used,
> so the tools powered by libvirt, such as nova,
> can't catch the exact errors from libvirt.
> This patch introduce VIR_ERR_DEVICE_MISSING for this
> kind of scenario.

The line breaks are "unusual"


Commit message 1:

"Add new error code to be able to allow consumers (such as Nova) to be
able to key of a specific error code rather than needing to search the
error message."

Commit message 2:

"Modify OPERATION_FAILED error codes to use DEVICE_MISSING instead."

> 
> Signed-off-by: Chen Hanxiao 
> ---
>  include/libvirt/virterror.h |  1 +
>  src/qemu/qemu_hotplug.c | 26 +-
>  src/util/virerror.c |  6 ++

Don't forget virDomainNetFindIdx

You may also want to search the sources for "device not found" type
messages and have them use the new code as well.  Of course they'd have
some redundancy in the messages...

No need to rush as 4.0.0 deadline is missed, but 4.1.0 should be fine.

John
>  3 files changed, 20 insertions(+), 13 deletions(-)
> 
> diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
> index 91ba29784..3e7c7a02c 100644
> --- a/include/libvirt/virterror.h
> +++ b/include/libvirt/virterror.h
> @@ -320,6 +320,7 @@ typedef enum {
>  VIR_ERR_AGENT_UNSYNCED = 97,/* guest agent replies with wrong id
> to guest-sync command 
> (DEPRECATED)*/
>  VIR_ERR_LIBSSH = 98,/* error in libssh transport driver 
> */
> +VIR_ERR_DEVICE_MISSING = 99,/* fail to find the desired device */
>  } virErrorNumber;
>  
>  /**
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 6472a13a8..9e4424e35 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -3513,7 +3513,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
>  int ret = -1;
>  
>  if (!olddev) {
> -virReportError(VIR_ERR_INTERNAL_ERROR,
> +virReportError(VIR_ERR_DEVICE_MISSING,
> _("cannot find existing graphics device to modify of"
>   " type '%s'"), type);
>  goto cleanup;
> @@ -4758,7 +4758,7 @@ int qemuDomainDetachControllerDevice(virQEMUDriverPtr 
> driver,
>  if ((idx = virDomainControllerFind(vm->def,
> dev->data.controller->type,
> dev->data.controller->idx)) < 0) {
> -virReportError(VIR_ERR_OPERATION_FAILED,
> +virReportError(VIR_ERR_DEVICE_MISSING,
> _("controller %s:%d not found"),
> 
> virDomainControllerTypeToString(dev->data.controller->type),
> dev->data.controller->idx);
> @@ -4987,18 +4987,18 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr 
> driver,
>  if (idx < 0) {
>  switch (subsys->type) {
>  case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
> -virReportError(VIR_ERR_OPERATION_FAILED,
> +virReportError(VIR_ERR_DEVICE_MISSING,
> _("host pci device %.4x:%.2x:%.2x.%.1x not 
> found"),
> pcisrc->addr.domain, pcisrc->addr.bus,
> pcisrc->addr.slot, pcisrc->addr.function);
>  break;
>  case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
>  if (usbsrc->bus && usbsrc->device) {
> -virReportError(VIR_ERR_OPERATION_FAILED,
> +virReportError(VIR_ERR_DEVICE_MISSING,
> _("host usb device %03d.%03d not found"),
> usbsrc->bus, usbsrc->device);
>  } else {
> -virReportError(VIR_ERR_OPERATION_FAILED,
> +virReportError(VIR_ERR_DEVICE_MISSING,
> _("host usb device vendor=0x%.4x 
> product=0x%.4x not found"),
> usbsrc->vendor, usbsrc->product);
>  }
> @@ -5007,13 +5007,13 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr 
> driver,
>  if (scsisrc->protocol ==
>  VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
>  virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = 
> >u.iscsi;
> -virReportError(VIR_ERR_OPERATION_FAILED,
> +virReportError(VIR_ERR_DEVICE_MISSING,
> _("host scsi iSCSI path %s not found"),
> 

Re: [libvirt] [PATCH v2 1/2] qemu_hotplug: more proper error messages when target detaching device is not found

2018-01-12 Thread John Ferlan
$SUBJ:

qemu: Add some more details for hotplug errors when device not found

On 01/05/2018 05:28 AM, Chen Hanxiao wrote:
> From: Chen Hanxiao 
> 
> More proper/detail error messages updated.>
> Signed-off-by: Chen Hanxiao 
> ---
>  src/libvirt_private.syms |  2 ++
>  src/qemu/qemu_hotplug.c  | 42 +-
>  2 files changed, 31 insertions(+), 13 deletions(-)
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index a705fa846..512314484 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -203,6 +203,7 @@ virDomainChrConsoleTargetTypeToString;
>  virDomainChrDefForeach;
>  virDomainChrDefFree;
>  virDomainChrDefNew;
> +virDomainChrDeviceTypeToString;
>  virDomainChrEquals;
>  virDomainChrFind;
>  virDomainChrGetDomainPtrs;
> @@ -427,6 +428,7 @@ virDomainMemoryDefFree;
>  virDomainMemoryFindByDef;
>  virDomainMemoryFindInactiveByDef;
>  virDomainMemoryInsert;
> +virDomainMemoryModelTypeToString;
>  virDomainMemoryRemove;
>  virDomainMemorySourceTypeFromString;
>  virDomainMemorySourceTypeToString;
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 385be80f2..6472a13a8 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -3513,8 +3513,9 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
>  int ret = -1;
>  
>  if (!olddev) {
> -virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> -   _("cannot find existing graphics device to modify"));
> +virReportError(VIR_ERR_INTERNAL_ERROR,
> +   _("cannot find existing graphics device to modify of"
> + " type '%s'"), type);

Should be "modify of " and "type '%s'"

IOW: The space goes on the 1st line...

>  goto cleanup;
>  }
>  
> @@ -5050,8 +5051,10 @@ qemuDomainDetachShmemDevice(virQEMUDriverPtr driver,
>  qemuDomainObjPrivatePtr priv = vm->privateData;
>  
>  if ((idx = virDomainShmemDefFind(vm->def, dev)) < 0) {
> -virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> -   _("device not present in domain configuration"));
> +virReportError(VIR_ERR_OPERATION_INVALID,
> +   _("shmem device of model '%s' not found "
> + "in domain configuration"),

How about "model '%s' shmem device not present in domain configuration".

> +   virDomainShmemModelTypeToString(dev->model));
>  return -1;
>  }
>  
> @@ -5107,8 +5110,10 @@ qemuDomainDetachWatchdog(virQEMUDriverPtr driver,
>watchdog->model == dev->model &&
>watchdog->action == dev->action &&
>virDomainDeviceInfoAddressIsEqual(>info, >info))) {
> -virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> -   _("watchdog device not present in domain 
> configuration"));
> +virReportError(VIR_ERR_OPERATION_INVALID,
> +   _("watchdog device of model '%s' is not "
> + "found in domain configuration"),
> +   virDomainWatchdogModelTypeToString(watchdog->model));

"model '%s' watchdog device not present in domain configuration"

>  return -1;
>  }
>  
> @@ -5148,8 +5153,13 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
>  virDomainNetDefPtr detach = NULL;
>  qemuDomainObjPrivatePtr priv = vm->privateData;
>  
> -if ((detachidx = virDomainNetFindIdx(vm->def, dev->data.net)) < 0)
> +if ((detachidx = virDomainNetFindIdx(vm->def, dev->data.net)) < 0) {
> +char mac[VIR_MAC_STRING_BUFLEN];
> +virReportError(VIR_ERR_INTERNAL_ERROR,
> +   _("netdev '%s' not found in domain configuration"),
> +   virMacAddrFormat(>data.net->mac, mac));

This could override some other message from virDomainNetFindIdx.  I
think you should look there to see messages that perhaps could utilize
the new message from the next patch.

Thus we drop this one, but have to modify virDomainNetFindIdx in the
next patch to use the new error message.

>  goto cleanup;
> +}
>  
>  detach = vm->def->nets[detachidx];
>  
> @@ -5335,8 +5345,10 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver,
>  char *devstr = NULL;
>  
>  if (!(tmpChr = virDomainChrFind(vmdef, chr))) {
> -virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> -   _("device not present in domain configuration"));
> +virReportError(VIR_ERR_OPERATION_INVALID,
> +   _("chr device of type '%s' not found "
> + "in domain configuration"),
> +   virDomainChrDeviceTypeToString(chr->deviceType));

"chr type '%s' device not present in domain configuration"

>  goto cleanup;
>  }
>  
> @@ -5382,8 +5394,10 @@ qemuDomainDetachRNGDevice(virQEMUDriverPtr driver,
>  int ret = -1;
>  
>  if 

Re: [libvirt] [RFC PATCH] lxc: Up back the veth interfaces by default

2018-01-12 Thread Benjamin Cama
Hi again,

Le jeudi 11 janvier 2018 à 18:08 +0100, Benjamin Cama a écrit :
> Upping an interface without configuring it is not a “cardinal sin” but a
> sensible way to achieve auto-configuration, e.g. with IPv6 SLAAC (RFC
> 4862). If NetworkManager has troube with interfaces having only a
> link-local address, this is a bug in NetworkManager, not in libvirt; it
> should listen for router advertisements to decide if some interface has
> global connectivity or not.

To better understand my rant, a bit of context with the original patch
proposal (whose message is also contained in the commit I pointed to):

  https://www.redhat.com/archives/libvir-list/2015-April/msg01062.html

If you wonder why I react so late, this is because libvirt 3.0.0 landed
in Debian Stretch (Jessie had 1.2.9!), and I just recently upgraded to
it.

> With network interfaces up by default, stateless containers can be
> easily auto-configured through the network with SLAAC, without any
> specific configuration from the host system.

Of course, as a workaround I can use "", but I think
it ought to be the default, hence my request.

-- 
Benjamin Cama - Tél : 258

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu: Ignore fallback CPU attribute on reconnect

2018-01-12 Thread Pavel Hrdina
On Thu, Jan 11, 2018 at 10:30:04AM +0100, Jiri Denemark wrote:
> When reconnecting to a running domain with host-model CPU started by old
> libvirt which did not store the actual CPU in the status XML, we need to
> ignore the fallback attribute to make sure we can translate the detected
> host CPU model to a model which is supported by the running QEMU.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1532980
> 
> Signed-off-by: Jiri Denemark 
> ---
>  src/qemu/qemu_process.c | 5 +
>  1 file changed, 5 insertions(+)

Reviewed-by: Pavel Hrdina 


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2] domain_conf: skip boot order check of CD-ROM or floppy device when change-media

2018-01-12 Thread Chen Hanxiao

At 2018-01-11 21:36:29, "Ján Tomko"  wrote:
>On Thu, Jan 11, 2018 at 06:16:37PM +0800, Chen Hanxiao wrote:
>>From: Chen Hanxiao 
>>
>>If we insert or eject a CD-ROM/floppy device by:
>> 'virsh change-media VM --eject/--insert some.iso --live',
>>and the original CD-ROM device was configed with a boot order,
>>we may get:
>>  unsupported configuration: boot order 2 is already used by another device
>>
>>We just updated 'source file' section rather than hotplug a new device.
>>This check should be skipped in this case.
>>
>
>Attempting to change the boot index on update won't work and should be
>forbidden, as stated in the review for v1:
>https://www.redhat.com/archives/libvir-list/2018-January/msg00178.html
>

My case is not try to change boot index, but to change-media:

1) boot a VM with a CD-ROM, a centos7.1 ISO inside
2) change iso from centos7.3 to centos7.2 by:
#  change-media c72 hda   /media/b/ISO/CentOS-7-x86_64-DVD-1611.iso  --live
Successfully updated media.

This works and we can see cd-rom changed inside guest.

But if we had 

  
  
  
 +
  


  
  
  
  
 +
  


Then change media will fail:
 #  change-media c72 hda   /media/b/ISO/CentOS-7-x86_64-DVD-1511.iso  --live
error: Failed to complete action update on media
error: unsupported configuration: boot order 2 is already used by another device

This is a common case when install OS with multiple DVDs,
or change DVD media when guest is active.

>>Signed-off-by: Chen Hanxiao 
>>---
>>v2:
[...]
>>+/* Skip check for insert or eject CD-ROM device */
>>+if (disk_device == VIR_DOMAIN_DISK_DEVICE_FLOPPY ||
>>+disk_device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
>
>Even though cdrom hotplug is not supported by libvirt, assuming that
>we're dealing with an update just because of the device type is wrong:
>https://www.redhat.com/archives/libvir-list/2018-January/msg00180.html
>
>virDomainDefCompatibleDevice should be aware of the operation (attach
>vs. update) and behave accordingly (forbid duplicit bootindexes for
>attach and a bootindex change for update)
>

As we can successfully 'virsh change-media' without  of CD-ROM 
device,
should we forbid this case for a live domain?

Regards,
- Chen

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2 2/2] tests: sysinfotest: add new test case for S390

2018-01-12 Thread John Ferlan


On 01/12/2018 06:38 AM, Bjoern Walk wrote:
> Let's add a test case for S390 with CPU frequency information available.
> Test data is sampled from an IBM z13 system running kernel 4.14 on LPAR.
> 
> Reviewed-by: Boris Fiuczynski 
> Signed-off-by: Bjoern Walk 
> ---
>  tests/sysinfodata/s390-freqcpuinfo.data   |  52 +
>  tests/sysinfodata/s390-freqsysinfo.data   | 173 
> ++
>  tests/sysinfodata/s390-freqsysinfo.expect |  63 +++
>  tests/sysinfotest.c   |   1 +
>  4 files changed, 289 insertions(+)
>  create mode 100644 tests/sysinfodata/s390-freqcpuinfo.data
>  create mode 100644 tests/sysinfodata/s390-freqsysinfo.data
>  create mode 100644 tests/sysinfodata/s390-freqsysinfo.expect
> 
> diff --git a/tests/sysinfodata/s390-freqcpuinfo.data 
> b/tests/sysinfodata/s390-freqcpuinfo.data
> new file mode 100644
> index ..0edc371d
> --- /dev/null
> +++ b/tests/sysinfodata/s390-freqcpuinfo.data
> @@ -0,0 +1,52 @@
> +vendor_id   : IBM/S390
> +# processors: 8
> +bogomips per cpu: 20325.00
> +max thread id   : 1
> +features : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te 
> vx sie 
> +facilities  : 0 1 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 
> 23 24 25 26 27 28 30 31 32 33 34 35 36 37 40 41 42 43 44 45 46 47 48 49 50 51 
> 52 53 55 57 64 65 66 67 68 69 70 71 72 73 75 76 77 78 80 128 129 131 132 142 
> 143


The end of the "features" line has an additional space which git am
complains about and of course I know from my previous push, that the git
master would stop - I've cleaned it up as well as the %u instead of %n
in patch 1 that Pino pointed out.

Will push shortly -

Reviewed-by: John Ferlan 

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 0/2] travis: Fix build failure

2018-01-12 Thread Daniel P. Berrange
On Fri, Jan 12, 2018 at 12:43:58PM +0100, Andrea Bolognani wrote:
> It would be nice to have all greens before the release :)
> 
> Andrea Bolognani (2):
>   travis: Sync packages with libvirt-jenkins-ci
>   travis: Skip nfs-common installation

Reviewed-by: Daniel P. Berrange 

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v2 2/2] tests: sysinfotest: add new test case for S390

2018-01-12 Thread Bjoern Walk
Pino Toscano  [2018-01-12, 01:44PM +0100]:
> On Friday, 12 January 2018 12:38:02 CET Bjoern Walk wrote:
> > Let's add a test case for S390 with CPU frequency information available.
> > Test data is sampled from an IBM z13 system running kernel 4.14 on LPAR.
> > 
> > Reviewed-by: Boris Fiuczynski 
> > Signed-off-by: Bjoern Walk 
> > ---
> 
> LGTM, just a couple of notes that came into my mind when reading the
> existing sysinfodata for s390.

Thanks.

> > diff --git a/tests/sysinfodata/s390-freqcpuinfo.data 
> > b/tests/sysinfodata/s390-freqcpuinfo.data
> > new file mode 100644
> > index ..0edc371d
> > --- /dev/null
> > +++ b/tests/sysinfodata/s390-freqcpuinfo.data
> > [...]
> > +processor 0: version = 00,  identification = 145F07,  machine = 2964
> > +processor 1: version = 00,  identification = 145F07,  machine = 2964
> > +processor 2: version = 00,  identification = 145F07,  machine = 2964
> > +processor 3: version = 00,  identification = 145F07,  machine = 2964
> > +processor 4: version = 00,  identification = 145F07,  machine = 2964
> > +processor 5: version = 00,  identification = 145F07,  machine = 2964
> > +processor 6: version = 00,  identification = 145F07,  machine = 2964
> > +processor 7: version = 00,  identification = 145F07,  machine = 2964
> 
> All the various "identification", and ...
> 
> > diff --git a/tests/sysinfodata/s390-freqsysinfo.data 
> > b/tests/sysinfodata/s390-freqsysinfo.data
> > new file mode 100644
> > index ..1941ef0b
> > --- /dev/null
> > +++ b/tests/sysinfodata/s390-freqsysinfo.data
> > @@ -0,0 +1,173 @@
> > +Manufacturer: IBM
> > +Type: 2964
> > +Model:704  NC9
> > +Sequence Code:00085F07
> 
> .. this value are replaced by what look like dummy values, so maybe
> the same should be done for this data too (in case they are sensitive
> information)?
> 

I let it check for any sensitive information, so hopefully, nothing is
in here. You can anyways just reproduce those files, just buy a z13.
Much appreciated :)

Anyways, sure, we can mock those values, they are not relevant for the
test.

> -- 
> Pino Toscano




signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2 2/2] tests: sysinfotest: add new test case for S390

2018-01-12 Thread John Ferlan


On 01/12/2018 07:44 AM, Pino Toscano wrote:
> On Friday, 12 January 2018 12:38:02 CET Bjoern Walk wrote:
>> Let's add a test case for S390 with CPU frequency information available.
>> Test data is sampled from an IBM z13 system running kernel 4.14 on LPAR.
>>
>> Reviewed-by: Boris Fiuczynski 
>> Signed-off-by: Bjoern Walk 
>> ---
> 
> LGTM, just a couple of notes that came into my mind when reading the
> existing sysinfodata for s390.
> 
>> diff --git a/tests/sysinfodata/s390-freqcpuinfo.data 
>> b/tests/sysinfodata/s390-freqcpuinfo.data
>> new file mode 100644
>> index ..0edc371d
>> --- /dev/null
>> +++ b/tests/sysinfodata/s390-freqcpuinfo.data
>> [...]
>> +processor 0: version = 00,  identification = 145F07,  machine = 2964
>> +processor 1: version = 00,  identification = 145F07,  machine = 2964
>> +processor 2: version = 00,  identification = 145F07,  machine = 2964
>> +processor 3: version = 00,  identification = 145F07,  machine = 2964
>> +processor 4: version = 00,  identification = 145F07,  machine = 2964
>> +processor 5: version = 00,  identification = 145F07,  machine = 2964
>> +processor 6: version = 00,  identification = 145F07,  machine = 2964
>> +processor 7: version = 00,  identification = 145F07,  machine = 2964
> 
> All the various "identification", and ...
> 
>> diff --git a/tests/sysinfodata/s390-freqsysinfo.data 
>> b/tests/sysinfodata/s390-freqsysinfo.data
>> new file mode 100644
>> index ..1941ef0b
>> --- /dev/null
>> +++ b/tests/sysinfodata/s390-freqsysinfo.data
>> @@ -0,0 +1,173 @@
>> +Manufacturer: IBM
>> +Type: 2964
>> +Model:704  NC9
>> +Sequence Code:00085F07
> 
> .. this value are replaced by what look like dummy values, so maybe
> the same should be done for this data too (in case they are sensitive
> information)?
> 

I could adjust Sequence Code here too if desired.  I see that
tests/sysinfodata/s390sysinfo.data used 12345.

Let me know...

John

> 
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [jenkins-ci PATCH] guests: Make rpcgen mapping more future-proof

2018-01-12 Thread Daniel P. Berrange
On Fri, Jan 12, 2018 at 01:31:22PM +0100, Andrea Bolognani wrote:
> Since whatever is in Fedora Rawhide will end up in future Fedora
> releases, it makes sense to use the newer package as default and
> override it for existing releases (as well as CentOS), so that
> no tweaking will be needed when Fedora 28 and later are added to
> the CI setup.
> 
> Suggested-by: Peter Krempa 
> Signed-off-by: Andrea Bolognani 
> ---
>  guests/vars/mappings.yml | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
> index b79757e..0b32f90 100644
> --- a/guests/vars/mappings.yml
> +++ b/guests/vars/mappings.yml
> @@ -606,8 +606,10 @@ mappings:
>  
>rpcgen:
>  deb: libc-dev-bin
> -rpm: glibc-common
> -FedoraRawhide: glibc-rpcgen
> +rpm: glibc-rpcgen

You shouldn't refer to glibc-rpcgen - use the name 'rpcgen' which
is a virtual provide, because existance of glibc-rpcgen is a
temporary hack


> +CentOS: glibc-common
> +Fedora26: glibc-common
> +Fedora27: glibc-common
>  FreeBSD:

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v2 1/2] util: virsysinfo: parse frequency information on S390

2018-01-12 Thread Bjoern Walk
Pino Toscano  [2018-01-12, 01:37PM +0100]:
> On Friday, 12 January 2018 12:38:01 CET Bjoern Walk wrote:
> > +while ((tmp_base = strstr(tmp_base, "cpu number")) &&
> > +   (tmp_base = virSysinfoParseS390Line(tmp_base, "cpu number", 
> > ))) {
> > +unsigned int n;
> > +char *mhz = NULL;
> > [...]
> > +if (n >= ret->nprocessor) {
> > +VIR_DEBUG("CPU number '%d' out of range", n);
> 
> Since 'n' is unsigned int, then the right printf format is %u.

You are right, of course. Expected to get a compiler warning or
syntax-check error, though.

> The rest of the patch seems good to me.

Thanks.

> 
> Thanks,
> -- 
> Pino Toscano




signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [jenkins-ci PATCH] guests: Make rpcgen mapping more future-proof

2018-01-12 Thread Andrea Bolognani
On Fri, 2018-01-12 at 13:17 +, Daniel P. Berrange wrote:
> >rpcgen:
> >  deb: libc-dev-bin
> > -rpm: glibc-common
> > -FedoraRawhide: glibc-rpcgen
> > +rpm: glibc-rpcgen
> 
> You shouldn't refer to glibc-rpcgen - use the name 'rpcgen' which
> is a virtual provide, because existance of glibc-rpcgen is a
> temporary hack

Makes sense, I'll change it.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [jenkins-ci PATCH v2 1/2] guests: Fix package name for rpcgen

2018-01-12 Thread Andrea Bolognani
The glibc-rpcgen package is just a temporary hack, so we should
use the rpcgen name from the get-go instead.

Signed-off-by: Andrea Bolognani 
---
 guests/vars/mappings.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index b79757e..a7032e6 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -607,7 +607,7 @@ mappings:
   rpcgen:
 deb: libc-dev-bin
 rpm: glibc-common
-FedoraRawhide: glibc-rpcgen
+FedoraRawhide: rpcgen
 FreeBSD:
 
   rpmbuild:
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [jenkins-ci PATCH v2 0/2] guests: Make rpcgen mapping more future-proof

2018-01-12 Thread Andrea Bolognani
Changes from [v1]:

  * use the rpcgen name instead of glibc-rpcgen, which is a just
temporary hack and will go away.

[v1] https://www.redhat.com/archives/libvir-list/2018-January/msg00422.html

Andrea Bolognani (2):
  guests: Fix package name for rpcgen
  guests: Make rpcgen mapping more future-proof

 guests/vars/mappings.yml | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [jenkins-ci PATCH v2 2/2] guests: Make rpcgen mapping more future-proof

2018-01-12 Thread Andrea Bolognani
Since whatever is in Fedora Rawhide will end up in future Fedora
releases, it makes sense to use the newer package as default and
override it for existing releases (as well as CentOS), so that
no tweaking will be needed when Fedora 28 and later are added to
the CI setup.

Suggested-by: Peter Krempa 
Signed-off-by: Andrea Bolognani 
---
 guests/vars/mappings.yml | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index a7032e6..9c194d0 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -606,8 +606,10 @@ mappings:
 
   rpcgen:
 deb: libc-dev-bin
-rpm: glibc-common
-FedoraRawhide: rpcgen
+rpm: rpcgen
+CentOS: glibc-common
+Fedora26: glibc-common
+Fedora27: glibc-common
 FreeBSD:
 
   rpmbuild:
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v2 2/2] tests: sysinfotest: add new test case for S390

2018-01-12 Thread Bjoern Walk
John Ferlan  [2018-01-12, 08:04AM -0500]:
> 
> 
> On 01/12/2018 07:44 AM, Pino Toscano wrote:
> > On Friday, 12 January 2018 12:38:02 CET Bjoern Walk wrote:
> >> Let's add a test case for S390 with CPU frequency information available.
> >> Test data is sampled from an IBM z13 system running kernel 4.14 on LPAR.
> >>
> >> Reviewed-by: Boris Fiuczynski 
> >> Signed-off-by: Bjoern Walk 
> >> ---
> > 
> > LGTM, just a couple of notes that came into my mind when reading the
> > existing sysinfodata for s390.
> > 
> >> diff --git a/tests/sysinfodata/s390-freqcpuinfo.data 
> >> b/tests/sysinfodata/s390-freqcpuinfo.data
> >> new file mode 100644
> >> index ..0edc371d
> >> --- /dev/null
> >> +++ b/tests/sysinfodata/s390-freqcpuinfo.data
> >> [...]
> >> +processor 0: version = 00,  identification = 145F07,  machine = 2964
> >> +processor 1: version = 00,  identification = 145F07,  machine = 2964
> >> +processor 2: version = 00,  identification = 145F07,  machine = 2964
> >> +processor 3: version = 00,  identification = 145F07,  machine = 2964
> >> +processor 4: version = 00,  identification = 145F07,  machine = 2964
> >> +processor 5: version = 00,  identification = 145F07,  machine = 2964
> >> +processor 6: version = 00,  identification = 145F07,  machine = 2964
> >> +processor 7: version = 00,  identification = 145F07,  machine = 2964
> > 
> > All the various "identification", and ...
> > 
> >> diff --git a/tests/sysinfodata/s390-freqsysinfo.data 
> >> b/tests/sysinfodata/s390-freqsysinfo.data
> >> new file mode 100644
> >> index ..1941ef0b
> >> --- /dev/null
> >> +++ b/tests/sysinfodata/s390-freqsysinfo.data
> >> @@ -0,0 +1,173 @@
> >> +Manufacturer: IBM
> >> +Type: 2964
> >> +Model:704  NC9
> >> +Sequence Code:00085F07
> > 
> > .. this value are replaced by what look like dummy values, so maybe
> > the same should be done for this data too (in case they are sensitive
> > information)?
> > 
> 
> I could adjust Sequence Code here too if desired.  I see that
> tests/sysinfodata/s390sysinfo.data used 12345.
> 
> Let me know...

Sure, why not.

Thanks for reviewing and cleaning up and pushing.

> 
> John
> 
> > 
> > 
> > --
> > libvir-list mailing list
> > libvir-list@redhat.com
> > https://www.redhat.com/mailman/listinfo/libvir-list
> > 
> 


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list