Re: [libvirt PATCH 00/20] qemu: Introduce hvf domain type for Hypervisor.framework

2022-01-21 Thread Christophe Fergeau
Hey,

I tested this on an intel macbook, virsh capabilities shows 'hvf' for
the x86_64 qemu binary, I started a f35 guest, -accel hvf is present
on the command line, and the VM is a lot faster than without hvf.
Feel free to add my Tested-by to the series:
Tested-by: Christophe Fergeau 

Christophe


пн, 17 янв. 2022 г. в 11:56, Andrea Bolognani :
>
> In order to hopefully address [libvirt#147] at long last, I've picked
> up Roman's patches from 2018 and attempted to forward-port them.
>
> More specifically, I've used the [roolebo/hvf-domain] branch as a
> starting point, since it seems to contain a few improvements over
> [v2] and was just easier to pick up.
>
> The code is mostly his own, so I've retained the existing authorship
> information, but I've dropped Reviewed-by tags for commits that have
> been modified in non-trivial ways. I've applied very minimal style
> tweaks along the way, but overall I've tried to modify the existing
> patches as little as possible.
>
> I've added a few changes of my own, which I've marked as "fixup!"
> when I felt that they should be squashed into the previous patch
> rather than existing as separate commits.
>
> The new test cases, such as they are, pass, and no regressions to KVM
> support appear to have been introduced in the process. I don't
> currently have access to a machine running macOS, so I can't verify
> that it's actually possible to start a hardware-accelerated VM by
> myself, but a user has confirmed on the GitLab issue that the new
> feature works.
>
> Changes from [v5]:
>
>   * rebased on top of master, dealing with a couple of
> straightforward merge conflicts in the process;
>   * moved NEWS entry to the 8.1.0 section.
>
> Changes from [v4]:
>
>   * fixed an issue that prevented machine types from being probed
> correctly, effectively making the entire thing non functional;
>   * only report HVF support as available when the guest architecture
> and the host architecture match.
>
> Changes from [v3]:
>
>   * reintroduced the patch that was missing in the initial version
> of the forward-port;
>   * converted the documentation to reStructuredText and trimmed it
> significantly;
>   * reworked virQEMUCapsAccelStr() based on Dan's suggestions;
>   * reworked macOS support in the test suite based on Dan's
> suggestions;
>   * fixed a few minor issues found while doing the above.
>
> Changes from [v2]:
>
>   * rebased on top of master;
>   * added a couple of simple test cases.
>
> Useful links:
>
>   * GitLab: [abologna/hvf]
>   * CI: [pipeline]
>
> [libvirt#147] https://gitlab.com/libvirt/libvirt/-/issues/147
> [roolebo/hvf-domain] https://github.com/roolebo/libvirt/tree/hvf-domain
> [abologna/hvf] https://gitlab.com/abologna/libvirt/-/commits/hvf
> [pipeline] https://gitlab.com/abologna/libvirt/-/pipelines/449465562
> [v5] 
> https://listman.redhat.com/archives/libvir-list/2022-January/msg00411.html
> [v4] 
> https://listman.redhat.com/archives/libvir-list/2022-January/msg00280.html
> [v3] 
> https://listman.redhat.com/archives/libvir-list/2022-January/msg00131.html
> [v2] 
> https://listman.redhat.com/archives/libvir-list/2018-November/msg00802.html
>
> Andrea Bolognani (7):
>   qemu: Only probe KVM on Linux
>   fixup! qemu: Fix / improve virQEMUCapsProbeHVF()
>   tests: Introduce testQemuHostOS
>   tests: Add macOS support to testutilsqemu
>   tests: Add macOS support to qemuxml2*test
>   tests: Add HVF test cases
>   fixup! NEWS: Mention Apple Silicon support for HVF
>
> Roman Bolshakov (13):
>   qemu: Add KVM CPUs into cache only if KVM is present
>   conf: Add hvf domain type
>   qemu: Define hvf capability
>   qemu: Query hvf capability on macOS
>   qemu: Expose hvf domain type if hvf is supported
>   qemu: Introduce virQEMUCapsAccelStr
>   qemu: Introduce virQEMUCapsTypeIsAccelerated
>   qemu: Introduce virQEMUCapsHaveAccel
>   qemu: Correct CPU capabilities probing for hvf
>   docs: Add hvf on QEMU driver page
>   docs: Note hvf support for domain elements
>   docs: Add support page for libvirt on macOS
>   news: Mention hvf domain type
>
>  NEWS.rst  |   5 +
>  docs/docs.html.in |   3 +
>  docs/drvqemu.rst  |  48 +-
>  docs/formatdomain.rst |  22 +--
>  docs/index.html.in|   4 +-
>  docs/macos.rst|  44 ++
>  docs/meson.build  |   1 +
>  docs/schemas/domaincommon.rng |   1 +
>  src/conf/domain_conf.c|   1 +
>  src/conf/domain_conf.h   

Re: [libvirt] [PATCH v2 1/2] qemu: Fix "boolen" typo in API doc

2019-03-29 Thread Christophe Fergeau
Hey,

On Wed, Mar 27, 2019 at 01:32:44PM +0100, Ján Tomko wrote:
> Please use --cover-letter for series with two or more patches for neater
> alignment of e-mails.
> 
> On Wed, Mar 27, 2019 at 12:21:24PM +0100, Christophe Fergeau wrote:
> > This also adjusts the argument name which should be 'isListen' in both
> > cases rather than 'listen'.
> > 
> > Signed-off-by: Christophe Fergeau 
> > ---
> > Changes since v1:
> > - really fix 'boolen' typo
> > 
> > src/qemu/qemu_command.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> > index f81d20e5f7..82675c5d4e 100644
> > --- a/src/qemu/qemu_command.c
> > +++ b/src/qemu/qemu_command.c
> > @@ -876,7 +876,7 @@ qemuBuildRBDSecinfoURI(virBufferPtr buf,
> > 
> > /* qemuBuildTLSx509BackendProps:
> >  * @tlspath: path to the TLS credentials
> > - * @listen: boolen listen for client or server setting
> > + * @isListen: boolean listen for client or server setting
> 
> Both the rename and the typo fix could be qualified as trivial.
> However the description does not make much sense to me.

To me neither. Maybe this?
* @isListen: boolean indicating if this is a client or server TLS credentials

> 
> >  * @verifypeer: boolean to enable peer verification (form of authorization)
> 
> peer verification is also used for authentication, as of
> commit 441d3eb6d1be940a67ce45a286602a967601b157 (tag: CVE-2017-1000256)

Just need to append /authentication to the end?
* @verifypeer: boolean to enable peer verification (form of 
authorization/authentication)


Christophe


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

[libvirt] [PATCH v2 1/2] qemu: Fix "boolen" typo in API doc

2019-03-27 Thread Christophe Fergeau
This also adjusts the argument name which should be 'isListen' in both
cases rather than 'listen'.

Signed-off-by: Christophe Fergeau 
---
Changes since v1:
- really fix 'boolen' typo

 src/qemu/qemu_command.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f81d20e5f7..82675c5d4e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -876,7 +876,7 @@ qemuBuildRBDSecinfoURI(virBufferPtr buf,
 
 /* qemuBuildTLSx509BackendProps:
  * @tlspath: path to the TLS credentials
- * @listen: boolen listen for client or server setting
+ * @isListen: boolean listen for client or server setting
  * @verifypeer: boolean to enable peer verification (form of authorization)
  * @alias: alias for the TLS credentials object
  * @secalias: if one exists, the alias of the security object for passwordid
@@ -917,7 +917,7 @@ qemuBuildTLSx509BackendProps(const char *tlspath,
 /* qemuBuildTLSx509CommandLine:
  * @cmd: Pointer to command
  * @tlspath: path to the TLS credentials
- * @listen: boolen listen for client or server setting
+ * @isListen: boolean listen for client or server setting
  * @verifypeer: boolean to enable peer verification (form of authorization)
  * @certEncSecretAlias: alias of a 'secret' object for decrypting TLS private 
key
  *  (optional)
-- 
2.21.0

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


[libvirt] [PATCH v2 2/2] doc: Fix 'encryption' documentation

2019-03-27 Thread Christophe Fergeau
There are 2 examples of use of  which uses a 'type'
attribute rather than 'format' as documented in the XML schema:

  

  

  default
  qcow
  luks

  
  


  

  
  

  

  

  

This also matches what virStorageEncryptionParseNode() is doing.

Signed-off-by: Christophe Fergeau 
---
 docs/formatdomain.html.in  | 2 +-
 docs/formatstorage.html.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0e3799061d..4052eb2528 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2761,7 +2761,7 @@
   write_iops_sec10/write_iops_sec
 /iotune
 boot order='2'/
-encryption type='...'
+encryption format='...'
   ...
 /encryption
 shareable/
diff --git a/docs/formatstorage.html.in b/docs/formatstorage.html.in
index 2a7604d136..dd2f27e54c 100644
--- a/docs/formatstorage.html.in
+++ b/docs/formatstorage.html.in
@@ -761,7 +761,7 @@
 mtime1341930622.047245868/mtime
 ctime1341930622.047245868/ctime
   /timestamps
-  encryption type='...'
+  encryption format='...'
 ...
   /encryption
   compat1.1/compat
-- 
2.21.0

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


Re: [libvirt] [PATCH 1/2] qemu: Fix "boolen" typo in API doc

2019-03-27 Thread Christophe Fergeau
On Wed, Mar 27, 2019 at 12:13:41PM +0100, Pino Toscano wrote:
> On Wednesday, 27 March 2019 12:00:21 CET Christophe Fergeau wrote:
> > This also adjusts the argument name which should be 'isListen' in both
> > cases rather than 'listen'.
> > 
> > Signed-off-by: Christophe Fergeau 
> > ---
> >  src/qemu/qemu_command.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> > index f81d20e5f7..bfa7211894 100644
> > --- a/src/qemu/qemu_command.c
> > +++ b/src/qemu/qemu_command.c
> > @@ -876,7 +876,7 @@ qemuBuildRBDSecinfoURI(virBufferPtr buf,
> >  
> >  /* qemuBuildTLSx509BackendProps:
> >   * @tlspath: path to the TLS credentials
> > - * @listen: boolen listen for client or server setting
> > + * @isListen: boolen listen for client or server setting
> 
> Still "boolen"...

Oops... going to send a v2 !

Christophe


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

[libvirt] [PATCH 2/2] doc: Fix 'encryption' documentation

2019-03-27 Thread Christophe Fergeau
There are 2 examples of use of  which uses a 'type'
attribute rather than 'format' as documented in the XML schema:

  

  

  default
  qcow
  luks

  
  


  

  
  

  

  

  

This also matches what virStorageEncryptionParseNode() is doing.

Signed-off-by: Christophe Fergeau 
---
 docs/formatdomain.html.in  | 2 +-
 docs/formatstorage.html.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0e3799061d..4052eb2528 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2761,7 +2761,7 @@
   write_iops_sec10/write_iops_sec
 /iotune
 boot order='2'/
-encryption type='...'
+encryption format='...'
   ...
 /encryption
 shareable/
diff --git a/docs/formatstorage.html.in b/docs/formatstorage.html.in
index 2a7604d136..dd2f27e54c 100644
--- a/docs/formatstorage.html.in
+++ b/docs/formatstorage.html.in
@@ -761,7 +761,7 @@
 mtime1341930622.047245868/mtime
 ctime1341930622.047245868/ctime
   /timestamps
-  encryption type='...'
+  encryption format='...'
 ...
   /encryption
   compat1.1/compat
-- 
2.21.0

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


[libvirt] [PATCH 1/2] qemu: Fix "boolen" typo in API doc

2019-03-27 Thread Christophe Fergeau
This also adjusts the argument name which should be 'isListen' in both
cases rather than 'listen'.

Signed-off-by: Christophe Fergeau 
---
 src/qemu/qemu_command.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f81d20e5f7..bfa7211894 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -876,7 +876,7 @@ qemuBuildRBDSecinfoURI(virBufferPtr buf,
 
 /* qemuBuildTLSx509BackendProps:
  * @tlspath: path to the TLS credentials
- * @listen: boolen listen for client or server setting
+ * @isListen: boolen listen for client or server setting
  * @verifypeer: boolean to enable peer verification (form of authorization)
  * @alias: alias for the TLS credentials object
  * @secalias: if one exists, the alias of the security object for passwordid
@@ -917,7 +917,7 @@ qemuBuildTLSx509BackendProps(const char *tlspath,
 /* qemuBuildTLSx509CommandLine:
  * @cmd: Pointer to command
  * @tlspath: path to the TLS credentials
- * @listen: boolen listen for client or server setting
+ * @isListen: boolean listen for client or server setting
  * @verifypeer: boolean to enable peer verification (form of authorization)
  * @certEncSecretAlias: alias of a 'secret' object for decrypting TLS private 
key
  *  (optional)
-- 
2.21.0

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


[libvirt] [libvirt-glib 1/3] config: Fix gvir_config_xml_node_to_string() leak

2019-02-12 Thread Christophe Fergeau
If xmlNodeDump() fails, we would be leaking the xmlBuffer we created.
This commit ensures we don't return early before this buffer is freed.

Signed-off-by: Christophe Fergeau 
---
 libvirt-gconfig/libvirt-gconfig-helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-helpers.c 
b/libvirt-gconfig/libvirt-gconfig-helpers.c
index 0314a72f..e8f9664a 100644
--- a/libvirt-gconfig/libvirt-gconfig-helpers.c
+++ b/libvirt-gconfig/libvirt-gconfig-helpers.c
@@ -293,7 +293,7 @@ gvir_config_xml_node_to_string(xmlNodePtr node)
 
 xmlbuf = xmlBufferCreate();
 if (xmlNodeDump(xmlbuf, node->doc, node, 0, 1) < 0)
-return NULL;
+xml = NULL;
 else
 xml = g_strndup((gchar *)xmlBufferContent(xmlbuf), 
xmlBufferLength(xmlbuf));
 
-- 
2.20.1

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


[libvirt] [libvirt-glib 3/3] events: Mark 'eventlock' as static

2019-02-12 Thread Christophe Fergeau
It's not used outside of the libvirt-glib-event.c file, so there is no
good reason for not having it static. As it was not listed in
libvirt-glib.sym, this will make no changes to the publicly exported
symbols (ie this is not an ABI change).

Signed-off-by: Christophe Fergeau 
---
 libvirt-glib/libvirt-glib-event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libvirt-glib/libvirt-glib-event.c 
b/libvirt-glib/libvirt-glib-event.c
index f8227d61..4548aa65 100644
--- a/libvirt-glib/libvirt-glib-event.c
+++ b/libvirt-glib/libvirt-glib-event.c
@@ -110,7 +110,7 @@ struct gvir_event_timeout
 virFreeCallback ff;
 };
 
-GMutex *eventlock = NULL;
+static GMutex *eventlock = NULL;
 
 static int nextwatch = 1;
 static GPtrArray *handles;
-- 
2.20.1

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


[libvirt] [libvirt-glib 2/3] object: Fix gvir_connection_create_storage_pool() leak

2019-02-12 Thread Christophe Fergeau
We need to free the string returned by gvir_config_object_to_xml() after
using it.

Signed-off-by: Christophe Fergeau 
---
 libvirt-gobject/libvirt-gobject-connection.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libvirt-gobject/libvirt-gobject-connection.c 
b/libvirt-gobject/libvirt-gobject-connection.c
index c48d51b9..15b47093 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -1999,7 +1999,7 @@ GVirStoragePool *gvir_connection_create_storage_pool
  GVirConfigStoragePool *conf,
  guint flags,
  GError **err) {
-const gchar *xml;
+gchar *xml;
 virStoragePoolPtr handle;
 GVirConnectionPrivate *priv;
 
@@ -2012,7 +2012,9 @@ GVirStoragePool *gvir_connection_create_storage_pool
 g_return_val_if_fail(xml != NULL, NULL);
 
 priv = conn->priv;
-if (!(handle = virStoragePoolDefineXML(priv->conn, xml, flags))) {
+handle = virStoragePoolDefineXML(priv->conn, xml, flags);
+g_free(xml);
+if (!handle) {
 gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
flags,
_("Failed to create storage pool"));
-- 
2.20.1

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


[libvirt] [libvirt-glib] gconfig: Add gvir_config_storage_vol_target_set_features

2019-01-24 Thread Christophe Fergeau
Only one feature is supported at the moment, 'lazy refcount'

Signed-off-by: Christophe Fergeau 
---
 .../libvirt-gconfig-storage-vol-target.c   | 14 ++
 .../libvirt-gconfig-storage-vol-target.h   |  6 ++
 libvirt-gconfig/libvirt-gconfig.sym|  6 ++
 libvirt-gconfig/tests/test-domain-create.c |  1 +
 4 files changed, 27 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c 
b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c
index 751c950c..300d3927 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c
+++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c
@@ -109,3 +109,17 @@ void 
gvir_config_storage_vol_target_set_compat(GVirConfigStorageVolTarget *targe
 gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(target),
 "compat", compat);
 }
+
+void gvir_config_storage_vol_target_set_features(GVirConfigStorageVolTarget 
*target,
+ guint64 features)
+{
+g_return_if_fail(GVIR_CONFIG_IS_STORAGE_VOL_TARGET(target));
+g_return_if_fail((features & 
~GVIR_CONFIG_STORAGE_VOL_TARGET_FEATURE_LAZY_REFCOUNT) == 0);
+
+if ((features & GVIR_CONFIG_STORAGE_VOL_TARGET_FEATURE_LAZY_REFCOUNT) != 
0) {
+GVirConfigObject *features_node;
+features_node = 
gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(target), "features");
+gvir_config_object_set_node_content(features_node, "lazy_refcount", 
"");
+g_object_unref(features_node);
+}
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h 
b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h
index 2030e734..f1b50035 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h
+++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h
@@ -69,6 +69,12 @@ void 
gvir_config_storage_vol_target_set_format(GVirConfigStorageVolTarget *targe
const char *format);
 void gvir_config_storage_vol_target_set_permissions(GVirConfigStorageVolTarget 
*target,
 
GVirConfigStoragePermissions *perms);
+typedef enum {
+GVIR_CONFIG_STORAGE_VOL_TARGET_FEATURE_LAZY_REFCOUNT = 1 << 0
+} GVirConfigStorageVolTargetFeatures;
+
+void gvir_config_storage_vol_target_set_features(GVirConfigStorageVolTarget 
*target,
+ guint64 features);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig.sym 
b/libvirt-gconfig/libvirt-gconfig.sym
index ee5bf8ad..2d7486ea 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -779,4 +779,10 @@ global:
gvir_config_domain_set_custom_xml_ns_children;
 } LIBVIRT_GCONFIG_0.2.4;
 
+LIBVIRT_GCONFIG_2.0.1 {
+global:
+   gvir_config_storage_vol_target_features_get_type;
+   gvir_config_storage_vol_target_set_features;
+} LIBVIRT_GCONFIG_2.0.0;
+
 #  define new API here using predicted next version number 
diff --git a/libvirt-gconfig/tests/test-domain-create.c 
b/libvirt-gconfig/tests/test-domain-create.c
index 79c242f4..f8fd6d51 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -498,6 +498,7 @@ int main(int argc, char **argv)
 gvir_config_storage_vol_target_set_format(vol_target, "qcow2");
 gvir_config_storage_vol_target_set_permissions(vol_target, perms);
 gvir_config_storage_vol_target_set_compat(vol_target, "1.1");
+gvir_config_storage_vol_target_set_features(vol_target, 
GVIR_CONFIG_STORAGE_VOL_TARGET_FEATURE_LAZY_REFCOUNT);
 g_object_unref(G_OBJECT(perms));
 gvir_config_storage_vol_set_target(vol, vol_target);
 g_object_unref(G_OBJECT(vol_target));
-- 
2.20.1

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


Re: [libvirt] [libvirt PATCH] qemu: Add support for specifying SPICE TLS ciphers

2018-04-04 Thread Christophe Fergeau
On Wed, Apr 04, 2018 at 09:11:25AM +0100, Daniel P. Berrangé wrote:
> On Tue, Apr 03, 2018 at 08:11:05PM +0200, Jiri Denemark wrote:
> > On Tue, Apr 03, 2018 at 17:23:50 +0200, Ján Tomko wrote:
> > > From: Christophe Fergeau <cferg...@redhat.com>
> > > 
> > > This commit adds a 'spice_tls_ciphers' parameter in
> > > qemu.conf which allows to configure which TLS ciphers
> > > SPICE will be using for its TLS connections.
> > > 
> > > https://bugzilla.redhat.com/show_bug.cgi?id=1562032
> > > 
> > > Signed-off-by: Christophe Fergeau <cferg...@redhat.com>
> > > Signed-off-by: Ján Tomko <jto...@redhat.com>
> > > ---
> > > This is mostly useful as a workaround for missing crypto policies,
> > > so I'm not sure if it's upstream material.
> > 
> > Are OpenSSL crypto policies supported upstream? If so, I think we should
> > just rely on them and leave this workaround for downstreams if they want
> > it.

--system-ciphers-file support seems to be a fedora patch
(openssl-1.1.0-system-cipherlist.patch), I could not find it in the
upstream git.
Something I realized recently is that OpenSSL crypto policies as they
are now in Fedora only allow to configure TLS ciphers, you cannot
enable/disable TLS protocol versions. This is possible with the gnutls
crypto policies.


> >Also, what would we do if spice changed its TLS code to use another
> > library, wouldn't it force us to translate the parameters from OpenSSL
> > to the other library if this happens and this code is merged upstream?
> 
> The latter is actually my biggest concern with this. I would really like
> to get SPICE to use the QEMU TLS creds framework, so we can do the normal
> -object tls-creds-x509 ... setup as we do for other parts ofo QEMU. This
> would mean SPICE using GNUTLS format for specifying ciphers. In fact the
> GNUTLS format specifies ciphers and TLS protocol versions - both of which
> the quoted bug is asking for - whereas this patch only specifies ciphers

Yes, I also want to explore making use of -object tls-creds-x509 for
SPICE. However, if doing that, it seems better to go the whole way, and
let QEMU do the socket handling including TLS, which is probably some
longer term work

I also have a set of patches to address the TLS version issue, which
adds a -spice tls-min-version command line option, and another libvirt
qemu.conf option.

I can definitely spend more time on -object tls-creds-x509 support
before we decide whether to move forward one way or the other.


Another stop gap solution I was thinking of, but which I'm not sure it
would work would be to extend  so that we can use it
to append options to existing commandline parameters, rather than always
adding a new parameter with the option. If there had been a way to
generate
-spice $libvirt_generated_args,tls-ciphers= rather than
-spice $libvirt_generated_args -spice tls-ciphers= , I don't think
https://bugzilla.redhat.com/show_bug.cgi?id=1562032 would have been
opened.

Christophe


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

Re: [libvirt] How to generate better API documentation?

2017-01-17 Thread Christophe Fergeau
On Mon, Jan 16, 2017 at 09:17:03AM +, Daniel P. Berrange wrote:
> 
> To me the key factor is what the end result looks like, how easy it is to
> navigate & find stuff. From that POV doxygen is ruled out as the HTML it
> generates is just awful - I despair every time i find a project which has
> use doxygen for its API docs :-(
> 
> gtk-doc is pretty good in this respect, but the limitation is that they do
> not try to support every possible C style - they expect you to write code
> in a gobject like style. I can't tell offhand if libvirt is close enough
> to work with gtk-doc or not - I do know that QEMU failed. It is something
> you'd just have to try and see if it works, and also see if the result is
> better than what we have of course.

kernel people have been experimenting with Sphinx for both
linux/Documentation file, and inline source file documentation,
https://lwn.net/Articles/692704/

Christophe


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

[libvirt] [libvirt-glib] tests: Don't leak xml data in test-gconfig-device-unknown

2016-11-04 Thread Christophe Fergeau
---
 tests/test-gconfig.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
index 9cf3f12..2c98c25 100644
--- a/tests/test-gconfig.c
+++ b/tests/test-gconfig.c
@@ -782,6 +782,7 @@ static void test_domain_device_unknown(void)
 
 g_list_free_full(devices, g_object_unref);
 g_object_unref(G_OBJECT(domain));
+g_free(xml);
 }
 
 
-- 
2.9.3

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


Re: [libvirt] [PATCH v3] [glib 5/5] gconfig, tests: Add test case for unknown devices

2016-11-03 Thread Christophe Fergeau
On Thu, Nov 03, 2016 at 02:40:58PM +0100, Zeeshan Ali wrote:
> ---
>  tests/test-gconfig.c| 24 
>  tests/xml/gconfig-domain-device-unknown.xml |  5 +
>  2 files changed, 29 insertions(+)
>  create mode 100644 tests/xml/gconfig-domain-device-unknown.xml
> 
> diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
> index 5389a26..685cf97 100644
> --- a/tests/test-gconfig.c
> +++ b/tests/test-gconfig.c
> @@ -762,6 +762,28 @@ static void test_domain_device_pci_hostdev(void)
>  g_object_unref(G_OBJECT(domain));
>  }
>  
> +static void test_domain_device_unknown(void)
> +{
> +GVirConfigDomain *domain;
> +GList *devices;
> +GError *error = NULL;
> +char *xml;
> +
> +xml = load_xml("gconfig-domain-device-unknown.xml");
> +
> +domain = gvir_config_domain_new_from_xml(xml, );
> +g_assert_no_error(error);
> +
> +devices = gvir_config_domain_get_devices(domain);
> +g_assert_nonnull(devices);


+ gvir_config_domain_set_devices(domain, devices);

> +
> +check_xml(domain, "gconfig-domain-device-unknown.xml");
> +
> +g_list_free_full(devices, g_object_unref);
> +g_object_unref(G_OBJECT(domain));
> +}

Christophe


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] [glib 5/5] gconfig, tests: Add test case for unknown devices

2016-11-03 Thread Christophe Fergeau
On Thu, Nov 03, 2016 at 02:05:46PM +0100, Zeeshan Ali wrote:
> On Thu, Nov 3, 2016 at 1:03 PM, Christophe Fergeau <cferg...@redhat.com> 
> wrote:
> > On Thu, Nov 03, 2016 at 10:06:22AM +0100, Zeeshan Ali wrote:
> >> ---
> >>  tests/test-gconfig.c| 22 ++
> >>  tests/xml/gconfig-domain-device-unknown.xml |  5 +
> >>  2 files changed, 27 insertions(+)
> >>  create mode 100644 tests/xml/gconfig-domain-device-unknown.xml
> >>
> >> diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
> >> index 5389a26..b91f5af 100644
> >> --- a/tests/test-gconfig.c
> >> +++ b/tests/test-gconfig.c
> >> @@ -762,6 +762,26 @@ static void test_domain_device_pci_hostdev(void)
> >>  g_object_unref(G_OBJECT(domain));
> >>  }
> >>
> >> +static void test_domain_device_unknown(void)
> >> +{
> >> +GVirConfigDomain *domain;
> >> +GList *devices;
> >> +GError *error = NULL;
> >> +char *xml;
> >> +
> >> +xml = load_xml("gconfig-domain-device-unknown.xml");
> >> +
> >> +domain = gvir_config_domain_new_from_xml(xml, );
> >> +g_assert_no_error(error);
> >> +
> >> +devices = gvir_config_domain_get_devices(domain);
> >> +g_assert_nonnull(devices);
> >> +
> >> +g_list_free(devices);
> >> +g_object_unref(G_OBJECT(domain));
> >> +}
> >
> > The whole point of this work is to make sure that the unknown nodes are
> > kept when regenerating the XML document, so I would expect a call to
> > check_xml() too after calling set_devices(domain, devices);
> 
> * g_assert_nonnull(devices); actually checks that the only dev in the
> original xml is still there or not.

It checks that a device is there, it does say nothing about how it's
going to be serialized, so the test case could be working while what you
actually need is broken.

> * check_xml() does a simple string comparison and that fails since
> set_devices() changes the format.

Isn't it possible to use the exact same format as the output for the
source XML?

Christophe


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] [glib 5/5] gconfig, tests: Add test case for unknown devices

2016-11-03 Thread Christophe Fergeau
On Thu, Nov 03, 2016 at 10:06:22AM +0100, Zeeshan Ali wrote:
> ---
>  tests/test-gconfig.c| 22 ++
>  tests/xml/gconfig-domain-device-unknown.xml |  5 +
>  2 files changed, 27 insertions(+)
>  create mode 100644 tests/xml/gconfig-domain-device-unknown.xml
> 
> diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
> index 5389a26..b91f5af 100644
> --- a/tests/test-gconfig.c
> +++ b/tests/test-gconfig.c
> @@ -762,6 +762,26 @@ static void test_domain_device_pci_hostdev(void)
>  g_object_unref(G_OBJECT(domain));
>  }
>  
> +static void test_domain_device_unknown(void)
> +{
> +GVirConfigDomain *domain;
> +GList *devices;
> +GError *error = NULL;
> +char *xml;
> +
> +xml = load_xml("gconfig-domain-device-unknown.xml");
> +
> +domain = gvir_config_domain_new_from_xml(xml, );
> +g_assert_no_error(error);
> +
> +devices = gvir_config_domain_get_devices(domain);
> +g_assert_nonnull(devices);
> +
> +g_list_free(devices);
> +g_object_unref(G_OBJECT(domain));
> +}

The whole point of this work is to make sure that the unknown nodes are
kept when regenerating the XML document, so I would expect a call to
check_xml() too after calling set_devices(domain, devices);
You should have g_list_free_full(devices, g_object_unref); when freeing
the device list.

Christophe


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

Re: [libvirt] [glib 3/5] gconfig: Create objects for all domain device nodes

2016-11-03 Thread Christophe Fergeau
On Thu, Nov 03, 2016 at 10:00:56AM +0100, Zeeshan Ali wrote:
> Hi Christophe,
> 
> On Wed, Nov 2, 2016 at 6:21 PM, Christophe Fergeau <cferg...@redhat.com> 
> wrote:
> > Hey,
> >
> > On Tue, Nov 01, 2016 at 05:46:05PM +0100, Zeeshan Ali wrote:
> >> Currently we can and do get into serious trouble with this kind of code:
> >>
> >> devices = gvir_config_domain_get_devices(domain);
> >> gvir_config_domain_set_devices(domain, domain);
> >>
> >> since the first call above won't return a complete list of objects present
> >> in the domain but only the ones we have specific classes for and the
> >> second call above overwrites all device nodes under the domain. This
> >> lately made Boxes break against the latest libvirt, where a new device
> >> node was made compulsory[1].
> >>
> >> Although we should add support for all know domain devices ASAP, new
> >> devices will be added in future and this can happen again. So let's first
> >> ensure that gvir_config_domain_get_devices() always returns all devices
> >> under the domain. All unknown/unimplemented devices will now be returned
> >> as the very generic DomainDevice objects. Once we add support for a
> >> particular device, there will be no API/ABI breakage since the new class
> >> will inherit from DomainDevice class.
> >>
> >> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1388091
> >> ---
> >>  libvirt-gconfig/libvirt-gconfig-domain-device.c | 11 ---
> >>  1 file changed, 4 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device.c 
> >> b/libvirt-gconfig/libvirt-gconfig-domain-device.c
> >> index f78173a..3efca62 100644
> >> --- a/libvirt-gconfig/libvirt-gconfig-domain-device.c
> >> +++ b/libvirt-gconfig/libvirt-gconfig-domain-device.c
> >> @@ -64,7 +64,7 @@ gvir_config_domain_device_new_from_tree(GVirConfigXmlDoc 
> >> *doc,
> >>  } else if (xmlStrEqual(tree->name, (xmlChar*)"controller")) {
> >>  return gvir_config_domain_controller_new_from_tree(doc, tree);
> >>  } else if (xmlStrEqual(tree->name, (xmlChar*)"lease")) {
> >> -goto unimplemented;
> >> +type = GVIR_CONFIG_TYPE_DOMAIN_DEVICE;
> >>  } else if (xmlStrEqual(tree->name, (xmlChar*)"hostdev")) {
> >>  return gvir_config_domain_hostdev_new_from_tree(doc, tree);
> >>  } else if (xmlStrEqual(tree->name, (xmlChar*)"redirdev")) {
> >> @@ -76,7 +76,7 @@ gvir_config_domain_device_new_from_tree(GVirConfigXmlDoc 
> >> *doc,
> >>  } else if (xmlStrEqual(tree->name, (xmlChar*)"input")) {
> >>  type = GVIR_CONFIG_TYPE_DOMAIN_INPUT;
> >>  } else if (xmlStrEqual(tree->name, (xmlChar*)"hub")) {
> >> -goto unimplemented;
> >> +type = GVIR_CONFIG_TYPE_DOMAIN_DEVICE;
> >>  } else if (xmlStrEqual(tree->name, (xmlChar*)"graphics")) {
> >>  return gvir_config_domain_graphics_new_from_tree(doc, tree);
> >>  } else if (xmlStrEqual(tree->name, (xmlChar*)"video")) {
> >> @@ -90,22 +90,19 @@ 
> >> gvir_config_domain_device_new_from_tree(GVirConfigXmlDoc *doc,
> >>  } else if (xmlStrEqual(tree->name, (xmlChar*)"channel")) {
> >>  type = GVIR_CONFIG_TYPE_DOMAIN_CHANNEL;
> >>  } else if (xmlStrEqual(tree->name, (xmlChar*)"watchdog")) {
> >> -goto unimplemented;
> >> +type = GVIR_CONFIG_TYPE_DOMAIN_DEVICE;
> >>  } else if (xmlStrEqual(tree->name, (xmlChar*)"sound")) {
> >>  type = GVIR_CONFIG_TYPE_DOMAIN_SOUND;
> >>  } else if (xmlStrEqual(tree->name, (xmlChar*)"memballoon")) {
> >>  type = GVIR_CONFIG_TYPE_DOMAIN_MEMBALLOON;
> >>  } else {
> >>  g_debug("Unknown device node: %s", tree->name);
> >> -return NULL;
> >> +type = GVIR_CONFIG_TYPE_DOMAIN_DEVICE;
> >>  }
> >>
> >>  g_return_val_if_fail(g_type_is_a(type, 
> >> GVIR_CONFIG_TYPE_DOMAIN_DEVICE), NULL);
> >>
> >>  return 
> >> GVIR_CONFIG_DOMAIN_DEVICE(gvir_config_object_new_from_tree(type, doc, 
> >> NULL, tree));
> >> -unimplemented:
> >> -g_debug("Parsing of '%s' device nodes is unimplemented", tree->name);
> >
> > Very minor, but I would have kept this g_debug().
> 
> Sure but I think it should be used for even unknown cases, not just
> known unimplemented cases.

There is already a
 g_debug("Unknown device node: %s", tree->name);
when the node is unknown, I don't see a g_debug() anymore in the
known unimplemented cases.

Christophe


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

Re: [libvirt] [glib 3/5] gconfig: Create objects for all domain device nodes

2016-11-02 Thread Christophe Fergeau
Hey,

On Tue, Nov 01, 2016 at 05:46:05PM +0100, Zeeshan Ali wrote:
> Currently we can and do get into serious trouble with this kind of code:
> 
> devices = gvir_config_domain_get_devices(domain);
> gvir_config_domain_set_devices(domain, domain);
> 
> since the first call above won't return a complete list of objects present
> in the domain but only the ones we have specific classes for and the
> second call above overwrites all device nodes under the domain. This
> lately made Boxes break against the latest libvirt, where a new device
> node was made compulsory[1].
> 
> Although we should add support for all know domain devices ASAP, new
> devices will be added in future and this can happen again. So let's first
> ensure that gvir_config_domain_get_devices() always returns all devices
> under the domain. All unknown/unimplemented devices will now be returned
> as the very generic DomainDevice objects. Once we add support for a
> particular device, there will be no API/ABI breakage since the new class
> will inherit from DomainDevice class.
> 
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1388091
> ---
>  libvirt-gconfig/libvirt-gconfig-domain-device.c | 11 ---
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-device.c
> index f78173a..3efca62 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-device.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-device.c
> @@ -64,7 +64,7 @@ gvir_config_domain_device_new_from_tree(GVirConfigXmlDoc 
> *doc,
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"controller")) {
>  return gvir_config_domain_controller_new_from_tree(doc, tree);
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"lease")) {
> -goto unimplemented;
> +type = GVIR_CONFIG_TYPE_DOMAIN_DEVICE;
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"hostdev")) {
>  return gvir_config_domain_hostdev_new_from_tree(doc, tree);
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"redirdev")) {
> @@ -76,7 +76,7 @@ gvir_config_domain_device_new_from_tree(GVirConfigXmlDoc 
> *doc,
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"input")) {
>  type = GVIR_CONFIG_TYPE_DOMAIN_INPUT;
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"hub")) {
> -goto unimplemented;
> +type = GVIR_CONFIG_TYPE_DOMAIN_DEVICE;
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"graphics")) {
>  return gvir_config_domain_graphics_new_from_tree(doc, tree);
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"video")) {
> @@ -90,22 +90,19 @@ gvir_config_domain_device_new_from_tree(GVirConfigXmlDoc 
> *doc,
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"channel")) {
>  type = GVIR_CONFIG_TYPE_DOMAIN_CHANNEL;
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"watchdog")) {
> -goto unimplemented;
> +type = GVIR_CONFIG_TYPE_DOMAIN_DEVICE;
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"sound")) {
>  type = GVIR_CONFIG_TYPE_DOMAIN_SOUND;
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"memballoon")) {
>  type = GVIR_CONFIG_TYPE_DOMAIN_MEMBALLOON;
>  } else {
>  g_debug("Unknown device node: %s", tree->name);
> -return NULL;
> +type = GVIR_CONFIG_TYPE_DOMAIN_DEVICE;
>  }
>  
>  g_return_val_if_fail(g_type_is_a(type, GVIR_CONFIG_TYPE_DOMAIN_DEVICE), 
> NULL);
>  
>  return GVIR_CONFIG_DOMAIN_DEVICE(gvir_config_object_new_from_tree(type, 
> doc, NULL, tree));
> -unimplemented:
> -g_debug("Parsing of '%s' device nodes is unimplemented", tree->name);

Very minor, but I would have kept this g_debug().

Christophe


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

Re: [libvirt] [libvirt-glib 03/20] gconfig: Introduce GVirConfigDomainGraphicsListenAddress

2016-10-05 Thread Christophe Fergeau
hey,

On Tue, Oct 04, 2016 at 04:30:14PM +0100, Daniel P. Berrange wrote:
> > +
> > +/**
> > + * gvir_config_domain_graphics_listen_address_get_inet_address:
> > + *
> > + * Returns the #GInetAddress associated with the 
> > #GVirConfigDomainGraphicsListenAddress.
> > + *
> > + * Returns: (transfer full): a #GInetAddress.
> > + *
> > + */
> > +GInetAddress *
> > +gvir_config_domain_graphics_listen_address_get_inet_address(GVirConfigDomainGraphicsListenAddress
> >  *listen)
> > +{
> > +
> > g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_ADDRESS(listen), 
> > NULL);
> > +
> > +const gchar *address = 
> > gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(listen),
> > +NULL,
> > +"address");
> > +return g_inet_address_new_from_string(address);
> > +}
> 
> IIUC GInetAddress only supports numeric IP addresses, where as libvirt
> also allows hostnames anywhere that an IP address is used. So apps
> using get_inet_address are liable to get NULL returned if we use
> GInetAddress.
> 
> So IMHO we should not use GInetAddress as it'd lead to apps which
> blindly use this API not realising they'll break if someone put a
> hostname in the XML until it is too late.

Good point. Should we keep _set_inet_address() which would limit what we
can set, but would not lead to unexpected results depending on the XML
content, or should we just drop the GInetAddress altogether, and only
keep the string based API (which is what Visarion initially proposed).

Christophe


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

[libvirt] [libvirt-glib 15/20] gconfig: Adapt GVirConfigDomainGraphicsVnc to GVirConfigDomainGraphicsRemote

2016-10-04 Thread Christophe Fergeau
From: Fabiano Fidêncio 

This patch adapts GVirConfigDomainGraphicsVnc to the new
GVirConfigDomainGraphicsRemote, inheriting from it and using its helper
functions for getting auport and port properties.

As GVirConfigDomainGraphicsVnc now inherits from
GVirConfigDomainGraphicsRemote, this patch also introduces an ABI
breakage.

Signed-off-by: Fabiano Fidêncio 
---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
index 3bc5b8c..0927cc9 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
@@ -34,7 +34,7 @@ struct _GVirConfigDomainGraphicsVncPrivate
 gboolean unused;
 };
 
-G_DEFINE_TYPE(GVirConfigDomainGraphicsVnc, gvir_config_domain_graphics_vnc, 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS);
+G_DEFINE_TYPE(GVirConfigDomainGraphicsVnc, gvir_config_domain_graphics_vnc, 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_REMOTE);
 
 
 static void 
gvir_config_domain_graphics_vnc_class_init(GVirConfigDomainGraphicsVncClass 
*klass)
@@ -107,8 +107,7 @@ int 
gvir_config_domain_graphics_vnc_get_port(GVirConfigDomainGraphicsVnc *graphi
 {
 g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_VNC(graphics), 0);
 
-return 
gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(graphics),
-   NULL, "port", 0);
+return 
gvir_config_domain_graphics_remote_get_port(GVIR_CONFIG_DOMAIN_GRAPHICS_REMOTE(graphics));
 }
 
 void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc 
*graphics,
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
index e4d4fc3..482070a 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
@@ -42,7 +42,7 @@ typedef struct _GVirConfigDomainGraphicsVncClass 
GVirConfigDomainGraphicsVncClas
 
 struct _GVirConfigDomainGraphicsVnc
 {
-GVirConfigDomainGraphics parent;
+GVirConfigDomainGraphicsRemote parent;
 
 GVirConfigDomainGraphicsVncPrivate *priv;
 
@@ -51,7 +51,7 @@ struct _GVirConfigDomainGraphicsVnc
 
 struct _GVirConfigDomainGraphicsVncClass
 {
-GVirConfigDomainGraphicsClass parent_class;
+GVirConfigDomainGraphicsRemoteClass parent_class;
 
 gpointer padding[20];
 };
-- 
2.7.4

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

[libvirt] [libvirt-glib 20/20] gconfig: Move 'listen' handling to GVirConfigDomainGraphicsRemote

2016-10-04 Thread Christophe Fergeau
It's only useful in the remote case, and removes duplication between
GVirConfigDomainGraphicsSpice and GVirConfigDomainGraphicsVnc. Since
the spice/vnc listen API was not in a libvirt-gconfig release, we can
remove it without breaking API/ABI.
---
 .../libvirt-gconfig-domain-graphics-remote.c   | 103 +
 .../libvirt-gconfig-domain-graphics-remote.h   |   6 ++
 .../libvirt-gconfig-domain-graphics-spice.c| 103 -
 .../libvirt-gconfig-domain-graphics-spice.h|   6 --
 .../libvirt-gconfig-domain-graphics-vnc.c  | 103 -
 .../libvirt-gconfig-domain-graphics-vnc.h  |   6 --
 libvirt-gconfig/libvirt-gconfig.h  |   6 +-
 libvirt-gconfig/libvirt-gconfig.sym|   9 +-
 tests/test-gconfig.c   |   6 +-
 9 files changed, 118 insertions(+), 230 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-remote.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-remote.c
index 46b97f2..64928b6 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-remote.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-remote.c
@@ -93,3 +93,106 @@ int 
gvir_config_domain_graphics_remote_get_port(GVirConfigDomainGraphicsRemote *
 return 
gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(graphics),
NULL, "port", 0);
 }
+
+/**
+ * gvir_config_domain_graphics_remote_set_listen:
+ * @graphics: a #GVirConfigDomainGraphicsRemote
+ * @listens: (in) (element-type LibvirtGConfig.DomainGraphicsListen): listens
+ *
+ * This method is used to set the various listen nodes a 
#GVirConfigDomainGraphicsRemote
+ * device can handle.
+*/
+void 
gvir_config_domain_graphics_remote_set_listen(GVirConfigDomainGraphicsRemote 
*graphics,
+   GList *listens)
+{
+GList *it;
+
+g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_REMOTE(graphics));
+
+gvir_config_object_remove_attribute (GVIR_CONFIG_OBJECT(graphics),
+ "listen");
+gvir_config_object_remove_attribute (GVIR_CONFIG_OBJECT(graphics),
+ "socket");
+gvir_config_object_delete_children (GVIR_CONFIG_OBJECT (graphics),
+"listen", NULL);
+
+for (it = listens; it != NULL; it = it->next) {
+g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN(it->data));
+
+gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(graphics),
+  GVIR_CONFIG_OBJECT(it->data));
+}
+}
+
+/**
+ * gvir_config_domain_graphics_remote_add_listen_nodes:
+ * @graphics: a #GVirConfigDomainGraphicsRemote
+ * @listens: a #GVirConfigDomainGraphicsListen
+ *
+ * This method is used to add a listen node to a 
#GVirConfigDomainGraphicsRemote
+ * device can handle.
+*/
+void 
gvir_config_domain_graphics_remote_add_listen(GVirConfigDomainGraphicsRemote 
*graphics,
+   
GVirConfigDomainGraphicsListen *listen)
+{
+g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_REMOTE(graphics));
+
+gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(graphics),
+  GVIR_CONFIG_OBJECT(listen));
+}
+
+struct ListenData {
+GVirConfigXmlDoc *doc;
+const gchar *schema;
+GList *listen_devices;
+};
+
+static gboolean add_listen(xmlNodePtr node, gpointer opaque)
+{
+struct ListenData* data = (struct ListenData*)opaque;
+GVirConfigObject *object;
+
+if (g_strcmp0((const gchar *)node->name, "listen") != 0)
+return TRUE;
+
+object = gvir_config_object_new_from_tree
+
(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_ADDRESS,
+ data->doc,
+ data->schema,
+ node);
+if (object != NULL)
+data->listen_devices = g_list_append(data->listen_devices, object);
+else
+g_debug("Failed to parse %s node", node->name);
+
+return TRUE;
+}
+
+/**
+ * gvir_config_domain_graphics_remote_get_listen:
+ *
+ * Gets all the listen not of #GVirConfigDomainGraphicsRemote
+ *
+ * Returns: (element-type LibvirtGConfig.DomainGraphicsListen) (transfer full):
+ * a newly allocated #GList of #GVirConfigDomainGraphicsListen.
+ */
+GList *
+gvir_config_domain_graphics_remote_get_listen(GVirConfigDomainGraphicsRemote 
*graphics)
+{
+struct ListenData data;
+
+g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_REMOTE(graphics), 
NULL);
+
+g_object_get(G_OBJECT(graphics), "doc", , NULL);
+g_return_val_if_fail(data.doc != NULL, NULL);
+data.schema = gvir_config_object_get_schema(GVIR_CONFIG_OBJECT(graphics));
+data.listen_devices = NULL;
+
+gvir_config_object_foreach_child(GVIR_CONFIG_OBJECT(graphics),
+ NULL,
+  

[libvirt] [libvirt-glib 11/20] gconfig: Implement gvir_config_domain_graphics_spice_get_tls_port()

2016-10-04 Thread Christophe Fergeau
From: Fabiano Fidêncio 

Signed-off-by: Fabiano Fidêncio 
---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 8 
 libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h | 1 +
 libvirt-gconfig/libvirt-gconfig.sym | 1 +
 3 files changed, 10 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
index 051ff87..d66b362 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
@@ -113,6 +113,14 @@ void 
gvir_config_domain_graphics_spice_set_port(GVirConfigDomainGraphicsSpice *g
NULL);
 }
 
+int 
gvir_config_domain_graphics_spice_get_tls_port(GVirConfigDomainGraphicsSpice 
*graphics)
+{
+g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics), 0);
+
+return 
gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(graphics),
+   NULL, "tlsPort", 0);
+}
+
 void 
gvir_config_domain_graphics_spice_set_tls_port(GVirConfigDomainGraphicsSpice 
*graphics,
 int port)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
index 468ead6..54da02a 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
@@ -82,6 +82,7 @@ int 
gvir_config_domain_graphics_spice_get_port(GVirConfigDomainGraphicsSpice *gr
 void gvir_config_domain_graphics_spice_set_port(GVirConfigDomainGraphicsSpice 
*graphics,
 int port);
 
+int 
gvir_config_domain_graphics_spice_get_tls_port(GVirConfigDomainGraphicsSpice 
*graphics);
 void 
gvir_config_domain_graphics_spice_set_tls_port(GVirConfigDomainGraphicsSpice 
*graphics,
 int port);
 
diff --git a/libvirt-gconfig/libvirt-gconfig.sym 
b/libvirt-gconfig/libvirt-gconfig.sym
index aef53cd..4cd5f4d 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -759,6 +759,7 @@ global:
gvir_config_domain_graphics_listen_unix_set_path;
gvir_config_domain_graphics_spice_add_listen;
gvir_config_domain_graphics_spice_get_listen;
+   gvir_config_domain_graphics_spice_get_tls_port;
gvir_config_domain_graphics_spice_set_gl;
gvir_config_domain_graphics_spice_set_listen;
gvir_config_domain_graphics_vnc_add_listen;
-- 
2.7.4

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

[libvirt] [libvirt-glib 19/20] gconfig: Add precondition to gvir_config_object_get_xml_node()

2016-10-04 Thread Christophe Fergeau
This will catch (among other things) cases when
gvir_config_object_get_xml_node() is called with a NULL argument. Not
catching this could cause a crash later on in cases when
gvir_config_object_new_from_xml() is called and returns NULL, and then
we call gvir_config_object_get_attribute() on it.
Now this should be caught with runtime warnings so that the underlying
issue can be fixed.
---
 libvirt-gconfig/libvirt-gconfig-object.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-object.c 
b/libvirt-gconfig/libvirt-gconfig-object.c
index 6225de2..8cc4065 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -284,6 +284,8 @@ gvir_config_object_get_xml_doc(GVirConfigObject *config)
 G_GNUC_INTERNAL xmlNodePtr
 gvir_config_object_get_xml_node(GVirConfigObject *config)
 {
+g_return_val_if_fail(GVIR_CONFIG_IS_OBJECT(config), NULL);
+
 return config->priv->node;
 }
 
-- 
2.7.4

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


[libvirt] [libvirt-glib 16/20] gconfig: Add GVirCofigDomainGraphicsLocal class

2016-10-04 Thread Christophe Fergeau
From: Fabiano Fidêncio 

Adding this class more fore completness to the
GVirConfigDomainGraphicsRemote than for any other reason.

This patch introduces a new hierarchy in the project, where, instead of
having GVirConfigDomainGraphics{Desktop,Sdl} inheriting from
GVirConfigDomainGraphics, these classes will inherit from
GVirConfigDomainGraphicsLocal (see the next patches), which inherits
from GVirConfigDomainGraphics (it will cause ABI breakages, though).

Signed-off-by: Fabiano Fidêncio 
---
 libvirt-gconfig/Makefile.am|  2 +
 .../libvirt-gconfig-domain-graphics-local.c| 97 ++
 .../libvirt-gconfig-domain-graphics-local.h| 68 +++
 libvirt-gconfig/libvirt-gconfig.h  |  1 +
 libvirt-gconfig/libvirt-gconfig.sym|  4 +
 po/POTFILES.in |  1 +
 6 files changed, 173 insertions(+)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-local.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-local.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 64812bb..fe76615 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -50,6 +50,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-graphics-listen-address.h \
libvirt-gconfig-domain-graphics-listen-none.h \
libvirt-gconfig-domain-graphics-listen-unix.h \
+   libvirt-gconfig-domain-graphics-local.h \
libvirt-gconfig-domain-graphics-rdp.h \
libvirt-gconfig-domain-graphics-remote.h \
libvirt-gconfig-domain-graphics-sdl.h \
@@ -148,6 +149,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-graphics-listen-address.c \
libvirt-gconfig-domain-graphics-listen-none.c \
libvirt-gconfig-domain-graphics-listen-unix.c \
+   libvirt-gconfig-domain-graphics-local.c \
libvirt-gconfig-domain-graphics-rdp.c \
libvirt-gconfig-domain-graphics-remote.c \
libvirt-gconfig-domain-graphics-sdl.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-local.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-local.c
new file mode 100644
index 000..3a0fe51
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-local.c
@@ -0,0 +1,97 @@
+/*
+ * libvirt-gconfig-domain-graphics-local.c: libvirt domain graphics local 
configuration
+ *
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ *
+ * Author: Fabiano Fidêncio 
+ */
+
+#include 
+
+#include 
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_GRAPHICS_LOCAL_GET_PRIVATE(obj) 
\
+(G_TYPE_INSTANCE_GET_PRIVATE((obj), 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LOCAL, GVirConfigDomainGraphicsLocalPrivate))
+
+struct _GVirConfigDomainGraphicsLocalPrivate
+{
+gboolean unused;
+};
+
+typedef GVirConfigObject *(*GVirConfigDomainGraphicsLocalNewFromXml)(const 
gchar *xml, GError **error);
+
+G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainGraphicsLocal, 
gvir_config_domain_graphics_local, GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS);
+
+static void 
gvir_config_domain_graphics_local_class_init(GVirConfigDomainGraphicsLocalClass 
*klass)
+{
+g_type_class_add_private(klass, 
sizeof(GVirConfigDomainGraphicsLocalPrivate));
+}
+
+static void 
gvir_config_domain_graphics_local_init(GVirConfigDomainGraphicsLocal *graphics)
+{
+graphics->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_LOCAL_GET_PRIVATE(graphics);
+}
+
+GVirConfigDomainGraphicsLocal *
+gvir_config_domain_graphics_local_new_from_xml(const gchar *xml,
+GError **error)
+{
+GVirConfigDomainGraphicsLocalNewFromXml functions[] = {
+
(GVirConfigDomainGraphicsLocalNewFromXml)gvir_config_domain_graphics_sdl_new_from_xml,
+
(GVirConfigDomainGraphicsLocalNewFromXml)gvir_config_domain_graphics_desktop_new_from_xml,
+};
+GVirConfigObject *object;
+
+for (int 

[libvirt] [libvirt-glib 14/20] gconfig: Adapt GVirConfigDomainGraphicsRdp to GVirConfigDomainGraphicsRemote

2016-10-04 Thread Christophe Fergeau
From: Fabiano Fidêncio 

This patch adapts GVirConfigDomainGraphicsRdp to the new
GVirConfigDomainGraphicsRemote, inheriting from it and using its helper
functions for getting autoport and port properties.

As GVirConfigDomainGraphicsRdp now inherits from
GVirConfigDomainGraphicsRemote, this patch also introduces an ABI
breakage.

Signed-off-by: Fabiano Fidêncio 
---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.h | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c
index 7a2cb4d..b3958c8 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c
@@ -33,7 +33,7 @@ struct _GVirConfigDomainGraphicsRdpPrivate
 gboolean unused;
 };
 
-G_DEFINE_TYPE(GVirConfigDomainGraphicsRdp, gvir_config_domain_graphics_rdp, 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS);
+G_DEFINE_TYPE(GVirConfigDomainGraphicsRdp, gvir_config_domain_graphics_rdp, 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_REMOTE);
 
 
 static void 
gvir_config_domain_graphics_rdp_class_init(GVirConfigDomainGraphicsRdpClass 
*klass)
@@ -87,8 +87,7 @@ int 
gvir_config_domain_graphics_rdp_get_port(GVirConfigDomainGraphicsRdp *graphi
 {
 g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_RDP(graphics), 0);
 
-return 
gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(graphics),
-   NULL, "port", 0);
+return 
gvir_config_domain_graphics_remote_get_port(GVIR_CONFIG_DOMAIN_GRAPHICS_REMOTE(graphics));
 }
 
 void gvir_config_domain_graphics_rdp_set_port(GVirConfigDomainGraphicsRdp 
*graphics,
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.h 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.h
index a048ff8..a549e46 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.h
@@ -42,7 +42,7 @@ typedef struct _GVirConfigDomainGraphicsRdpClass 
GVirConfigDomainGraphicsRdpClas
 
 struct _GVirConfigDomainGraphicsRdp
 {
-GVirConfigDomainGraphics parent;
+GVirConfigDomainGraphicsRemote parent;
 
 GVirConfigDomainGraphicsRdpPrivate *priv;
 
@@ -51,7 +51,7 @@ struct _GVirConfigDomainGraphicsRdp
 
 struct _GVirConfigDomainGraphicsRdpClass
 {
-GVirConfigDomainGraphicsClass parent_class;
+GVirConfigDomainGraphicsRemoteClass parent_class;
 
 gpointer padding[20];
 };
-- 
2.7.4

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

[libvirt] [libvirt-glib 17/20] gconfig: Adapt GVirConfigDomainGraphicsSdl to GVirConfigDomainGraphicsLocal

2016-10-04 Thread Christophe Fergeau
From: Fabiano Fidêncio 

This patch adapts GVirConfigDomainGraphicsSdl to the new
GVirConfigDomainGraphicsLocal, inheriting from it and using its helper
functions for getting the display and fullscreen properties.

As GVirConfigDomainGraphicsSdl now inherits from
GVirConfigDomainGraphicsLocal, this patch also introduces an ABI
breakage.

Signed-off-by: Fabiano Fidêncio 
---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c | 2 +-
 libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c
index 1740494..d0d296d 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c
@@ -33,7 +33,7 @@ struct _GVirConfigDomainGraphicsSdlPrivate
 gboolean unused;
 };
 
-G_DEFINE_TYPE(GVirConfigDomainGraphicsSdl, gvir_config_domain_graphics_sdl, 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS);
+G_DEFINE_TYPE(GVirConfigDomainGraphicsSdl, gvir_config_domain_graphics_sdl, 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LOCAL);
 
 
 static void 
gvir_config_domain_graphics_sdl_class_init(GVirConfigDomainGraphicsSdlClass 
*klass)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h
index 5110f1c..3130f52 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h
@@ -42,7 +42,7 @@ typedef struct _GVirConfigDomainGraphicsSdlClass 
GVirConfigDomainGraphicsSdlClas
 
 struct _GVirConfigDomainGraphicsSdl
 {
-GVirConfigDomainGraphics parent;
+GVirConfigDomainGraphicsLocal parent;
 
 GVirConfigDomainGraphicsSdlPrivate *priv;
 
@@ -51,7 +51,7 @@ struct _GVirConfigDomainGraphicsSdl
 
 struct _GVirConfigDomainGraphicsSdlClass
 {
-GVirConfigDomainGraphicsClass parent_class;
+GVirConfigDomainGraphicsLocalClass parent_class;
 
 gpointer padding[20];
 };
-- 
2.7.4

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

[libvirt] [libvirt-glib 03/20] gconfig: Introduce GVirConfigDomainGraphicsListenAddress

2016-10-04 Thread Christophe Fergeau
From: Visarion Alexandru 

This is needed to be able to change the address a graphics
device is listening for.
---
 libvirt-gconfig/Makefile.am|   2 +
 ...ibvirt-gconfig-domain-graphics-listen-address.c | 131 +
 ...ibvirt-gconfig-domain-graphics-listen-address.h |  79 +
 libvirt-gconfig/libvirt-gconfig.h  |   1 +
 libvirt-gconfig/libvirt-gconfig.sym|   7 ++
 5 files changed, 220 insertions(+)
 create mode 100644 
libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
 create mode 100644 
libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index ec26ae7..045f570 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -47,6 +47,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-graphics.h \
libvirt-gconfig-domain-graphics-desktop.h \
libvirt-gconfig-domain-graphics-listen.h \
+   libvirt-gconfig-domain-graphics-listen-address.h \
libvirt-gconfig-domain-graphics-rdp.h \
libvirt-gconfig-domain-graphics-sdl.h \
libvirt-gconfig-domain-graphics-spice.h \
@@ -141,6 +142,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-graphics.c \
libvirt-gconfig-domain-graphics-desktop.c \
libvirt-gconfig-domain-graphics-listen.c \
+   libvirt-gconfig-domain-graphics-listen-address.c \
libvirt-gconfig-domain-graphics-rdp.c \
libvirt-gconfig-domain-graphics-sdl.c \
libvirt-gconfig-domain-graphics-spice.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
new file mode 100644
index 000..2489327
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
@@ -0,0 +1,131 @@
+/*
+ * libvirt-gconfig-domain-graphics-listen-address.c: libvirt domain graphics 
listen address configuration
+ *
+ * Copyright (C) 2016 Red Hat, Inc.
+ * Copyright (C) 2016 Visarion Alexandru 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ *
+ * Author: Visarion Alexandru 
+ */
+
+#include 
+
+#include 
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_ADDRESS_GET_PRIVATE(obj)
 \
+(G_TYPE_INSTANCE_GET_PRIVATE((obj), 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_ADDRESS, 
GVirConfigDomainGraphicsListenAddressPrivate))
+
+struct _GVirConfigDomainGraphicsListenAddressPrivate
+{
+gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainGraphicsListenAddress, 
gvir_config_domain_graphics_listen_address, 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN);
+
+
+static void 
gvir_config_domain_graphics_listen_address_class_init(GVirConfigDomainGraphicsListenAddressClass
 *klass)
+{
+g_type_class_add_private(klass, 
sizeof(GVirConfigDomainGraphicsListenAddressPrivate));
+}
+
+
+static void 
gvir_config_domain_graphics_listen_address_init(GVirConfigDomainGraphicsListenAddress
 *address)
+{
+address->priv = 
GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_ADDRESS_GET_PRIVATE(address);
+}
+
+
+GVirConfigDomainGraphicsListenAddress 
*gvir_config_domain_graphics_listen_address_new(void)
+{
+GVirConfigObject *object;
+
+object = 
gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_ADDRESS, 
"listen", NULL);
+gvir_config_object_set_attribute(object,
+ "type", "address",
+ NULL);
+
+return GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_ADDRESS(object);
+}
+
+
+GVirConfigDomainGraphicsListenAddress 
*gvir_config_domain_graphics_listen_address_new_from_xml(const gchar *xml,
+   
GError **error)
+{
+GVirConfigObject *object;
+
+object = 
gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_ADDRESS,
+

[libvirt] [libvirt-glib 12/20] gconfig: Add GVirConfigDomainGraphicsRemote class

2016-10-04 Thread Christophe Fergeau
From: Fabiano Fidêncio 

Seems that GVirConfigDomainGraphics* were built with a strong focus on
writing/setting configs, but not reading those.

For instance, considering virt-viewer's case, where the app is just
consuming an already built xml, for getting the port attribute of a
GVirDomainConfigGraphis{Spice,Vnc} you have to know, beforehand, the
type of the connection and then call
gvir_config_domain_graphics_{sdl,spice}_get_port(). It means creating an
abstraction on virt-viewer side, that will ended up in some code like:
if (GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics))
_get_whatever_you_want_using_specific_spice_api()
else
_get_whatever_you want_using_specific_vnc_api()

In order to avoid this, let's introduce GVirConfigDomainGraphicsRemote
class that, at least for now, is intended to be a helper for the case
explained above. It introduces a new hierarchy in the project, where,
instead of having GVirConfigDomainGraphics{Spice,Vnc,Rdp} inheriting
from GVirConfigDomainGraphics, these classes will inherit from
GVirConfigDomainGraphicsRemote (see the next patches) which inherits
from from GVirConfigGraphics (it will cause an ABI breakage, though).

Signed-off-by: Fabiano Fidêncio 
---
 libvirt-gconfig/Makefile.am|  2 +
 .../libvirt-gconfig-domain-graphics-remote.c   | 95 ++
 .../libvirt-gconfig-domain-graphics-remote.h   | 69 
 libvirt-gconfig/libvirt-gconfig.h  |  1 +
 libvirt-gconfig/libvirt-gconfig.sym|  2 +
 po/POTFILES.in |  1 +
 6 files changed, 170 insertions(+)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-remote.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-remote.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index ba08a11..64812bb 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -51,6 +51,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-graphics-listen-none.h \
libvirt-gconfig-domain-graphics-listen-unix.h \
libvirt-gconfig-domain-graphics-rdp.h \
+   libvirt-gconfig-domain-graphics-remote.h \
libvirt-gconfig-domain-graphics-sdl.h \
libvirt-gconfig-domain-graphics-spice.h \
libvirt-gconfig-domain-graphics-vnc.h \
@@ -148,6 +149,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-graphics-listen-none.c \
libvirt-gconfig-domain-graphics-listen-unix.c \
libvirt-gconfig-domain-graphics-rdp.c \
+   libvirt-gconfig-domain-graphics-remote.c \
libvirt-gconfig-domain-graphics-sdl.c \
libvirt-gconfig-domain-graphics-spice.c \
libvirt-gconfig-domain-graphics-vnc.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-remote.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-remote.c
new file mode 100644
index 000..46b97f2
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-remote.c
@@ -0,0 +1,95 @@
+/*
+ * libvirt-gconfig-domain-graphics-remote.c: libvirt domain graphics remote 
configuration
+ *
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ *
+ * Author: Fabiano Fidêncio 
+ */
+
+#include 
+
+#include 
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_GRAPHICS_REMOTE_GET_PRIVATE(obj)
 \
+(G_TYPE_INSTANCE_GET_PRIVATE((obj), 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_REMOTE, GVirConfigDomainGraphicsRemotePrivate))
+
+struct _GVirConfigDomainGraphicsRemotePrivate
+{
+gboolean unused;
+};
+
+typedef GVirConfigObject *(*GVirConfigDomainGraphicsRemoteNewFromXml)(const 
gchar *xml, GError **error);
+
+G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainGraphicsRemote, 
gvir_config_domain_graphics_remote, GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS);
+
+static void 
gvir_config_domain_graphics_remote_class_init(GVirConfigDomainGraphicsRemoteClass
 *klass)
+{
+

[libvirt] [libvirt-glib 01/20] libvirt-gconfig: Include GIO dependency

2016-10-04 Thread Christophe Fergeau
From: Visarion Alexandru 

We will need a GInetAddress for setting a graphics device's
listen address, so let's include GIO2 in libvirt-gconfig.
---
 libvirt-gconfig-1.0.pc.in   | 2 +-
 libvirt-gconfig/Makefile.am | 6 --
 vapi/Makefile.am| 1 +
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/libvirt-gconfig-1.0.pc.in b/libvirt-gconfig-1.0.pc.in
index a8cb5ac..c0212f8 100644
--- a/libvirt-gconfig-1.0.pc.in
+++ b/libvirt-gconfig-1.0.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: libvirt-gconfig
 Version: @VERSION@
 Description: libvirt GConfig library
-Requires: gobject-2.0 libxml-2.0
+Requires: gobject-2.0 libxml-2.0 gio-2.0
 Libs: -L${libdir} -lvirt-gconfig-1.0
 Cflags: -I${includedir}/libvirt-gconfig-1.0
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 0400343..1a9a97a 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -209,10 +209,12 @@ libvirt_gconfig_1_0_la_CFLAGS = \
-I$(top_builddir) \
$(GOBJECT2_CFLAGS) \
$(LIBXML2_CFLAGS) \
+   $(GIO2_CFLAGS)  \
$(WARN_CFLAGS)
 libvirt_gconfig_1_0_la_LIBADD = \
$(GOBJECT2_LIBS) \
$(LIBXML2_LIBS) \
+   $(GIO2_LIBS)\
$(CYGWIN_EXTRA_LIBADD)
 libvirt_gconfig_1_0_la_DEPENDENCIES = \
libvirt-gconfig.sym
@@ -253,8 +255,8 @@ INTROSPECTION_GIRS =
 
 if HAVE_INTROSPECTION
 LibvirtGConfig-1.0.gir: libvirt-gconfig-1.0.la
-LibvirtGConfig_1_0_gir_INCLUDES = GObject-2.0
-LibvirtGConfig_1_0_gir_PACKAGES = gobject-2.0
+LibvirtGConfig_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0
+LibvirtGConfig_1_0_gir_PACKAGES = gobject-2.0 gio-2.0
 LibvirtGConfig_1_0_gir_EXPORT_PACKAGES = libvirt-gconfig-1.0
 LibvirtGConfig_1_0_gir_LIBS = libvirt-gconfig-1.0.la
 LibvirtGConfig_1_0_gir_FILES = \
diff --git a/vapi/Makefile.am b/vapi/Makefile.am
index 568de4f..dc98bd1 100644
--- a/vapi/Makefile.am
+++ b/vapi/Makefile.am
@@ -33,6 +33,7 @@ libvirt-gconfig-1.0.vapi: 
$(top_builddir)/libvirt-gconfig/LibvirtGConfig-1.0.gir
$(AM_V_GEN)$(VAPIGEN)   \
--vapidir=$(builddir)   \
--pkg gobject-2.0   \
+   --pkg gio-2.0   \
--library libvirt-gconfig-1.0   \
$<
 
-- 
2.7.4

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


[libvirt] [libvirt-glib 18/20] gconfig: Adapt GVirConfigDomainGraphicsDesktop to GVirConfigDomainGraphicsLocal

2016-10-04 Thread Christophe Fergeau
From: Fabiano Fidêncio 

This patch adapts GVirConfigDomainGraphicsDesktop to the new
GVirConfigDomainGraphicsLocal, inheriting from it and using its helper
functions for getting display and fullscreen properties.

As GVirConfigDomainGraphicsDesktop now inherits from
GVirConfigDomainGraphicsLocal, this patch also introduces an ABI
breakage.

Signed-off-by: Fabiano Fidêncio 
---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c | 11 +++
 libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.h |  4 ++--
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c
index dadf684..7d23b77 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c
@@ -33,7 +33,7 @@ struct _GVirConfigDomainGraphicsDesktopPrivate
 gboolean unused;
 };
 
-G_DEFINE_TYPE(GVirConfigDomainGraphicsDesktop, 
gvir_config_domain_graphics_desktop, GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS);
+G_DEFINE_TYPE(GVirConfigDomainGraphicsDesktop, 
gvir_config_domain_graphics_desktop, GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LOCAL);
 
 
 static void 
gvir_config_domain_graphics_desktop_class_init(GVirConfigDomainGraphicsDesktopClass
 *klass)
@@ -88,9 +88,7 @@ const gchar 
*gvir_config_domain_graphics_desktop_get_display(GVirConfigDomainGra
 {
 g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_DESKTOP(graphics), 
NULL);
 
-return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(graphics),
-NULL,
-"display");
+return 
gvir_config_domain_graphics_local_get_display(GVIR_CONFIG_DOMAIN_GRAPHICS_LOCAL(graphics));
 }
 
 
@@ -111,8 +109,5 @@ gboolean 
gvir_config_domain_graphics_desktop_get_fullscreen(GVirConfigDomainGrap
 {
 g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_DESKTOP(graphics), 
FALSE);
 
-return 
gvir_config_object_get_attribute_boolean(GVIR_CONFIG_OBJECT(graphics),
-NULL,
-"fullscreen",
-FALSE);
+return 
gvir_config_domain_graphics_local_get_fullscreen(GVIR_CONFIG_DOMAIN_GRAPHICS_LOCAL(graphics));
 }
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.h 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.h
index 7e7e635..c117882 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.h
@@ -42,7 +42,7 @@ typedef struct _GVirConfigDomainGraphicsDesktopClass 
GVirConfigDomainGraphicsDes
 
 struct _GVirConfigDomainGraphicsDesktop
 {
-GVirConfigDomainGraphics parent;
+GVirConfigDomainGraphicsLocal parent;
 
 GVirConfigDomainGraphicsDesktopPrivate *priv;
 
@@ -51,7 +51,7 @@ struct _GVirConfigDomainGraphicsDesktop
 
 struct _GVirConfigDomainGraphicsDesktopClass
 {
-GVirConfigDomainGraphicsClass parent_class;
+GVirConfigDomainGraphicsLocalClass parent_class;
 
 gpointer padding[20];
 };
-- 
2.7.4

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

[libvirt] [libvirt-glib 05/20] config: Add spice listen getter/setter

2016-10-04 Thread Christophe Fergeau
From: Visarion Alexandru 

Learn to get/set the listen devices that spice graphics is using.

When setting the listen devices, first remove the 'listen'
attribute to avoid the inconsistencies checks between the 'listen'
attribute and the 'address' attribute of the 'listen' node.
---
 .../libvirt-gconfig-domain-graphics-spice.c| 87 +-
 .../libvirt-gconfig-domain-graphics-spice.h|  4 +
 libvirt-gconfig/libvirt-gconfig.sym|  2 +
 3 files changed, 92 insertions(+), 1 deletion(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
index 079ea27..7e0bd9f 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
@@ -1,7 +1,8 @@
 /*
  * libvirt-gconfig-domain-graphics-spice.c: libvirt domain SPICE configuration
  *
- * Copyright (C) 2011 Red Hat, Inc.
+ * Copyright (C) 2011-2016 Red Hat, Inc.
+ * Copyright (C) 2016 Visarion Alexandru 
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -157,6 +158,90 @@ void 
gvir_config_domain_graphics_spice_set_image_compression
 compression);
 }
 
+/**
+ * gvir_config_domain_graphics_spice_set_listen:
+ * @graphics: a #GVirConfigDomainGraphicsSpice
+ * @listens: (in) (element-type LibvirtGConfig.DomainGraphicsListen): listens
+ *
+ * This method is used to set the various listen nodes a 
#GVirConfigDomainGraphicsSpice
+ * device can handle.
+*/
+void 
gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice 
*graphics,
+  GList *listens)
+{
+GList *it;
+
+g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics));
+
+gvir_config_object_remove_attribute (GVIR_CONFIG_OBJECT(graphics),
+ "listen");
+gvir_config_object_delete_children (GVIR_CONFIG_OBJECT (graphics),
+"listen", NULL);
+
+for (it = listens; it != NULL; it = it->next) {
+g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN(it->data));
+
+gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(graphics),
+  GVIR_CONFIG_OBJECT(it->data));
+}
+}
+
+struct ListenData {
+GVirConfigXmlDoc *doc;
+const gchar *schema;
+GList *listen_devices;
+};
+
+static gboolean add_listen(xmlNodePtr node, gpointer opaque)
+{
+struct ListenData* data = (struct ListenData*)opaque;
+GVirConfigObject *object;
+
+if (g_strcmp0((const gchar *)node->name, "listen") != 0)
+return TRUE;
+
+object = gvir_config_object_new_from_tree
+
(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_ADDRESS,
+ data->doc,
+ data->schema,
+ node);
+if (object != NULL)
+data->listen_devices = g_list_append(data->listen_devices, object);
+else
+g_debug("Failed to parse %s node", node->name);
+
+return TRUE;
+}
+
+/**
+ * gvir_config_domain_graphics_spice_get_listen:
+ *
+ * Gets all the listen not of #GVirConfigDomainGraphicsSpice
+ *
+ * Returns: (element-type LibvirtGConfig.DomainGraphicsListen) (transfer full):
+ * a newly allocated #GList of #GVirConfigDomainGraphicsListen.
+ */
+GList *
+gvir_config_domain_graphics_spice_get_listen(GVirConfigDomainGraphicsSpice 
*graphics)
+{
+struct ListenData data;
+
+g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics), NULL);
+
+g_object_get(G_OBJECT(graphics), "doc", , NULL);
+g_return_val_if_fail(data.doc != NULL, NULL);
+data.schema = gvir_config_object_get_schema(GVIR_CONFIG_OBJECT(graphics));
+data.listen_devices = NULL;
+
+gvir_config_object_foreach_child(GVIR_CONFIG_OBJECT(graphics),
+ NULL,
+ add_listen,
+ );
+g_clear_object();
+
+return data.listen_devices;
+}
+
 void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice 
*graphics,
   gboolean gl)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
index 25c132e..1632cc9 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
@@ -95,6 +95,10 @@ gvir_config_domain_graphics_spice_get_image_compression
 void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice 
*graphics,
   gboolean gl);
 
+void 
gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice 
*graphics,
+

[libvirt] [libvirt-glib 06/20] tests: Add test for GVirConfigDomainGraphicsListenAddress

2016-10-04 Thread Christophe Fergeau
From: Visarion Alexandru 

---
 tests/test-gconfig.c   | 39 ++
 .../xml/gconfig-domain-device-graphics-listen.xml  |  7 
 2 files changed, 46 insertions(+)
 create mode 100644 tests/xml/gconfig-domain-device-graphics-listen.xml

diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
index a26bb5f..97275a1 100644
--- a/tests/test-gconfig.c
+++ b/tests/test-gconfig.c
@@ -481,6 +481,43 @@ static void test_domain_device_graphics(void)
 g_object_unref(G_OBJECT(domain));
 }
 
+static void test_domain_device_graphics_listen(void)
+{
+GVirConfigDomain *domain;
+GVirConfigDomainGraphicsSpice *graphics = NULL;
+
+domain = gvir_config_domain_new();
+GList *listen_list = NULL;
+
+graphics = gvir_config_domain_graphics_spice_new();
+
+/* listen address node */
+GVirConfigDomainGraphicsListenAddress *address_listen = 
gvir_config_domain_graphics_listen_address_new();
+GInetAddress *inet_address = g_inet_address_new_from_string("0.0.0.0");
+
+
gvir_config_domain_graphics_listen_address_set_inet_address(address_listen, 
inet_address);
+GInetAddress *ret_inet_address = 
gvir_config_domain_graphics_listen_address_get_inet_address(address_listen);
+g_assert(g_inet_address_equal(inet_address, ret_inet_address));
+g_object_unref(inet_address);
+g_object_unref(ret_inet_address);
+
+gvir_config_domain_graphics_listen_address_set_address(address_listen, 
"127.0.0.1");
+const gchar *ret_address = 
gvir_config_domain_graphics_listen_address_get_address(address_listen);
+g_assert_cmpstr("127.0.0.1", ==, ret_address);
+
+/* test listen setter */
+listen_list = g_list_append(listen_list, address_listen);
+gvir_config_domain_graphics_spice_set_listen(graphics, listen_list);
+g_object_unref(G_OBJECT(address_listen));
+g_list_free(listen_list);
+
+gvir_config_domain_add_device(domain, GVIR_CONFIG_DOMAIN_DEVICE(graphics));
+g_object_unref(G_OBJECT(graphics));
+
+check_xml(domain, "gconfig-domain-device-graphics-listen.xml");
+
+g_object_unref(G_OBJECT(domain));
+}
 
 static void test_domain_device_video(void)
 {
@@ -782,6 +819,8 @@ int main(int argc, char **argv)
 test_domain_device_usb_redir);
 g_test_add_func("/libvirt-gconfig/domain-device-pci-hostdev",
 test_domain_device_pci_hostdev);
+g_test_add_func("/libvirt-gconfig/domain-device-graphics-listen",
+test_domain_device_graphics_listen);
 
 return g_test_run();
 }
diff --git a/tests/xml/gconfig-domain-device-graphics-listen.xml 
b/tests/xml/gconfig-domain-device-graphics-listen.xml
new file mode 100644
index 000..27200c4
--- /dev/null
+++ b/tests/xml/gconfig-domain-device-graphics-listen.xml
@@ -0,0 +1,7 @@
+
+  
+
+  
+
+  
+
-- 
2.7.4

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


[libvirt] [libvirt-glib 07/20] gconfig: Introduce GVirConfigDomainGraphicsListenNone

2016-10-04 Thread Christophe Fergeau
---
 libvirt-gconfig/Makefile.am|  2 +
 .../libvirt-gconfig-domain-graphics-listen-none.c  | 78 ++
 .../libvirt-gconfig-domain-graphics-listen-none.h  | 70 +++
 libvirt-gconfig/libvirt-gconfig.h  |  1 +
 libvirt-gconfig/libvirt-gconfig.sym|  3 +
 5 files changed, 154 insertions(+)
 create mode 100644 
libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-none.c
 create mode 100644 
libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-none.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 045f570..bdeac32 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -48,6 +48,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-graphics-desktop.h \
libvirt-gconfig-domain-graphics-listen.h \
libvirt-gconfig-domain-graphics-listen-address.h \
+   libvirt-gconfig-domain-graphics-listen-none.h \
libvirt-gconfig-domain-graphics-rdp.h \
libvirt-gconfig-domain-graphics-sdl.h \
libvirt-gconfig-domain-graphics-spice.h \
@@ -143,6 +144,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-graphics-desktop.c \
libvirt-gconfig-domain-graphics-listen.c \
libvirt-gconfig-domain-graphics-listen-address.c \
+   libvirt-gconfig-domain-graphics-listen-none.c \
libvirt-gconfig-domain-graphics-rdp.c \
libvirt-gconfig-domain-graphics-sdl.c \
libvirt-gconfig-domain-graphics-spice.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-none.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-none.c
new file mode 100644
index 000..a9d8a7a
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-none.c
@@ -0,0 +1,78 @@
+/*
+ * libvirt-gconfig-domain-graphics-listen-none.c: libvirt domain graphics 
listen none configuration
+ *
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Christophe Fergeau <cferg...@redhat.com>
+ */
+
+#include 
+
+#include 
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_NONE_GET_PRIVATE(obj)   
  \
+(G_TYPE_INSTANCE_GET_PRIVATE((obj), 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_NONE, 
GVirConfigDomainGraphicsListenNonePrivate))
+
+struct _GVirConfigDomainGraphicsListenNonePrivate
+{
+gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainGraphicsListenNone, 
gvir_config_domain_graphics_listen_none, 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN);
+
+
+static void 
gvir_config_domain_graphics_listen_none_class_init(GVirConfigDomainGraphicsListenNoneClass
 *klass)
+{
+g_type_class_add_private(klass, 
sizeof(GVirConfigDomainGraphicsListenNonePrivate));
+}
+
+
+static void 
gvir_config_domain_graphics_listen_none_init(GVirConfigDomainGraphicsListenNone 
*listen)
+{
+listen->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_NONE_GET_PRIVATE(listen);
+}
+
+
+GVirConfigDomainGraphicsListenNone 
*gvir_config_domain_graphics_listen_none_new(void)
+{
+GVirConfigObject *object;
+
+object = 
gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_NONE, "listen", 
NULL);
+gvir_config_object_set_attribute(object,
+ "type", "none",
+ NULL);
+
+return GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_NONE(object);
+}
+
+
+GVirConfigDomainGraphicsListenNone 
*gvir_config_domain_graphics_listen_none_new_from_xml(const gchar *xml,
+   
  GError **error)
+{
+GVirConfigObject *object;
+
+object = 
gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_NONE,
+ "listen", NULL, xml, error);
+if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), 
"none") != 0) {
+ 

[libvirt] [libvirt-glib 04/20] config: Add vnc listen getter/setter

2016-10-04 Thread Christophe Fergeau
From: Visarion Alexandru 

Learn to get/set the listen devices that vnc is using.

When setting the listen devices, first remove the 'listen' attribute
to avoid inconsistencies checks between the 'listen' attribute and the
'address' attribute of the 'listen' node.
---
 .../libvirt-gconfig-domain-graphics-vnc.c  | 87 +-
 .../libvirt-gconfig-domain-graphics-vnc.h  |  4 +
 libvirt-gconfig/libvirt-gconfig.sym|  2 +
 3 files changed, 92 insertions(+), 1 deletion(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
index fc26bb9..bc229bd 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
@@ -1,7 +1,8 @@
 /*
  * libvirt-gconfig-domain-graphics-vnc.c: libvirt domain VNC configuration
  *
- * Copyright (C) 2011 Red Hat, Inc.
+ * Copyright (C) 2011-16 Red Hat, Inc.
+ * Copyright (C) 2016 Visarion Alexandru 
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -120,6 +121,90 @@ void 
gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graph
NULL);
 }
 
+/**
+ * gvir_config_domain_graphics_vnc_set_listen:
+ * @graphics: a #GVirConfigDomainGraphicsVnc
+ * @listens: (in) (element-type LibvirtGConfig.DomainGraphicsListen):
+ *
+ * This method is used to set the various listen nodes a 
#GVirConfigDomainGraphicsVnc
+ * device can handle.
+*/
+void gvir_config_domain_graphics_vnc_set_listen(GVirConfigDomainGraphicsVnc 
*graphics,
+  GList *listens)
+{
+GList *it;
+
+g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_VNC(graphics));
+
+gvir_config_object_remove_attribute (GVIR_CONFIG_OBJECT(graphics),
+"listen");
+gvir_config_object_delete_children (GVIR_CONFIG_OBJECT (graphics),
+"listen", NULL);
+
+for (it = listens; it != NULL; it = it->next) {
+g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN(it->data));
+
+gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(graphics),
+  GVIR_CONFIG_OBJECT(it->data));
+}
+}
+
+struct ListenData {
+GVirConfigXmlDoc *doc;
+const gchar *schema;
+GList *listen_devices;
+};
+
+static gboolean add_listen(xmlNodePtr node, gpointer opaque)
+{
+struct ListenData* data = (struct ListenData*)opaque;
+GVirConfigObject *object;
+
+if (g_strcmp0((const gchar *)node->name, "listen") != 0)
+return TRUE;
+
+object = gvir_config_object_new_from_tree
+
(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_ADDRESS,
+ data->doc,
+ data->schema,
+ node);
+if (object != NULL)
+data->listen_devices = g_list_append(data->listen_devices, object);
+else
+g_debug("Failed to parse %s node", node->name);
+
+return TRUE;
+}
+
+/**
+ * gvir_config_domain_graphics_vnc_get_listen:
+ *
+ * Gets all the listen not of #GVirConfigDomainGraphicsVnc
+ *
+ * Returns: (element-type LibvirtGConfig.DomainGraphicsListen) (transfer full):
+ * a newly allocated #GList of #GVirConfigDomainGraphicsListen.
+ */
+GList *
+gvir_config_domain_graphics_vnc_get_listen(GVirConfigDomainGraphicsVnc 
*graphics)
+{
+struct ListenData data;
+
+g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_VNC(graphics), NULL);
+
+g_object_get(G_OBJECT(graphics), "doc", , NULL);
+g_return_val_if_fail(data.doc != NULL, NULL);
+data.schema = gvir_config_object_get_schema(GVIR_CONFIG_OBJECT(graphics));
+data.listen_devices = NULL;
+
+gvir_config_object_foreach_child(GVIR_CONFIG_OBJECT(graphics),
+ NULL,
+ add_listen,
+ );
+g_clear_object();
+
+return data.listen_devices;
+}
+
 void gvir_config_domain_graphics_vnc_set_password(GVirConfigDomainGraphicsVnc 
*graphics,
   const char *password)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
index fe78621..df21bd6 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
@@ -73,6 +73,10 @@ int 
gvir_config_domain_graphics_vnc_get_port(GVirConfigDomainGraphicsVnc *graphi
 void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc 
*graphics,
   int port);
 
+void gvir_config_domain_graphics_vnc_set_listen(GVirConfigDomainGraphicsVnc 
*graphics,
+  

[libvirt] [libvirt-glib 13/20] gconfig: Adapt GVirConfigDomainGraphicsSpice to GVirConfigDomainGraphicsRemote

2016-10-04 Thread Christophe Fergeau
From: Fabiano Fidêncio 

This patch adapts GVirConfigDomainGraphicsSpice to the new
GVirConfigDomainGraphicsRemote, inheriting from it and using its helper
functions for getting autoport and port properties.

As GVirConfigDomainGraphicsSpice now inherits from
GVirConfigDomainGraphicsRemote, this patch also introduces an ABI
breakage.

Signed-off-by: Fabiano Fidêncio 
---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
index d66b362..4538820 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
@@ -35,7 +35,7 @@ struct _GVirConfigDomainGraphicsSpicePrivate
 gboolean unused;
 };
 
-G_DEFINE_TYPE(GVirConfigDomainGraphicsSpice, 
gvir_config_domain_graphics_spice, GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS);
+G_DEFINE_TYPE(GVirConfigDomainGraphicsSpice, 
gvir_config_domain_graphics_spice, GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_REMOTE);
 
 
 static void 
gvir_config_domain_graphics_spice_class_init(GVirConfigDomainGraphicsSpiceClass 
*klass)
@@ -99,8 +99,7 @@ int 
gvir_config_domain_graphics_spice_get_port(GVirConfigDomainGraphicsSpice *gr
 {
 g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics), 0);
 
-return 
gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(graphics),
-   NULL, "port", 0);
+return 
gvir_config_domain_graphics_remote_get_port(GVIR_CONFIG_DOMAIN_GRAPHICS_REMOTE(graphics));
 }
 
 void gvir_config_domain_graphics_spice_set_port(GVirConfigDomainGraphicsSpice 
*graphics,
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
index 54da02a..b33c693 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
@@ -43,7 +43,7 @@ typedef struct _GVirConfigDomainGraphicsSpiceClass 
GVirConfigDomainGraphicsSpice
 
 struct _GVirConfigDomainGraphicsSpice
 {
-GVirConfigDomainGraphics parent;
+GVirConfigDomainGraphicsRemote parent;
 
 GVirConfigDomainGraphicsSpicePrivate *priv;
 
@@ -52,7 +52,7 @@ struct _GVirConfigDomainGraphicsSpice
 
 struct _GVirConfigDomainGraphicsSpiceClass
 {
-GVirConfigDomainGraphicsClass parent_class;
+GVirConfigDomainGraphicsRemoteClass parent_class;
 
 gpointer padding[20];
 };
-- 
2.7.4

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

[libvirt] [libvirt-glib 00/20] gconfig: configuration work

2016-10-04 Thread Christophe Fergeau
Hey,

This series groups 2 series which were sent previously for review,
one from Visarion 
https://www.redhat.com/archives/libvir-list/2016-August/msg00868.html
and one from Fidencio 
https://www.redhat.com/archives/libvir-list/2016-March/msg00993.html

I'm putting them together as they touch the same piece of code and thus
conflict with each other. The separation would happen at 11/20 "gconfig:
Implement gvir_config_domain_graphics_spice_get_tls_port()" if I were to send
these separately.

Visarion's changes add support for configuring the  node for the
graphics node, and Fidencio's changes add some base classes to make generic
configuration of local/remote graphics nodes easier, regardless of their
type (VNC/SPICE for example).

This incorporate the various changes I suggested during review, in particular
it renames _set_listen_nodes() in the original series to just _set_listen(),
better naming suggestions welcome.

I've also added a few patches of my own which made sense to have for
completeness.

Christophe

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


[libvirt] [libvirt-glib 02/20] gconfig: Introduce GVirConfigDomainGraphicsListen

2016-10-04 Thread Christophe Fergeau
From: Visarion Alexandru 

Abstract class which represents a listen child node
of the graphics device.
---
 libvirt-gconfig/Makefile.am|  2 +
 .../libvirt-gconfig-domain-graphics-listen.c   | 49 
 .../libvirt-gconfig-domain-graphics-listen.h   | 65 ++
 libvirt-gconfig/libvirt-gconfig.h  |  1 +
 libvirt-gconfig/libvirt-gconfig.sym|  1 +
 5 files changed, 118 insertions(+)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 1a9a97a..ec26ae7 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -46,6 +46,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-filesys.h \
libvirt-gconfig-domain-graphics.h \
libvirt-gconfig-domain-graphics-desktop.h \
+   libvirt-gconfig-domain-graphics-listen.h \
libvirt-gconfig-domain-graphics-rdp.h \
libvirt-gconfig-domain-graphics-sdl.h \
libvirt-gconfig-domain-graphics-spice.h \
@@ -139,6 +140,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-filesys.c \
libvirt-gconfig-domain-graphics.c \
libvirt-gconfig-domain-graphics-desktop.c \
+   libvirt-gconfig-domain-graphics-listen.c \
libvirt-gconfig-domain-graphics-rdp.c \
libvirt-gconfig-domain-graphics-sdl.c \
libvirt-gconfig-domain-graphics-spice.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c
new file mode 100644
index 000..095abe7
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c
@@ -0,0 +1,49 @@
+/*
+ * libvirt-gconfig-domain-graphics-listen.c: libvirt domain graphics listen 
base class
+ *
+ * Copyright (C) 2016 Red Hat, Inc.
+ * Copyright (C) 2016 Visarion Alexandru 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ *
+ * Author: Visarion Alexandru 
+ */
+
+#include 
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_GET_PRIVATE(obj)
 \
+(G_TYPE_INSTANCE_GET_PRIVATE((obj), 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN, GVirConfigDomainGraphicsListenPrivate))
+
+struct _GVirConfigDomainGraphicsListenPrivate
+{
+gboolean unused;
+};
+
+G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainGraphicsListen, 
gvir_config_domain_graphics_listen, GVIR_CONFIG_TYPE_OBJECT);
+
+
+static void 
gvir_config_domain_graphics_listen_class_init(GVirConfigDomainGraphicsListenClass
 *klass)
+{
+g_type_class_add_private(klass, 
sizeof(GVirConfigDomainGraphicsListenPrivate));
+}
+
+
+static void 
gvir_config_domain_graphics_listen_init(GVirConfigDomainGraphicsListen *listen)
+{
+listen->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_GET_PRIVATE(listen);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h
new file mode 100644
index 000..6f93d27
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h
@@ -0,0 +1,65 @@
+/*
+ * libvirt-gconfig-domain-graphics-listen.h: libvirt domain graphics listen 
base class
+ *
+ * Copyright (C) 2016 Red Hat, Inc.
+ * Copyright (C) 2016 Visarion Alexandru 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the 

[libvirt] [libvirt-glib 09/20] gconfig: Add gvir_config_domain_graphics_{spice, vnc}_add_listen

2016-10-04 Thread Christophe Fergeau
---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 17 +
 libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h |  2 ++
 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c   | 17 +
 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h   |  2 ++
 libvirt-gconfig/libvirt-gconfig.sym |  2 ++
 tests/test-gconfig.c| 10 ++
 tests/xml/gconfig-domain-device-graphics-listen.xml |  2 ++
 7 files changed, 52 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
index 7e0bd9f..88dd757 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
@@ -186,6 +186,23 @@ void 
gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice
 }
 }
 
+/**
+ * gvir_config_domain_graphics_spice_add_listen:
+ * @graphics: a #GVirConfigDomainGraphicsSpice
+ * @listens: a #GVirConfigDomainGraphicsListen
+ *
+ * This method is used to add a listen node to a #GVirConfigDomainGraphicsSpice
+ * device can handle.
+*/
+void 
gvir_config_domain_graphics_spice_add_listen(GVirConfigDomainGraphicsSpice 
*graphics,
+  
GVirConfigDomainGraphicsListen *listen)
+{
+g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics));
+
+gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(graphics),
+  GVIR_CONFIG_OBJECT(listen));
+}
+
 struct ListenData {
 GVirConfigXmlDoc *doc;
 const gchar *schema;
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
index 1632cc9..468ead6 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
@@ -97,6 +97,8 @@ void 
gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice *gra
 
 void 
gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice 
*graphics,
   GList *listens);
+void 
gvir_config_domain_graphics_spice_add_listen(GVirConfigDomainGraphicsSpice 
*graphics,
+  
GVirConfigDomainGraphicsListen *listen);
 GList 
*gvir_config_domain_graphics_spice_get_listen(GVirConfigDomainGraphicsSpice 
*graphics);
 
 G_END_DECLS
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
index bc229bd..17fce67 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
@@ -149,6 +149,23 @@ void 
gvir_config_domain_graphics_vnc_set_listen(GVirConfigDomainGraphicsVnc *gra
 }
 }
 
+/**
+ * gvir_config_domain_graphics_vnc_add_listen:
+ * @graphics: a #GVirConfigDomainGraphicsVnc
+ * @listens: a #GVirConfigDomainGraphicsListen
+ *
+ * This method is used to add a listen node to a #GVirConfigDomainGraphicsVnc
+ * device can handle.
+*/
+void gvir_config_domain_graphics_vnc_add_listen(GVirConfigDomainGraphicsVnc 
*graphics,
+GVirConfigDomainGraphicsListen 
*listen)
+{
+g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_VNC(graphics));
+
+gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(graphics),
+  GVIR_CONFIG_OBJECT(listen));
+}
+
 struct ListenData {
 GVirConfigXmlDoc *doc;
 const gchar *schema;
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
index df21bd6..e4d4fc3 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
@@ -75,6 +75,8 @@ void 
gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graph
 
 void gvir_config_domain_graphics_vnc_set_listen(GVirConfigDomainGraphicsVnc 
*graphics,
 GList *listens);
+void gvir_config_domain_graphics_vnc_add_listen(GVirConfigDomainGraphicsVnc 
*graphics,
+GVirConfigDomainGraphicsListen 
*listen);
 GList *gvir_config_domain_graphics_vnc_get_listen(GVirConfigDomainGraphicsVnc 
*graphics);
 
 void gvir_config_domain_graphics_vnc_set_password(GVirConfigDomainGraphicsVnc 
*graphics,
diff --git a/libvirt-gconfig/libvirt-gconfig.sym 
b/libvirt-gconfig/libvirt-gconfig.sym
index c07de56..aef53cd 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -757,9 +757,11 @@ global:
gvir_config_domain_graphics_listen_unix_new;
gvir_config_domain_graphics_listen_unix_new_from_xml;
gvir_config_domain_graphics_listen_unix_set_path;
+   gvir_config_domain_graphics_spice_add_listen;

[libvirt] [libvirt-glib 10/20] gconfig: Remove 'socket' attribute from gvir_config_domain_graphics_{spice, vnc}_set_listen

2016-10-04 Thread Christophe Fergeau
This is a legacy attribute which is going to conflict with listen nodes
when we set some.
---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 2 ++
 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c   | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
index 88dd757..051ff87 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
@@ -175,6 +175,8 @@ void 
gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice
 
 gvir_config_object_remove_attribute (GVIR_CONFIG_OBJECT(graphics),
  "listen");
+gvir_config_object_remove_attribute (GVIR_CONFIG_OBJECT(graphics),
+ "socket");
 gvir_config_object_delete_children (GVIR_CONFIG_OBJECT (graphics),
 "listen", NULL);
 
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
index 17fce67..3bc5b8c 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
@@ -138,6 +138,8 @@ void 
gvir_config_domain_graphics_vnc_set_listen(GVirConfigDomainGraphicsVnc *gra
 
 gvir_config_object_remove_attribute (GVIR_CONFIG_OBJECT(graphics),
 "listen");
+gvir_config_object_remove_attribute (GVIR_CONFIG_OBJECT(graphics),
+ "socket");
 gvir_config_object_delete_children (GVIR_CONFIG_OBJECT (graphics),
 "listen", NULL);
 
-- 
2.7.4

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


[libvirt] [libvirt-glib 08/20] gconfig: Introduce GVirConfigDomainGraphicsListenUnix

2016-10-04 Thread Christophe Fergeau
---
 libvirt-gconfig/Makefile.am|  2 +
 .../libvirt-gconfig-domain-graphics-listen-unix.c  | 98 ++
 .../libvirt-gconfig-domain-graphics-listen-unix.h  | 72 
 libvirt-gconfig/libvirt-gconfig.h  |  1 +
 libvirt-gconfig/libvirt-gconfig.sym|  5 ++
 5 files changed, 178 insertions(+)
 create mode 100644 
libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.c
 create mode 100644 
libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index bdeac32..ba08a11 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -49,6 +49,7 @@ GCONFIG_HEADER_FILES = \
libvirt-gconfig-domain-graphics-listen.h \
libvirt-gconfig-domain-graphics-listen-address.h \
libvirt-gconfig-domain-graphics-listen-none.h \
+   libvirt-gconfig-domain-graphics-listen-unix.h \
libvirt-gconfig-domain-graphics-rdp.h \
libvirt-gconfig-domain-graphics-sdl.h \
libvirt-gconfig-domain-graphics-spice.h \
@@ -145,6 +146,7 @@ GCONFIG_SOURCE_FILES = \
libvirt-gconfig-domain-graphics-listen.c \
libvirt-gconfig-domain-graphics-listen-address.c \
libvirt-gconfig-domain-graphics-listen-none.c \
+   libvirt-gconfig-domain-graphics-listen-unix.c \
libvirt-gconfig-domain-graphics-rdp.c \
libvirt-gconfig-domain-graphics-sdl.c \
libvirt-gconfig-domain-graphics-spice.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.c 
b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.c
new file mode 100644
index 000..b16f52f
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-unix.c
@@ -0,0 +1,98 @@
+/*
+ * libvirt-gconfig-domain-graphics-listen-unix.c: libvirt domain graphics 
listen unix socket configuration
+ *
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Christophe Fergeau <cferg...@redhat.com>
+ */
+
+#include 
+
+#include 
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_UNIX_GET_PRIVATE(obj)   
  \
+(G_TYPE_INSTANCE_GET_PRIVATE((obj), 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_UNIX, 
GVirConfigDomainGraphicsListenUnixPrivate))
+
+struct _GVirConfigDomainGraphicsListenUnixPrivate
+{
+gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainGraphicsListenUnix, 
gvir_config_domain_graphics_listen_unix, 
GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN);
+
+
+static void 
gvir_config_domain_graphics_listen_unix_class_init(GVirConfigDomainGraphicsListenUnixClass
 *klass)
+{
+g_type_class_add_private(klass, 
sizeof(GVirConfigDomainGraphicsListenUnixPrivate));
+}
+
+
+static void 
gvir_config_domain_graphics_listen_unix_init(GVirConfigDomainGraphicsListenUnix 
*listen)
+{
+listen->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_UNIX_GET_PRIVATE(listen);
+}
+
+
+GVirConfigDomainGraphicsListenUnix 
*gvir_config_domain_graphics_listen_unix_new(void)
+{
+GVirConfigObject *object;
+
+object = 
gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_UNIX, "listen", 
NULL);
+gvir_config_object_set_attribute(object,
+ "type", "socket",
+ NULL);
+
+return GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_UNIX(object);
+}
+
+
+GVirConfigDomainGraphicsListenUnix 
*gvir_config_domain_graphics_listen_unix_new_from_xml(const gchar *xml,
+   
  GError **error)
+{
+GVirConfigObject *object;
+
+object = 
gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_UNIX,
+ "listen", NULL, xml, error);
+if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), 
"socket") != 0) {
+ 

Re: [libvirt] [gconfig v2 4/6] config: Add vnc listen getter/setter

2016-09-12 Thread Christophe Fergeau
Hey,

On Mon, Sep 12, 2016 at 01:10:28AM +0300, Visarion-Mingopol Alexandru-Viorel 
wrote:
> Hi! Sorry for the delay, I had some exams.
> 
> _set_listen_list () is the only other name that comes into my mind.
> 
> I also think _set_listens () is a bit odd, but  _set_listen_nodes ()
> doesn't sound that odd to me (maybe a bit too technical).

I don't think we really expose anything called 'node' in libvirt-gconfig
API. We don't say we are using it to add nodes to VM or things like
that. So this does not sound like a very good name to have in the API.
Lately, I'd favour _set_listen(s) unless someone has a strong
objection/a better name.

> 
> I think you should choose the name from those 3, because you have more
> experience, and I'll update and upload the remaining two patches right away.

I have already did the update/rebasing work in
https://gitlab.com/teuf/libvirt-glib/commits/graphics , so no updates
should be needed :) I've added on top of your series patches Fidencio
sent a while ago. Need to send that to the ML next ;)

Christophe


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

Re: [libvirt] [PATCH] virsh: Fix *-event error string

2016-09-06 Thread Christophe Fergeau
On Tue, Sep 06, 2016 at 03:07:37PM +0200, Erik Skultety wrote:
> ACK, although, I have a really small nitpick the decision on fixing of
> which I leave to you. After the fix, "--list or --event type...", at
> least to me, sounds like "--event" was the mentioned type itself which
> is of course wrong. Maybe it could be better (just an idea) to use angle
> brackets like this '' to make the message more clear, but as I
> said, your call.

I considered doing it, but did not for no particular reason. I'll change
it before pushing.

Thanks,

Christophe


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

[libvirt] [PATCH] virsh: Fix *-event error string

2016-09-06 Thread Christophe Fergeau
When using
virsh net-event non-existing-net
the error message says that 'either --list or event type is required'
This is misleading as 'virsh net-event $valid-event-type' is not going
to work either. What is expected is 'virsh net-event --event
$valid-event-type'

This commit fixes the string in pool-event, nodedev-event, event, and
net-event.
---
 tools/virsh-domain.c  | 2 +-
 tools/virsh-network.c | 2 +-
 tools/virsh-nodedev.c | 2 +-
 tools/virsh-pool.c| 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index a614512..702a8bd8 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -12694,7 +12694,7 @@ cmdEvent(vshControl *ctl, const vshCmd *cmd)
 }
 } else if (!all) {
 vshError(ctl, "%s",
- _("one of --list, --all, or event type is required"));
+ _("one of --list, --all, or --event type is required"));
 return false;
 }
 
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index eec7faf..c6bd132 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -1238,7 +1238,7 @@ cmdNetworkEvent(vshControl *ctl, const vshCmd *cmd)
 if (vshCommandOptStringReq(ctl, cmd, "event", ) < 0)
 return false;
 if (!eventName) {
-vshError(ctl, "%s", _("either --list or event type is required"));
+vshError(ctl, "%s", _("either --list or --event type is required"));
 return false;
 }
 if ((event = virshNetworkEventIdTypeFromString(eventName)) < 0) {
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 805c0ff..0e695b9 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -903,7 +903,7 @@ cmdNodeDeviceEvent(vshControl *ctl, const vshCmd *cmd)
 if (vshCommandOptStringReq(ctl, cmd, "event", ) < 0)
 return false;
 if (!eventName) {
-vshError(ctl, "%s", _("either --list or event type is required"));
+vshError(ctl, "%s", _("either --list or --event type is required"));
 return false;
 }
 
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index d25851e..70b2bdd 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -2057,7 +2057,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd)
 if (vshCommandOptStringReq(ctl, cmd, "event", ) < 0)
 return false;
 if (!eventName) {
-vshError(ctl, "%s", _("either --list or event type is required"));
+vshError(ctl, "%s", _("either --list or --event type is required"));
 return false;
 }
 
-- 
2.7.4

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


Re: [libvirt] [libvirt-glib/libvirt-gconfig 17/17] gconfig, graphics: Avoid crash when gvir_config_object_new_from_xml() returns NULL

2016-09-06 Thread Christophe Fergeau
On Thu, Apr 21, 2016 at 01:05:45PM +0200, Christophe Fergeau wrote:
> This issues is more widespread than that, it would be better to fix it
> everywhere in one go (maybe through a gvir_config_object_check_type() or
> something like this?)

I believe this patch should do for now (with runtime warnings). Since
I'm not sure how widespread _new_from_xml() use is, maybe it's enough
for now, and we can decide on the best way to handle a NULL return when
we start getting runtime warnings from that patch?


From 0b428df2d82b6e669b50a3c400716c3883f9fe9c Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cferg...@redhat.com>
Date: Tue, 6 Sep 2016 10:30:58 +0200
Subject: [libvirt-glib] gconfig: Add precondition to
 gvir_config_object_get_xml_node()

This will catch (among other things) cases when
gvir_config_object_get_xml_node() is called with a NULL argument. Not
catching this could cause a crash later on in cases when
gvir_config_object_new_from_xml() is called and returns NULL, and then
we call gvir_config_object_get_attribute() on it.
Now this should be caught with runtime warnings so that the underlying
issue can be fixed.
---
 libvirt-gconfig/libvirt-gconfig-object.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-object.c 
b/libvirt-gconfig/libvirt-gconfig-object.c
index 6225de2..8cc4065 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -284,6 +284,8 @@ gvir_config_object_get_xml_doc(GVirConfigObject *config)
 G_GNUC_INTERNAL xmlNodePtr
 gvir_config_object_get_xml_node(GVirConfigObject *config)
 {
+g_return_val_if_fail(GVIR_CONFIG_IS_OBJECT(config), NULL);
+
 return config->priv->node;
 }
 
-- 
2.7.4


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

Re: [libvirt] [libvirt-glib/libvirt-gconfig 06/17] gconfig: Implement gvir_config_domain_graphics_spice_get_tls_port()

2016-09-05 Thread Christophe Fergeau
On Thu, Apr 21, 2016 at 12:12:19PM +0200, Christophe Fergeau wrote:
> For patches up to this one:
> 
> Acked-by: Christophe Fergeau <cferg...@redhat.com>

On second thought, the API added by the patches before this one becomes
redundant and deprecated once the Remote/Local classes are introduced,
so adding these now does not sound very useful.

Christophe


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

Re: [libvirt] [gconfig v2 6/6] tests: Add test for GVirConfigDomainGraphicsListenAddress

2016-09-02 Thread Christophe Fergeau
On Wed, Aug 17, 2016 at 06:58:51PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru 
> 
> ---
>  tests/test-gconfig.c   | 36 
> ++
>  .../xml/gconfig-domain-device-graphics-listen.xml  |  7 +
>  2 files changed, 43 insertions(+)
>  create mode 100644 tests/xml/gconfig-domain-device-graphics-listen.xml
> 
> diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
> index a26bb5f..28565e3 100644
> --- a/tests/test-gconfig.c
> +++ b/tests/test-gconfig.c
> @@ -481,6 +481,40 @@ static void test_domain_device_graphics(void)
>  g_object_unref(G_OBJECT(domain));
>  }
>  
> +static void test_domain_device_graphics_listen(void)
> +{
> +GVirConfigDomain *domain;
> +GVirConfigDomainGraphicsSpice *graphics = NULL;
> +
> +domain = gvir_config_domain_new();
> +GList *listen_list = NULL;
> +
> +graphics = gvir_config_domain_graphics_spice_new();
> +
> +/* listen address node */
> +GVirConfigDomainGraphicsListenAddress *address_listen = 
> gvir_config_domain_graphics_listen_address_new();
> +GInetAddress *inet_address = g_inet_address_new_from_string("0.0.0.0");

This needs to be g_object_unref'ed() when no longer needed

> +
> +
> gvir_config_domain_graphics_listen_address_set_inet_address(address_listen, 
> inet_address);
> +GInetAddress *ret_inet_address = 
> gvir_config_domain_graphics_listen_address_get_inet_address(address_listen);

This too needs g_object_unref()

> +g_assert_cmpstr(g_inet_address_to_string(inet_address), ==, 
> g_inet_address_to_string(ret_inet_address));

Better to use g_inet_address_equal() here, as otherwise you need to make
sure you free the strings returned by g_inet_address_to_string().
It's better if the test case is leak-free so that it's easier to detect
leaks in newly added code. And if people use it as a base for their
code, better if the code is not too bad.

> +
> +gvir_config_domain_graphics_listen_address_set_address(address_listen, 
> "127.0.0.1");
> +const gchar *ret_address = 
> gvir_config_domain_graphics_listen_address_get_address(address_listen);
> +g_assert_cmpstr("127.0.0.1", ==, ret_address);
> +
> +/* test listen setter */
> +listen_list = g_list_append(listen_list, address_listen);

You are missing a g_list_free() when you no longer need this

> +gvir_config_domain_graphics_spice_set_listen_devices(graphics, 
> listen_list);
> +g_object_unref(G_OBJECT(address_listen));
> +
> +gvir_config_domain_add_device(domain, 
> GVIR_CONFIG_DOMAIN_DEVICE(graphics));
> +g_object_unref(G_OBJECT(graphics));

I've fixed all this locally, so no need to resend a fixed version.

Christophe


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

Re: [libvirt] [gconfig v2 5/6] config: Add spice listen getter/setter

2016-09-02 Thread Christophe Fergeau
On Wed, Aug 17, 2016 at 06:58:50PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru 
> 
> Learn to get/set the listen devices that spice graphics is using.
> 
> When setting the listen devices, first remove the 'listen'
> attribute to avoid the inconsistencies checks between the 'listen'
> attribute and the 'address' attribute of the 'listen' node.
> ---
>  .../libvirt-gconfig-domain-graphics-spice.c| 84 
> ++
>  .../libvirt-gconfig-domain-graphics-spice.h|  4 ++
>  libvirt-gconfig/libvirt-gconfig.sym|  2 +
>  3 files changed, 90 insertions(+)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> index 079ea27..133eb1f 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> @@ -157,6 +157,90 @@ void 
> gvir_config_domain_graphics_spice_set_image_compression
>  compression);
>  }
>  
> +/**
> + * gvir_config_domain_graphics_spice_set_listen_devices:
> + * @graphics: a #GVirConfigDomainGraphicsSpice
> + * @listens: (in) (element-type LibvirtGConfig.DomainGraphicsListen): listens
> + *
> + * This method is used to set the various listen nodes a 
> #GVirConfigDomainGraphicsSpice
> + * device can handle.
> +*/
> +void 
> gvir_config_domain_graphics_spice_set_listen_devices(GVirConfigDomainGraphicsSpice
>  *graphics,
> +  GList *listens)

Same comment as in the previous patch regarding the naming.

Christophe


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

Re: [libvirt] [gconfig v2 4/6] config: Add vnc listen getter/setter

2016-09-02 Thread Christophe Fergeau
On Wed, Aug 17, 2016 at 06:58:49PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru <viorel.visar...@gmail.com>
> 
> Learn to get/set the listen devices that vnc is using.
> 
> When setting the listen devices, first remove the 'listen' attribute
> to avoid inconsistencies checks between the 'listen' attribute and the
> 'address' attribute of the 'listen' node.
> ---
>  .../libvirt-gconfig-domain-graphics-vnc.c  | 84 
> ++
>  .../libvirt-gconfig-domain-graphics-vnc.h  |  4 ++
>  libvirt-gconfig/libvirt-gconfig.sym|  2 +
>  3 files changed, 90 insertions(+)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
> index fc26bb9..46f3a4b 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
> @@ -120,6 +120,90 @@ void 
> gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graph
> NULL);
>  }
>  
> +/**
> + * gvir_config_domain_graphics_vnc_set_listen_devices:
> + * @graphics: a #GVirConfigDomainGraphicsVnc
> + * @listens: (in) (element-type LibvirtGConfig.DomainGraphicsListen):
> + *
> + * This method is used to set the various listen nodes a 
> #GVirConfigDomainGraphicsVnc
> + * device can handle.
> +*/
> +void 
> gvir_config_domain_graphics_vnc_set_listen_devices(GVirConfigDomainGraphicsVnc
>  *graphics,
> +GList *listens)

Patch is good overall, but the naming needs improving, these 
nodes are not devices. I'm not exactly sure how to name the API though.
_set_listen_nodes() is the only thing which comes to mind, and I don't
think it's great. Another options would be just _set_listens(), but
that's odd too. Any better suggestion?

Apart from this naming issue (which has to be fixed before pushing),

Acked-by: Christophe Fergeau <cferg...@redhat.com>

Christophe


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

Re: [libvirt] [gconfig v2 3/6] Introduce libvirt-gconfig-domain-graphics-listen-address

2016-09-02 Thread Christophe Fergeau
On Wed, Aug 17, 2016 at 06:58:48PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru <viorel.visar...@gmail.com>
> 
> This is needed to be able to change the address a graphics
> device is listening for.
> ---
>  libvirt-gconfig/Makefile.am|   2 +
>  ...ibvirt-gconfig-domain-graphics-listen-address.c | 128 
> +
>  ...ibvirt-gconfig-domain-graphics-listen-address.h |  78 +
>  libvirt-gconfig/libvirt-gconfig.h  |   1 +
>  libvirt-gconfig/libvirt-gconfig.sym|   7 ++
>  5 files changed, 216 insertions(+)
>  create mode 100644 
> libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
>  create mode 100644 
> libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.h
> 
> diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
> index 09739c5..5e66c4a 100644
> --- a/libvirt-gconfig/Makefile.am
> +++ b/libvirt-gconfig/Makefile.am
> @@ -47,6 +47,7 @@ GCONFIG_HEADER_FILES = \
>   libvirt-gconfig-domain-graphics.h \
>   libvirt-gconfig-domain-graphics-desktop.h \
>   libvirt-gconfig-domain-graphics-listen.h\
> + libvirt-gconfig-domain-graphics-listen-address.h\
>   libvirt-gconfig-domain-graphics-rdp.h \
>   libvirt-gconfig-domain-graphics-sdl.h \
>   libvirt-gconfig-domain-graphics-spice.h \
> @@ -141,6 +142,7 @@ GCONFIG_SOURCE_FILES = \
>   libvirt-gconfig-domain-graphics.c \
>   libvirt-gconfig-domain-graphics-desktop.c \
>   libvirt-gconfig-domain-graphics-listen.c\
> + libvirt-gconfig-domain-graphics-listen-address.c\
>   libvirt-gconfig-domain-graphics-rdp.c \
>   libvirt-gconfig-domain-graphics-sdl.c \
>   libvirt-gconfig-domain-graphics-spice.c \
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
> new file mode 100644
> index 000..74815a8
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
> +
> +void 
> gvir_config_domain_graphics_listen_address_set_address(GVirConfigDomainGraphicsListenAddress
>  *listen,
> +const gchar 
> *address)
> +{
> +g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_ADDRESS(listen));
> +
> +gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(listen),
> + "address", address,
> + NULL);
> +}
> +
> +const gchar *
> +gvir_config_domain_graphics_listen_address_get_address(GVirConfigDomainGraphicsListenAddress
>  *listen)
> +{
> +
> g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_ADDRESS(listen), 
> NULL);
> +
> +return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(listen),
> +NULL,
> +"address");
> +}
> +
> +void 
> gvir_config_domain_graphics_listen_address_set_inet_address(GVirConfigDomainGraphicsListenAddress
>  *listen,
> + 
> GInetAddress *address)
> +{
> +g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_ADDRESS(listen));
> +
> +gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(listen),
> + "address", g_inet_address_to_string 
> (address),
> + NULL);

You need to g_free() the string returned by
g_inet_address_new_from_string() after using it or you will have a
memory leak. Fixed locally too, so no need to resend.

Acked-by: Christophe Fergeau <cferg...@redhat.com>

Christophe


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

Re: [libvirt] [gconfig v2 2/6] Introduce libvirt-domain-graphics-listen

2016-09-02 Thread Christophe Fergeau

Acked-by: Christophe Fergeau <cferg...@redhat.com>

On Wed, Aug 17, 2016 at 06:58:47PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru <viorel.visar...@gmail.com>
> 
> Abstract class which represents a listen child node
> of the graphics device.
> ---
>  libvirt-gconfig/Makefile.am|  2 +
>  .../libvirt-gconfig-domain-graphics-listen.c   | 49 
>  .../libvirt-gconfig-domain-graphics-listen.h   | 65 
> ++
>  libvirt-gconfig/libvirt-gconfig.h  |  1 +
>  libvirt-gconfig/libvirt-gconfig.sym|  1 +
>  5 files changed, 118 insertions(+)
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h
> 
> diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
> index 1a9a97a..09739c5 100644
> --- a/libvirt-gconfig/Makefile.am
> +++ b/libvirt-gconfig/Makefile.am
> @@ -46,6 +46,7 @@ GCONFIG_HEADER_FILES = \
>   libvirt-gconfig-domain-filesys.h \
>   libvirt-gconfig-domain-graphics.h \
>   libvirt-gconfig-domain-graphics-desktop.h \
> + libvirt-gconfig-domain-graphics-listen.h\
>   libvirt-gconfig-domain-graphics-rdp.h \
>   libvirt-gconfig-domain-graphics-sdl.h \
>   libvirt-gconfig-domain-graphics-spice.h \
> @@ -139,6 +140,7 @@ GCONFIG_SOURCE_FILES = \
>   libvirt-gconfig-domain-filesys.c \
>   libvirt-gconfig-domain-graphics.c \
>   libvirt-gconfig-domain-graphics-desktop.c \
> + libvirt-gconfig-domain-graphics-listen.c\
>   libvirt-gconfig-domain-graphics-rdp.c \
>   libvirt-gconfig-domain-graphics-sdl.c \
>   libvirt-gconfig-domain-graphics-spice.c \
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c
> new file mode 100644
> index 000..095abe7
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c
> @@ -0,0 +1,49 @@
> +/*
> + * libvirt-gconfig-domain-graphics-listen.c: libvirt domain graphics listen 
> base class
> + *
> + * Copyright (C) 2016 Red Hat, Inc.
> + * Copyright (C) 2016 Visarion Alexandru <viorel.visar...@gmail.com>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library. If not, see
> + * <http://www.gnu.org/licenses/>.
> + *
> + * Author: Visarion Alexandru <viorel.visar...@gmail.com>
> + */
> +
> +#include 
> +
> +#include "libvirt-gconfig/libvirt-gconfig.h"
> +#include "libvirt-gconfig/libvirt-gconfig-private.h"
> +
> +#define GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_GET_PRIVATE(obj)  
>\
> +(G_TYPE_INSTANCE_GET_PRIVATE((obj), 
> GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN, 
> GVirConfigDomainGraphicsListenPrivate))
> +
> +struct _GVirConfigDomainGraphicsListenPrivate
> +{
> +gboolean unused;
> +};
> +
> +G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainGraphicsListen, 
> gvir_config_domain_graphics_listen, GVIR_CONFIG_TYPE_OBJECT);
> +
> +
> +static void 
> gvir_config_domain_graphics_listen_class_init(GVirConfigDomainGraphicsListenClass
>  *klass)
> +{
> +g_type_class_add_private(klass, 
> sizeof(GVirConfigDomainGraphicsListenPrivate));
> +}
> +
> +
> +static void 
> gvir_config_domain_graphics_listen_init(GVirConfigDomainGraphicsListen 
> *listen)
> +{
> +listen->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_GET_PRIVATE(listen);
> +}
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h
> new file mode 100644
> index 000..6f93d27
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h
> @@ -0,0 +1,65 @@
> +/*
> + * libvirt-gconfig-domain-graphics-listen.h: libvirt domain graphics listen

Re: [libvirt] [gconfig v2 1/6] libvirt-gconfig: Include GIO dependency

2016-09-02 Thread Christophe Fergeau
Hey,

On Wed, Aug 17, 2016 at 06:58:46PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru <viorel.visar...@gmail.com>
> 
> We will need a GInetAddress for setting a graphics device's
> listen address, so let's include GIO2 in libvirt-gconfig.
> ---
>  configure.ac| 2 ++
>  libvirt-gconfig-1.0.pc.in   | 2 +-
>  libvirt-gconfig/Makefile.am | 6 --
>  vapi/Makefile.am| 1 +
>  4 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 8edde74..647a5ec 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -112,6 +112,8 @@ PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_TEST_REQUIRED,
>  PKG_CHECK_MODULES(GTHREAD2, gthread-2.0 >= $GLIB2_REQUIRED)
>  PKG_CHECK_MODULES(GOBJECT2, gobject-2.0 >= $GLIB2_REQUIRED)
>  PKG_CHECK_MODULES(GIO2, gio-2.0 >= $GLIB2_REQUIRED)
> +AC_SUBST(GIO2_CFLAGS)
> +AC_SUBST(GIO2_LIBS)

This is not needed, PKG_CHECK_MODULES() already does it for you (I've
fixed it locally, so no need to resend a patch).

Acked-by: Christophe Fergeau <cferg...@redhat.com>

Christophe


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

[libvirt] [libvirt-glib 2/2] object: Fix gvir_connection_create_storage_pool() leak

2016-09-02 Thread Christophe Fergeau
We need to free the string returned by gvir_config_object_to_xml() after
using it.
---
 libvirt-gobject/libvirt-gobject-connection.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libvirt-gobject/libvirt-gobject-connection.c 
b/libvirt-gobject/libvirt-gobject-connection.c
index 3f17265..da3db50 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -2001,7 +2001,7 @@ GVirStoragePool *gvir_connection_create_storage_pool
  GVirConfigStoragePool *conf,
  guint flags,
  GError **err) {
-const gchar *xml;
+gchar *xml;
 virStoragePoolPtr handle;
 GVirConnectionPrivate *priv;
 
@@ -2014,7 +2014,9 @@ GVirStoragePool *gvir_connection_create_storage_pool
 g_return_val_if_fail(xml != NULL, NULL);
 
 priv = conn->priv;
-if (!(handle = virStoragePoolDefineXML(priv->conn, xml, flags))) {
+handle = virStoragePoolDefineXML(priv->conn, xml, flags);
+g_free(xml);
+if (!handle) {
 gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
flags,
_("Failed to create storage pool"));
-- 
2.7.4

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


[libvirt] [libvirt-glib 1/2] config: Fix gvir_config_xml_node_to_string() leak

2016-09-02 Thread Christophe Fergeau
If xmlNodeDump() fails, we would be leaking the xmlBuffer we created.
This commit ensures we don't return early before this buffer is freed.
---
 libvirt-gconfig/libvirt-gconfig-helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-helpers.c 
b/libvirt-gconfig/libvirt-gconfig-helpers.c
index 0314a72..e8f9664 100644
--- a/libvirt-gconfig/libvirt-gconfig-helpers.c
+++ b/libvirt-gconfig/libvirt-gconfig-helpers.c
@@ -293,7 +293,7 @@ gvir_config_xml_node_to_string(xmlNodePtr node)
 
 xmlbuf = xmlBufferCreate();
 if (xmlNodeDump(xmlbuf, node->doc, node, 0, 1) < 0)
-return NULL;
+xml = NULL;
 else
 xml = g_strndup((gchar *)xmlBufferContent(xmlbuf), 
xmlBufferLength(xmlbuf));
 
-- 
2.7.4

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


Re: [libvirt] [libvirt-php][PATCH] m4: Check for php modules more wisely

2016-09-02 Thread Christophe Fergeau
Hey,

On Thu, Sep 01, 2016 at 01:30:33PM +0200, Michal Privoznik wrote:
> I've got two version of PHP installed on my system, however one
> of them has imagick the other one doesn't. During configure I've
> noticed that wrong assumption has been made. Configure script
> wrongly assumed the plugin missing. This is because for detecting
> php plugins we use plain 'php -m | grep $module'. On my system,
> php is a symlink and it defaults to the version without the
> plugin. However, I am explicitly supplying 'php-config' from the
> version that has the plugin installed:
> 
>   ./configure --with-php-config=/usr/lib64/php5.6/bin/php-config
> 
> The trick is to query provided php-config for path to php binary.
> 
> Signed-off-by: Michal Privoznik 
> ---
> 
> Pushed under php-auto-push rule.
> 
>  m4/virt-php-extension.m4 | 13 -
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/m4/virt-php-extension.m4 b/m4/virt-php-extension.m4
> index 9040eb1..5aa3cb7 100644
> --- a/m4/virt-php-extension.m4
> +++ b/m4/virt-php-extension.m4
> @@ -25,7 +25,18 @@ dnl
>  AC_DEFUN([LIBVIRT_CHECK_PHP_EXTENSION],[
>AC_MSG_CHECKING([for php module $1])
>  
> -  module="$(php -m | grep $1)"
> +  phpbinary="$($PHPCONFIG --php-binary)"
> +  if test "x$phpbinary" = "x"; then
> +phpbinary="$($PHPCONFIG --prefix)/bin/php"
> +  fi
> +
> +  if test ! -x "$phpbinary"; then
> +AC_MSG_ERROR([php binary not found])
> +  fi
> +
> +  AC_SUBST([phpbinary])

Is the AC_SUBST needed? Nothing outside of m4/virt-php-extension.m4
seems to be using it.

Christophe


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

[libvirt] [PATCH] docs: Add missing / to closing tag

2016-08-30 Thread Christophe Fergeau
The iothread example for virtio-scsi should be
 rather than 
for the XML to be valid.
---
I've already pushed this under the docs/trivial rule.

Christophe


 docs/formatdomain.html.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f1dadc6..8c15a73 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3166,7 +3166,7 @@
   address type='pci' domain='0x' bus='0x00' slot='0x0a' 
function='0x0'/
 /controller
 controller type='scsi' index='0' model='virtio-scsi'
-  driver iothread='4'
+  driver iothread='4'/
   address type='pci' domain='0x' bus='0x00' slot='0x0b' 
function='0x0'/
 /controller
 ...
-- 
2.7.4

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


Re: [libvirt] [gconfig v2 4/4] config: Add spice host setter

2016-08-03 Thread Christophe Fergeau
Same minor comments as the previous patch,
Adding some test case to tests/test-gconfig.c would be good to have imo.

Acked-by: Christophe Fergeau <cferg...@redhat.com>

Christophe

On Mon, Aug 01, 2016 at 11:52:40PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru <viorel.visar...@gmail.com>
> 
> Learn to set the address that spice is listening on.
> 
> We first remove the 'listen' attribute to avoid inconsistencies
> checks between the 'listen' attribute and the 'address'
> attribute of the 'listen' node.
> ---
>  .../libvirt-gconfig-domain-graphics-spice.c| 28 
> ++
>  .../libvirt-gconfig-domain-graphics-spice.h|  3 +++
>  libvirt-gconfig/libvirt-gconfig.sym|  1 +
>  3 files changed, 32 insertions(+)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> index 079ea27..4219ff0 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> @@ -157,6 +157,34 @@ void 
> gvir_config_domain_graphics_spice_set_image_compression
>  compression);
>  }
>  
> +/**
> + * gvir_config_domain_graphics_spice_set_listen_address:
> + * @graphics: a #GVirConfigDomainGraphicsSpice
> + * @listens: (in) (element-type LibvirtGConfig.DomainGraphicsListen):
> + *
> + * This method is used to set the various listen nodes a 
> #GVirConfigDomainGraphicsSpice
> + * device can handle.
> +*/
> +void 
> gvir_config_domain_graphics_spice_set_listen_address(GVirConfigDomainGraphicsSpice
>  *graphics,
> +  GList *listens)
> +{
> +GList *it;
> +
> +g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics));
> +
> +gvir_config_object_remove_attribute (GVIR_CONFIG_OBJECT(graphics),
> + "listen");
> +gvir_config_object_delete_children (GVIR_CONFIG_OBJECT (graphics),
> +"listen", NULL);
> +
> +for (it = listens; it != NULL; it = it->next) {
> +g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN(it->data));
> +
> +gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(graphics),
> +  GVIR_CONFIG_OBJECT(it->data));
> +}
> +}
> +
>  void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice 
> *graphics,
>gboolean gl)
>  {
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
> index 25c132e..03abe5b 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
> @@ -95,6 +95,9 @@ gvir_config_domain_graphics_spice_get_image_compression
>  void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice 
> *graphics,
>gboolean gl);
>  
> +void 
> gvir_config_domain_graphics_spice_set_listen_address(GVirConfigDomainGraphicsSpice
>  *graphics,
> +GList *listens);
> +
>  G_END_DECLS
>  
>  #endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_SPICE_H__ */
> diff --git a/libvirt-gconfig/libvirt-gconfig.sym 
> b/libvirt-gconfig/libvirt-gconfig.sym
> index 117a648..73fd977 100644
> --- a/libvirt-gconfig/libvirt-gconfig.sym
> +++ b/libvirt-gconfig/libvirt-gconfig.sym
> @@ -769,6 +769,7 @@ global:
>   gvir_config_domain_graphics_listen_address_new;
>   gvir_config_domain_graphics_listen_address_new_from_xml;
>   gvir_config_domain_graphics_vnc_set_listen_address;
> + gvir_config_domain_graphics_spice_set_listen_address;
>  } LIBVIRT_GCONFIG_0.2.2;
>  
>  #  define new API here using predicted next version number 
> -- 
> 2.7.4
> 
> --
> 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

Re: [libvirt] [gconfig v2 3/4] config: Add vnc host setter

2016-08-03 Thread Christophe Fergeau
On Mon, Aug 01, 2016 at 11:52:39PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru <viorel.visar...@gmail.com>
> 
> Learn to set the address that vnc is listening on.
> 
> We first remove the 'listen' attribute to avoid inconsistencies
> checks between the 'listen' attribute and the 'address'
> attribute of the 'listen' node.
> ---
>  .../libvirt-gconfig-domain-graphics-vnc.c  | 28 
> ++
>  .../libvirt-gconfig-domain-graphics-vnc.h  |  3 +++
>  libvirt-gconfig/libvirt-gconfig.sym|  1 +
>  3 files changed, 32 insertions(+)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
> index fc26bb9..dc7641b 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
> @@ -120,6 +120,34 @@ void 
> gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graph
> NULL);
>  }
>  
> +/**
> + * gvir_config_domain_graphics_vnc_set_listen_address:
> + * @graphics: a #GVirConfigDomainGraphicsVnc
> + * @listens: (in) (element-type LibvirtGConfig.DomainGraphicsListen):
> + *
> + * This method is used to set the various listen nodes a 
> #GVirConfigDomainGraphicsVnc
> + * device can handle.
> +*/
> +void 
> gvir_config_domain_graphics_vnc_set_listen_address(GVirConfigDomainGraphicsVnc
>  *graphics,
> +GList *listens)
> +{
> +GList *it;
> +
> +g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_VNC(graphics));
> +
> +gvir_config_object_remove_attribute (GVIR_CONFIG_OBJECT(graphics),
> +"listen");
> +gvir_config_object_delete_children (GVIR_CONFIG_OBJECT (graphics),
> +"listen", NULL);
> +
> +for (it = listens; it != NULL; it = it->next) {
> +g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN(it->data));
> +

gvir_config_domain_set_devices() warns but continues trying the other
devices, we probably can do the same here:

if (!GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN(it->data)) {
g_warn_if_reached();
continue;
}

> +gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(graphics),
> +  GVIR_CONFIG_OBJECT(it->data));
> +}
> +}
> +
>  void 
> gvir_config_domain_graphics_vnc_set_password(GVirConfigDomainGraphicsVnc 
> *graphics,
>const char *password)
>  {
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
> index fe78621..f524dcc 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
> @@ -73,6 +73,9 @@ int 
> gvir_config_domain_graphics_vnc_get_port(GVirConfigDomainGraphicsVnc *graphi
>  void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc 
> *graphics,
>int port);
>  
> +void 
> gvir_config_domain_graphics_vnc_set_listen_address(GVirConfigDomainGraphicsVnc
>  *graphics,
> +GList *listens);

Indentation is off here, you need 4 more spaces.

> +
>  void 
> gvir_config_domain_graphics_vnc_set_password(GVirConfigDomainGraphicsVnc 
> *graphics,
>const char *password);
>  
> diff --git a/libvirt-gconfig/libvirt-gconfig.sym 
> b/libvirt-gconfig/libvirt-gconfig.sym
> index fab6059..117a648 100644
> --- a/libvirt-gconfig/libvirt-gconfig.sym
> +++ b/libvirt-gconfig/libvirt-gconfig.sym
> @@ -768,6 +768,7 @@ global:
>   gvir_config_domain_graphics_listen_address_get_type;
>   gvir_config_domain_graphics_listen_address_new;
>   gvir_config_domain_graphics_listen_address_new_from_xml;
> + gvir_config_domain_graphics_vnc_set_listen_address;
>  } LIBVIRT_GCONFIG_0.2.2;

Be careful to the alphabetical sorting as in the other patches.

Acked-by: Christophe Fergeau <cferg...@redhat.com>

Christophe


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

Re: [libvirt] [gconfig v2 2/4] Introduce libvirt-gconfig-domain-graphics-listen-address

2016-08-03 Thread Christophe Fergeau
On Mon, Aug 01, 2016 at 11:52:38PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru 
> 
> This is needed to be able to change the address a graphics
> device is listening on.
> ---
>  libvirt-gconfig/Makefile.am|  2 +
>  ...ibvirt-gconfig-domain-graphics-listen-address.c | 79 
> ++
>  ...ibvirt-gconfig-domain-graphics-listen-address.h | 67 ++
>  libvirt-gconfig/libvirt-gconfig.h  |  1 +
>  libvirt-gconfig/libvirt-gconfig.sym|  3 +
>  5 files changed, 152 insertions(+)
>  create mode 100644 
> libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
>  create mode 100644 
> libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.h
> 
> diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
> index 27c6df1..6be860b 100644
> --- a/libvirt-gconfig/Makefile.am
> +++ b/libvirt-gconfig/Makefile.am
> @@ -46,6 +46,7 @@ GCONFIG_HEADER_FILES = \
>   libvirt-gconfig-domain-filesys.h \
>   libvirt-gconfig-domain-graphics.h \
>   libvirt-gconfig-domain-graphics-listen.h\
> + libvirt-gconfig-domain-graphics-listen-address.h\
>   libvirt-gconfig-domain-graphics-desktop.h \
>   libvirt-gconfig-domain-graphics-rdp.h \
>   libvirt-gconfig-domain-graphics-sdl.h \
> @@ -140,6 +141,7 @@ GCONFIG_SOURCE_FILES = \
>   libvirt-gconfig-domain-filesys.c \
>   libvirt-gconfig-domain-graphics.c \
>   libvirt-gconfig-domain-graphics-listen.c\
> + libvirt-gconfig-domain-graphics-listen-address.c\
>   libvirt-gconfig-domain-graphics-desktop.c \
>   libvirt-gconfig-domain-graphics-rdp.c \
>   libvirt-gconfig-domain-graphics-sdl.c \
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
> new file mode 100644
> index 000..460ca23
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
> @@ -0,0 +1,79 @@
> +/*
> + * libvirt-gconfig-domain-graphics-listen-address.c: libvirt domain graphics 
> listen address configuration
> + *
> + * Copyright (C) 2016 Red Hat, Inc.

Same comment about the copyright, this should contain your name.

> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library. If not, see
> + * .
> + *
> + * Author: Visarion Alexandru 
> + */
> +
> +#include 
> +
> +#include "libvirt-gconfig/libvirt-gconfig.h"
> +#include "libvirt-gconfig/libvirt-gconfig-private.h"
> +
> +#define GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_ADDRESS_GET_PRIVATE(obj)  
>\
> +(G_TYPE_INSTANCE_GET_PRIVATE((obj), 
> GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_ADDRESS, 
> GVirConfigDomainGraphicsListenAddressPrivate))
> +
> +struct _GVirConfigDomainGraphicsListenAddressPrivate
> +{
> +gboolean unused;
> +};
> +
> +G_DEFINE_TYPE(GVirConfigDomainGraphicsListenAddress, 
> gvir_config_domain_graphics_listen_address, 
> GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN);
> +
> +
> +static void 
> gvir_config_domain_graphics_listen_address_class_init(GVirConfigDomainGraphicsListenAddressClass
>  *klass)
> +{
> +g_type_class_add_private(klass, 
> sizeof(GVirConfigDomainGraphicsListenAddressPrivate));
> +}
> +
> +
> +static void 
> gvir_config_domain_graphics_listen_address_init(GVirConfigDomainGraphicsListenAddress
>  *address)
> +{
> +address->priv = 
> GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_ADDRESS_GET_PRIVATE(address);
> +}
> +
> +
> +GVirConfigDomainGraphicsListenAddress 
> *gvir_config_domain_graphics_listen_address_new(const char *address)
> +{
> +GVirConfigObject *object;
> +
> +object = 
> gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN_ADDRESS, 
> "listen", NULL);
> +gvir_config_object_set_attribute(object,
> + "type", "address",
> + NULL);
> +gvir_config_object_set_attribute(object,
> + "address", address,
> + NULL);
> +
> +return 

Re: [libvirt] [gconfig v2 1/4] Introduce libvirt-domain-graphics-listen

2016-08-03 Thread Christophe Fergeau
Hey,

On Mon, Aug 01, 2016 at 11:52:37PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru 
> 
> Abstract class which represents a listen child node
> of the graphics device.
> ---
>  libvirt-gconfig/Makefile.am|  2 +
>  .../libvirt-gconfig-domain-graphics-listen.c   | 48 
>  .../libvirt-gconfig-domain-graphics-listen.h   | 64 
> ++
>  libvirt-gconfig/libvirt-gconfig.h  |  1 +
>  libvirt-gconfig/libvirt-gconfig.sym|  1 +
>  5 files changed, 116 insertions(+)
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h
> 
> diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
> index 0400343..27c6df1 100644
> --- a/libvirt-gconfig/Makefile.am
> +++ b/libvirt-gconfig/Makefile.am
> @@ -45,6 +45,7 @@ GCONFIG_HEADER_FILES = \
>   libvirt-gconfig-domain-disk-driver.h \
>   libvirt-gconfig-domain-filesys.h \
>   libvirt-gconfig-domain-graphics.h \
> + libvirt-gconfig-domain-graphics-listen.h\
>   libvirt-gconfig-domain-graphics-desktop.h \
>   libvirt-gconfig-domain-graphics-rdp.h \
>   libvirt-gconfig-domain-graphics-sdl.h \
> @@ -138,6 +139,7 @@ GCONFIG_SOURCE_FILES = \
>   libvirt-gconfig-domain-disk-driver.c \
>   libvirt-gconfig-domain-filesys.c \
>   libvirt-gconfig-domain-graphics.c \
> + libvirt-gconfig-domain-graphics-listen.c\
>   libvirt-gconfig-domain-graphics-desktop.c \
>   libvirt-gconfig-domain-graphics-rdp.c \
>   libvirt-gconfig-domain-graphics-sdl.c \
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c
> new file mode 100644
> index 000..c89f126
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.c
> @@ -0,0 +1,48 @@
> +/*
> + * libvirt-gconfig-domain-graphics-listen.c: libvirt domain graphics listen 
> base class
> + *


Since you write this code and not Red Hat, this should read:

> + * Copyright (C) 2016 Visarion Alexandru 

If you copied the code from another file and want to keep the copyright
history, just keep the previous (C) line, and add another one with your
name on it.


> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library. If not, see
> + * .
> + *
> + * Author: Visarion Alexandru 
> + */
> +
> +#include 
> +
> +#include "libvirt-gconfig/libvirt-gconfig.h"
> +#include "libvirt-gconfig/libvirt-gconfig-private.h"
> +
> +#define GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_GET_PRIVATE(obj)  
>\
> +(G_TYPE_INSTANCE_GET_PRIVATE((obj), 
> GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_LISTEN, 
> GVirConfigDomainGraphicsListenPrivate))
> +
> +struct _GVirConfigDomainGraphicsListenPrivate
> +{
> +gboolean unused;
> +};
> +
> +G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainGraphicsListen, 
> gvir_config_domain_graphics_listen, GVIR_CONFIG_TYPE_OBJECT);
> +
> +
> +static void 
> gvir_config_domain_graphics_listen_class_init(GVirConfigDomainGraphicsListenClass
>  *klass)
> +{
> +g_type_class_add_private(klass, 
> sizeof(GVirConfigDomainGraphicsListenPrivate));
> +}
> +
> +
> +static void 
> gvir_config_domain_graphics_listen_init(GVirConfigDomainGraphicsListen 
> *listen)
> +{
> +listen->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_LISTEN_GET_PRIVATE(listen);
> +}
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h
> new file mode 100644
> index 000..dba3811
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen.h
> @@ -0,0 +1,64 @@
> +/*
> + * libvirt-gconfig-domain-graphics-listen.h: libvirt domain graphics listen 
> base class
> + *
> + * Copyright (C) 2016 Red Hat, Inc.
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software 

Re: [libvirt] [PATCH glib] Delete the manually written python binding

2016-08-02 Thread Christophe Fergeau

Acked-by: Christophe Fergeau <cferg...@redhat.com>

On Tue, Aug 02, 2016 at 02:34:33PM +0100, Daniel P. Berrange wrote:
> The python binding only supports python2, only supports
> 1 single API in libvirt-glib and has not even been enabled
> in RPM builds since Fedora 15. Any distro these days should
> have gobject introspection and pygobject available, so
> there's no compelling reason to continue to have the python
> binding exist.
> 
> Signed-off-by: Daniel P. Berrange <berra...@redhat.com>
> ---
>  Makefile.am|  2 +-
>  autobuild.sh   |  6 ++--
>  cfg.mk |  3 --
>  configure.ac   | 87 
> --
>  libvirt-glib.spec.in   | 35 +--
>  mingw-libvirt-glib.spec.in |  3 +-
>  python/Makefile.am | 34 --
>  python/libvirt-glib.c  | 59 ---
>  python/libvirtglib.py  | 10 --
>  9 files changed, 5 insertions(+), 234 deletions(-)
>  delete mode 100644 python/Makefile.am
>  delete mode 100644 python/libvirt-glib.c
>  delete mode 100644 python/libvirtglib.py
> 
> diff --git a/Makefile.am b/Makefile.am
> index ae8b06d..459d544 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -1,5 +1,5 @@
>  
> -SUBDIRS = libvirt-glib libvirt-gconfig libvirt-gobject python vapi examples 
> docs po tests
> +SUBDIRS = libvirt-glib libvirt-gconfig libvirt-gobject vapi examples docs po 
> tests
>  
>  ACLOCAL_AMFLAGS = -I m4
>  
> diff --git a/autobuild.sh b/autobuild.sh
> index 053dc1f..9935de1 100755
> --- a/autobuild.sh
> +++ b/autobuild.sh
> @@ -56,8 +56,7 @@ if test -x /usr/bin/i686-w64-mingw32-gcc ; then
>  --host=i686-w64-mingw32 \
>  --prefix="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw" \
>  --enable-werror \
> ---enable-introspection=no \
> ---without-python
> +--enable-introspection=no
>  
>make
>make install
> @@ -75,8 +74,7 @@ if test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
>  --host=x86_64-w64-mingw32 \
>  --prefix="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw" \
>  --enable-werror \
> ---enable-introspection=no \
> ---without-python
> +--enable-introspection=no
>  
>make
>make install
> diff --git a/cfg.mk b/cfg.mk
> index b322393..6dd34cf 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -115,9 +115,6 @@ exclude_file_name_regexp--sc_preprocessor_indentation = 
> ^*/*.[ch]
>  
>  exclude_file_name_regexp--sc_prohibit_strcmp = ^*/*.[ch]
>  
> -exclude_file_name_regexp--sc_require_config_h = python/libvirt-glib.c
> -exclude_file_name_regexp--sc_require_config_h_first = python/libvirt-glib.c
> -
>  # XXX we shouldn't really ignore this, but the horrible enum rules...
>  exclude_file_name_regexp--sc_makefile_at_at_check = 
> libvirt-gobject/Makefile.am
>  
> diff --git a/configure.ac b/configure.ac
> index 8edde74..cc9b2aa 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -135,15 +135,11 @@ dnl Copied from libxml2 configure.in, but I removed 
> mingw changes
>  dnl for now since I'm not supporting mingw at present.  - RWMJ
>  CYGWIN_EXTRA_LDFLAGS=
>  CYGWIN_EXTRA_LIBADD=
> -CYGWIN_EXTRA_PYTHON_LIBADD=
>  MINGW_EXTRA_LDFLAGS=
>  case "$host" in
>*-*-cygwin*)
>  CYGWIN_EXTRA_LDFLAGS="-no-undefined"
>  CYGWIN_EXTRA_LIBADD="${INTLLIBS}"
> -if test "x$PYTHON_VERSION" != "x"; then
> -  CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config 
> -lpython${PYTHON_VERSION}"
> -fi
>  ;;
>*-*-mingw*)
>  MINGW_EXTRA_LDFLAGS="-no-undefined"
> @@ -151,7 +147,6 @@ case "$host" in
>  esac
>  AC_SUBST([CYGWIN_EXTRA_LDFLAGS])
>  AC_SUBST([CYGWIN_EXTRA_LIBADD])
> -AC_SUBST([CYGWIN_EXTRA_PYTHON_LIBADD])
>  AC_SUBST([MINGW_EXTRA_LDFLAGS])
>  
>  
> @@ -172,87 +167,6 @@ if test "${enable_coverage}" = yes; then
>COV_FLAGS=
>  fi
>  
> -dnl
> -dnl check for python
> -dnl
> -AC_ARG_WITH([python],
> -  AC_HELP_STRING([--with-python], [Build python bindings 
> @<:@default=yes@:>@]),[],[with_python=yes])
> -
> -PYTHON_VERSION=
> -PYTHON_INCLUDES=
> -PYTHON_SITE_PACKAGES=
> -PYTHON_TESTS=
> -pythondir=
> -if test "$with_python" != "no" ; then
> -if test "$with_python" = "yes" ; then
> -   with_python=""
> -fi
> -if test -x "$with_python/bin/python"
> -then
> -echo Found python in $with_python/bin/python
> -PYTHON="

Re: [libvirt] [gconfig v2 1/2] config: Add vnc host setter

2016-07-29 Thread Christophe Fergeau
Hey,

On Thu, Jul 28, 2016 at 06:16:38PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru 
> 
> Learn to set the address that vnc is listening on.
> ---
>  libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c | 9 +
>  libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h | 3 +++
>  libvirt-gconfig/libvirt-gconfig.sym   | 1 +
>  3 files changed, 13 insertions(+)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
> index fc26bb9..dfec2d8 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
> @@ -120,6 +120,15 @@ void 
> gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graph
> NULL);
>  }
>  
> +void gvir_config_domain_graphics_vnc_set_host(GVirConfigDomainGraphicsVnc 
> *graphics,
> +  const char *address)

Why not gvir_config_domain_graphics_set_listen_address?

Overall, the patch looks good (adding some short API documentation would
be nice). However, the "listen" attribute really is deprecated at this
point in favour of "listen" nodes. Adding an API setting the "listen"
attribute and removing the "listen" node really looks like we are adding
already obsolete API to libvirt-glib.

Ideally we'd add
void
gvir_config_domain_graphics_vnc_set_listen(GVirConfigDomainGraphicsVnc
*graphics, GList *listens);
and a GVirConfigDomainGraphicsListen base class +
GVirConfigDomainGraphicsListenAddress derived class

This would allow us to support only the preferred XML format.

Christophe


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

Re: [libvirt] [gconfig v2 0/2] Add host setters

2016-07-29 Thread Christophe Fergeau
Hey,

On Thu, Jul 28, 2016 at 06:16:37PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru 
> 
> These new patches are a bit different than the last ones.
> I first delete the  child node and
> then I modify the  attribute.

You could mention this in the commit log of each patch as well, and
indicate that otherwise we could get inconsistencies between the listen
node and attribute, which causes errors when trying to start (or define
?) the domain.

Christophe

> 
> Visarion Alexandru (2):
>   config: Add vnc host setter
>   config: Add spice host setter
> 
>  libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 10 ++
>  libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h |  3 +++
>  libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c   |  9 +
>  libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h   |  3 +++
>  libvirt-gconfig/libvirt-gconfig.sym |  2 ++
>  5 files changed, 27 insertions(+)
> 
> -- 
> 2.7.4
> 
> --
> 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

Re: [libvirt] [PATCH libvirt-glib] docs: Document gvir_connection_get_{storage_pools, networks, domains}

2016-07-27 Thread Christophe Fergeau

Acked-by: Christophe Fergeau <cferg...@redhat.com>

(I'm assuming you can push to libvirt-glib, let me know if that's not
the case).

Christophe

On Wed, Jul 27, 2016 at 08:59:54AM +0200, Guido Günther wrote:
> In contrast to libvirt itself all get_* methods need to prefetch the
> corresponding information first so document this.
> ---
>  libvirt-gobject/libvirt-gobject-connection.c | 15 +++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-connection.c 
> b/libvirt-gobject/libvirt-gobject-connection.c
> index 00d5eda..3f17265 100644
> --- a/libvirt-gobject/libvirt-gobject-connection.c
> +++ b/libvirt-gobject/libvirt-gobject-connection.c
> @@ -700,6 +700,11 @@ void gvir_connection_close(GVirConnection *conn)
>   * gvir_connection_fetch_domains:
>   * @conn: a #GVirConnection
>   * @cancellable: (allow-none)(transfer none): cancellation object
> + *
> + * Use this method to fetch all domains managed by connection
> + * @conn. Use e.g. #gvir_connection_find_domain_by_id or
> + * #gvir_connection_get_domain afterwards to query the fetched
> + * domains.
>   */
>  gboolean gvir_connection_fetch_domains(GVirConnection *conn,
> GCancellable *cancellable,
> @@ -783,6 +788,11 @@ cleanup:
>   * gvir_connection_fetch_storage_pools:
>   * @conn: a #GVirConnection
>   * @cancellable: (allow-none)(transfer none): cancellation object
> + *
> + * Use this method to fetch all storage pools managed by connection
> + * @conn. Use e.g. #gvir_connection_find_storage_pool_by_name or
> + * #gvir_connection_get_storage_pools afterwards to query the fetched
> + * pools.
>   */
>  gboolean gvir_connection_fetch_storage_pools(GVirConnection *conn,
>   GCancellable *cancellable,
> @@ -1722,6 +1732,11 @@ GVirInterface 
> *gvir_connection_find_interface_by_mac(GVirConnection *conn,
>   * gvir_connection_fetch_networks:
>   * @conn: a #GVirConnection
>   * @cancellable: (allow-none)(transfer none): cancellation object
> + *
> + * Use this method to fetch all networks managed by connection
> + * @conn. Use e.g. #gvir_connection_find_network_by_name or
> + * #gvir_connection_get_networks afterwards to query the fetched
> + * domains.
>   */
>  gboolean gvir_connection_fetch_networks(GVirConnection *conn,
>  GCancellable *cancellable,
> -- 
> 2.8.1
> 
> --
> 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

Re: [libvirt] [libvirt-glib v8 5/5] tests: Add test for GVirConfigDomainHostdevPci API

2016-07-25 Thread Christophe Fergeau
On Mon, Jul 25, 2016 at 12:56:44PM +0100, Zeeshan Ali (Khattak) wrote:
> In my attempt to add a message to the patch series summarising the
> changes, I managed to add bogus emails in To and BCC fields. Please
> remove those when you reply.
> 
> Changes in v8: gvir_config_domain_hostdev_pci_get_rom_bar() simplified
> as per review comment.

For the series:

Acked-by: Christophe Fergeau <cferg...@redhat.com>


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

Re: [libvirt] [libvirt-glib v8 3/5] gconfig: Add GVirConfigDomainHostdevPci

2016-07-25 Thread Christophe Fergeau
On Mon, Jul 25, 2016 at 12:46:52PM +0100, Zeeshan Ali (Khattak) wrote:
> +void gvir_config_domain_hostdev_pci_set_address(GVirConfigDomainHostdevPci 
> *hostdev,
> +GVirConfigDomainAddressPci 
> *address)
> +{
> +GVirConfigObject *source;
> +xmlNodePtr node;
> +xmlAttrPtr attr;
> +
> +g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_HOSTDEV_PCI(hostdev));
> +g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_ADDRESS_PCI(address));
> +node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(address));
> +g_return_if_fail(node != NULL);
> +
> +source = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(hostdev),
> +  "source");
> +/* Because of https://bugzilla.redhat.com/show_bug.cgi?id=1327577, we 
> can't
> + * just use GVirConfigDomainAddressPci's node, as is, since it contains
> + * a 'type' attribute, which is not accepted by libvirt. So we create a
> + * copy for our use and just delete the 'type' attribute from it.
> + */
> +node = xmlCopyNode(node, 1);
> +for (attr = node->properties; attr; attr = attr->next) {
> +if (g_strcmp0 ("type", (char *)attr->name) == 0) {
> +xmlRemoveProp (attr);
> +break;
> +}
> +}

For what it's worth, introducing a gvir_config_object_remove_attribute()
would probably have been nicer than doing the removal on the raw XML
here (yeah, fairly late to think about this suggestion ;)

Christophe


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

Re: [libvirt] [libvirt-glib v7 3/5] gconfig: Add GVirConfigDomainHostdevPci

2016-07-25 Thread Christophe Fergeau
On Fri, Jul 22, 2016 at 01:43:35PM +0100, Zeeshan Ali (Khattak) wrote:
> +gboolean 
> gvir_config_domain_hostdev_pci_get_rom_bar(GVirConfigDomainHostdevPci 
> *hostdev)
> +{
> +xmlNodePtr hostdev_node;
> +xmlNodePtr rom_node;
> +const gchar *bar_str;
> +
> +g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_HOSTDEV_PCI(hostdev), FALSE);
> +
> +hostdev_node = 
> gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(hostdev));
> +g_return_val_if_fail(hostdev_node != NULL, FALSE);
> +
> +rom_node = gvir_config_xml_get_element(hostdev_node, "rom", NULL);
> +if (!rom_node || !(rom_node->children))
> +/* When containing rom node is missing, default value is TRUE for 
> newer Qemu */
> +return TRUE;
> +
> +bar_str = gvir_config_xml_get_attribute_content(rom_node, "bar");
> +return (g_strcmp0(bar_str, "on"));
> +}

Still the same question as
https://www.redhat.com/archives/libvir-list/2016-July/msg00644.html
Can't it become:

gboolean gvir_config_domain_hostdev_pci_get_rom_bar(GVirConfigDomainHostdevPci 
*hostdev)
{
const gchar *bar_str;

g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_HOSTDEV_PCI(hostdev), FALSE);

bar_str = gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(hostdev), 
"rom", "bar");
return (g_strcmp0(bar_str, "on") == 0);
}

Christophe


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

Re: [libvirt] [PATCHv5 2/5] Add GVirConfigDomainHostdev

2016-07-22 Thread Christophe Fergeau
On Fri, Jul 22, 2016 at 01:34:09PM +0100, Zeeshan Ali (Khattak) wrote:
> 
> Thanks. If there is a way to also set the address to send emails to,
> I'll gladly drop my commands (actually they are git aliases).

That's git config sendemail.to f...@example.com

Christophe


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

Re: [libvirt] [PATCHv5 2/5] Add GVirConfigDomainHostdev

2016-07-22 Thread Christophe Fergeau
On Thu, Jul 21, 2016 at 06:11:36PM +0100, Zeeshan Ali (Khattak) wrote:
> Hi,
> 
> On Mon, Jul 18, 2016 at 3:54 PM, Christophe Fergeau <cferg...@redhat.com> 
> wrote:
> > Please add a gconfig: prefix to the subject line.
> 
> I have a custom git command to add 'libvirt-glib' prefix but I keep
> forgetting that --subject-prefix gets overriden by the second
> --subject-prefix I manually specify for adding patch series version.

Ah, I did not pay attention to that actually ;) But I'd recommend just
doing
git config format.subjectprefix=libvirt-glib
and
git send-email -v2
(-v2 should work with your custom git command if that fits better your
worflow).

But I was only asking that "Add GVirConfigDomainHostdev" becomes
"gconfig: Add GVirConfigDomainHostdev"

Christophe


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

Re: [libvirt] [gconfig v2 1/2] config: Add spice listen setter

2016-07-18 Thread Christophe Fergeau
Hey,

On Mon, Jul 18, 2016 at 04:36:39PM +0300, Visarion Alexandru wrote:
> Learn to set the address that spice is listening on.
> ---
>  .../libvirt-gconfig-domain-graphics-spice.c| 18 
> ++
>  .../libvirt-gconfig-domain-graphics-spice.h|  3 +++
>  libvirt-gconfig/libvirt-gconfig.sym|  1 +
>  3 files changed, 22 insertions(+)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> index 079ea27..a773084 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
> @@ -165,3 +165,21 @@ void 
> gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice *gra
>  gvir_config_object_replace_child_with_attribute_enum
>(GVIR_CONFIG_OBJECT(graphics), "gl", "enable", G_TYPE_BOOLEAN, gl);
>  }
> +
> +void 
> gvir_config_domain_graphics_spice_set_listen_address(GVirConfigDomainGraphicsSpice
>  *graphics,
> +const char *address)
> +{
> +g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics));
> +
> +gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics), "listen", 
> address, NULL);



> +
> +gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(graphics),
> +"listen",
> +"address",
> +address);
> +
> +gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(graphics),
> +"listen",
> +"type",
> +"address");


and 
are 2 ways of expressing the same thing, with the  one 
being fairly new,
and  is slowly being deprecated. When  is used, a  node is automatically created iirc.

To handle the  nodes, I think it would make more sense to have
dedicated classes to handle it, and a
gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice
*graphics, GVirConfigDomainListen *listen) method.

So for now, in gvir_config_domain_graphics_spice_set_listen_address I
would only set the "listen" attribute. Then I wonder if the function
should take a GInetAddress rather than a const char *?

The alignment of the code is also odd, we try to align the split
argumetns to function calls with the parens on the first line, does this
show up this way in your editor?
For example

gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(graphics),
"listen",
"type",
"address");

Christophe


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

Re: [libvirt] [gconfig v2 2/2] config: Add vnc listen setter

2016-07-18 Thread Christophe Fergeau
Hey,

On Mon, Jul 18, 2016 at 04:36:40PM +0300, Visarion Alexandru wrote:
> Learn to set the address that vnc is listening on.

For what it's worth, this patch series
https://www.redhat.com/archives/libvir-list/2016-March/msg00993.html
would have allowed not to have to implement this both for VNC and SPICE.
Not sure why it did not land so far, I'll have to read back the old
thread/check with Fidencio.

Christophe


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

Re: [libvirt] [PATCHv5 5/5] Add test for GVirConfigDomainHostdevPci API

2016-07-18 Thread Christophe Fergeau

Acked-by: Christophe Fergeau <cferg...@redhat.com>

On Wed, Jul 06, 2016 at 10:45:55PM +0100, Zeeshan Ali (Khattak) wrote:
> ---
>  tests/test-gconfig.c| 43 
> +
>  tests/xml/gconfig-domain-device-pci-hostdev.xml | 11 +++
>  2 files changed, 54 insertions(+)
>  create mode 100644 tests/xml/gconfig-domain-device-pci-hostdev.xml
> 
> diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
> index be55ef9..a26bb5f 100644
> --- a/tests/test-gconfig.c
> +++ b/tests/test-gconfig.c
> @@ -709,6 +709,47 @@ static void test_domain_device_usb_redir(void)
>  g_object_unref(G_OBJECT(domain));
>  }
>  
> +static void test_domain_device_pci_hostdev(void)
> +{
> +GVirConfigDomain *domain;
> +GVirConfigDomainAddressPci *address;
> +GVirConfigDomainHostdevPci *hostdev;
> +
> +domain = gvir_config_domain_new();
> +
> +hostdev = gvir_config_domain_hostdev_pci_new();
> +
> gvir_config_domain_hostdev_set_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev),
>  1);
> +
> g_assert_cmpint(gvir_config_domain_hostdev_get_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev)),
>  ==, 1);
> +gvir_config_domain_hostdev_pci_set_managed(hostdev, TRUE);
> +g_assert(gvir_config_domain_hostdev_pci_get_managed(hostdev) == TRUE);
> +gvir_config_domain_hostdev_pci_set_rom_bar(hostdev, TRUE);
> +gvir_config_domain_hostdev_pci_set_rom_file(hostdev, 
> "/etc/fake/boot.bin");
> +g_assert_cmpstr(gvir_config_domain_hostdev_pci_get_rom_file(hostdev), 
> ==, "/etc/fake/boot.bin");
> +g_assert(gvir_config_domain_hostdev_pci_get_rom_bar(hostdev));
> +
> +address = gvir_config_domain_address_pci_new();
> +gvir_config_domain_address_pci_set_domain(address, 1);
> +gvir_config_domain_address_pci_set_bus(address, 2);
> +gvir_config_domain_address_pci_set_slot(address, 3);
> +gvir_config_domain_address_pci_set_function(address, 4);
> +gvir_config_domain_hostdev_pci_set_address(hostdev, address);
> +g_object_unref(G_OBJECT(address));
> +
> +address = gvir_config_domain_hostdev_pci_get_address(hostdev);
> +g_assert(address != NULL);
> +g_assert_cmpint(gvir_config_domain_address_pci_get_domain(address), ==, 
> 1);
> +g_assert_cmpint(gvir_config_domain_address_pci_get_bus(address), ==, 2);
> +g_assert_cmpint(gvir_config_domain_address_pci_get_slot(address), ==, 3);
> +g_assert_cmpint(gvir_config_domain_address_pci_get_function(address), 
> ==, 4);
> +g_object_unref(G_OBJECT(address));
> +
> +gvir_config_domain_add_device(domain, GVIR_CONFIG_DOMAIN_DEVICE 
> (hostdev));
> +g_object_unref(G_OBJECT(hostdev));
> +
> +check_xml(domain, "gconfig-domain-device-pci-hostdev.xml");
> +
> +g_object_unref(G_OBJECT(domain));
> +}
>  
>  int main(int argc, char **argv)
>  {
> @@ -739,6 +780,8 @@ int main(int argc, char **argv)
>  test_domain_device_channel);
>  g_test_add_func("/libvirt-gconfig/domain-device-usb-redir",
>  test_domain_device_usb_redir);
> +g_test_add_func("/libvirt-gconfig/domain-device-pci-hostdev",
> +test_domain_device_pci_hostdev);
>  
>  return g_test_run();
>  }
> diff --git a/tests/xml/gconfig-domain-device-pci-hostdev.xml 
> b/tests/xml/gconfig-domain-device-pci-hostdev.xml
> new file mode 100644
> index 000..70e32ac
> --- /dev/null
> +++ b/tests/xml/gconfig-domain-device-pci-hostdev.xml
> @@ -0,0 +1,11 @@
> +
> +  
> +
> +  
> +  
> +  
> +
> +  
> +
> +  
> +
> -- 
> 2.7.4
> 
> --
> 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

Re: [libvirt] [PATCHv5 3/5] Add GVirConfigDomainHostdevPci

2016-07-18 Thread Christophe Fergeau
gconfig: prefix to add to the subject line.

On Wed, Jul 06, 2016 at 10:45:53PM +0100, Zeeshan Ali (Khattak) wrote:
> +
> +const gchar 
> *gvir_config_domain_hostdev_pci_get_rom_file(GVirConfigDomainHostdevPci 
> *hostdev)
> +{
> +return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(hostdev), 
> "rom", "file");
> +}
> +
> +gboolean 
> gvir_config_domain_hostdev_pci_get_rom_bar(GVirConfigDomainHostdevPci 
> *hostdev)
> +{
> +xmlNodePtr hostdev_node;
> +xmlNodePtr rom_node;
> +const gchar *bar_str;
> +
> +g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_HOSTDEV_PCI(hostdev), FALSE);
> +
> +hostdev_node = 
> gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(hostdev));
> +g_return_val_if_fail(hostdev_node != NULL, FALSE);
> +
> +rom_node = gvir_config_xml_get_element(hostdev_node, "rom", NULL);
> +if (!rom_node || !(rom_node->children))
> +/* When containain rom node is missing, default value is TRUE for 
> newer Qemu */
> +return TRUE;

"containain" typo

> +
> +bar_str = gvir_config_xml_get_attribute_content(rom_node, "bar");
> +if (g_strcmp0(bar_str, "on"))
> +return TRUE;
> +else
> +return FALSE;

Wouldn't:
bar_str = gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(hostdev), 
"rom", "bar");
return (g_strcmp0(bar_str, "on") == 0)
work too (and be simpler)?

Reviewed-by: Christophe Fergeau <cferg...@redhat.com>

Christophe


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

Re: [libvirt] [PATCHv5 2/5] Add GVirConfigDomainHostdev

2016-07-18 Thread Christophe Fergeau
Please add a gconfig: prefix to the subject line.

Acked-by: Christophe Fergeau <cferg...@redhat.com>

Christophe

On Wed, Jul 06, 2016 at 10:45:52PM +0100, Zeeshan Ali (Khattak) wrote:
> Add API to read and write domain/devices/hostdev nodes. This patch only
> adds the baseclass and hence is not useful on it's own. A more specific
> subclass to represent PCI devices will be added in a following patch.
> ---
>  libvirt-gconfig/Makefile.am|   2 +
>  .../libvirt-gconfig-domain-device-private.h|   3 +
>  libvirt-gconfig/libvirt-gconfig-domain-device.c|   2 +-
>  libvirt-gconfig/libvirt-gconfig-domain-hostdev.c   | 190 
> +
>  libvirt-gconfig/libvirt-gconfig-domain-hostdev.h   |  76 +
>  libvirt-gconfig/libvirt-gconfig.h  |   1 +
>  libvirt-gconfig/libvirt-gconfig.sym|  10 ++
>  7 files changed, 283 insertions(+), 1 deletion(-)
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-hostdev.c
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-hostdev.h
> 
> diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
> index f308539..a7c6c4e 100644
> --- a/libvirt-gconfig/Makefile.am
> +++ b/libvirt-gconfig/Makefile.am
> @@ -50,6 +50,7 @@ GCONFIG_HEADER_FILES = \
>   libvirt-gconfig-domain-graphics-sdl.h \
>   libvirt-gconfig-domain-graphics-spice.h \
>   libvirt-gconfig-domain-graphics-vnc.h \
> + libvirt-gconfig-domain-hostdev.h \
>   libvirt-gconfig-domain-input.h \
>   libvirt-gconfig-domain-interface.h \
>   libvirt-gconfig-domain-interface-bridge.h \
> @@ -141,6 +142,7 @@ GCONFIG_SOURCE_FILES = \
>   libvirt-gconfig-domain-graphics-sdl.c \
>   libvirt-gconfig-domain-graphics-spice.c \
>   libvirt-gconfig-domain-graphics-vnc.c \
> + libvirt-gconfig-domain-hostdev.c \
>   libvirt-gconfig-domain-input.c \
>   libvirt-gconfig-domain-interface.c \
>   libvirt-gconfig-domain-interface-bridge.c \
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device-private.h 
> b/libvirt-gconfig/libvirt-gconfig-domain-device-private.h
> index 062c0e2..c45e1df 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-device-private.h
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-device-private.h
> @@ -43,6 +43,9 @@ GVirConfigDomainDevice *
>  gvir_config_domain_graphics_new_from_tree(GVirConfigXmlDoc *doc,
>xmlNodePtr tree);
>  GVirConfigDomainDevice *
> +gvir_config_domain_hostdev_new_from_tree(GVirConfigXmlDoc *doc,
> + xmlNodePtr tree);
> +GVirConfigDomainDevice *
>  gvir_config_domain_interface_new_from_tree(GVirConfigXmlDoc *doc,
> xmlNodePtr tree);
>  GVirConfigDomainDevice *
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-device.c
> index 3d2b9b3..8a75cea 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-device.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-device.c
> @@ -66,7 +66,7 @@ gvir_config_domain_device_new_from_tree(GVirConfigXmlDoc 
> *doc,
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"lease")) {
>  goto unimplemented;
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"hostdev")) {
> -goto unimplemented;
> +return gvir_config_domain_hostdev_new_from_tree(doc, tree);
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"redirdev")) {
>  type = GVIR_CONFIG_TYPE_DOMAIN_REDIRDEV;
>  } else if (xmlStrEqual(tree->name, (xmlChar*)"smartcard")) {
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-hostdev.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-hostdev.c
> new file mode 100644
> index 000..ce5f8aa
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-hostdev.c
> @@ -0,0 +1,190 @@
> +/*
> + * libvirt-gconfig-domain-hostdev.c: libvirt domain hostdev configuration
> + *
> + * Copyright (C) 2016 Red Hat, Inc.
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or F

Re: [libvirt] [libvirt-glib] gconfig: Add gvir_config_domain_video_get_model()

2016-07-18 Thread Christophe Fergeau
On Thu, Jul 14, 2016 at 02:11:05PM +0100, Zeeshan Ali (Khattak) wrote:
> Add a getter for model of domain video device.
> ---
>  libvirt-gconfig/libvirt-gconfig-domain-video.c | 12 
>  libvirt-gconfig/libvirt-gconfig-domain-video.h |  1 +
>  libvirt-gconfig/libvirt-gconfig.sym|  1 +
>  3 files changed, 14 insertions(+)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-video.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-video.c
> index 64353bd..e38af6f 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-video.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-video.c
> @@ -68,6 +68,18 @@ GVirConfigDomainVideo 
> *gvir_config_domain_video_new_from_xml(const gchar *xml,
>  return GVIR_CONFIG_DOMAIN_VIDEO(object);
>  }
>  
> +GVirConfigDomainVideoModel 
> gvir_config_domain_video_get_model(GVirConfigDomainVideo *video)
> +{
> +g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_VIDEO(video), 
> GVIR_CONFIG_DOMAIN_VIDEO_MODEL_VGA);
> +
> +return gvir_config_object_get_attribute_genum
> +(GVIR_CONFIG_OBJECT(video),

I don't think you need to split these first 2 lines.

Looks good otherwise.

Christophe


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

Re: [libvirt] [PATCH] config: Add listen setter

2016-07-18 Thread Christophe Fergeau
On Thu, Jul 14, 2016 at 06:57:35PM +0100, Zeeshan Ali (Khattak) wrote:
> Oh and when you provide updated patches, please make the subject
> prefix on emails 'gconfig' or 'libvirt-gconfig' so context is very
> clear. You'll want version too so --subject-prefix="gconfig v2" would
> be good.

I usually configure this once and for all for a given repository using
$ git config format.subjectprefix=libvirt-glib

Then I only need to use "git send-email -v2" and I get the right prefix.
with not much typing.

Christophe


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

Re: [libvirt] [PATCH v4 4/6] Add GVirConfigDomainHostdevPci

2016-07-08 Thread Christophe Fergeau
On Wed, Jul 06, 2016 at 10:11:18PM +0100, Zeeshan Ali (Khattak) wrote:
> On Thu, May 12, 2016 at 1:28 PM, Christophe Fergeau <cferg...@redhat.com> 
> wrote:
> > Looks I never answered this one.
> >
> > On Tue, Apr 26, 2016 at 05:04:30PM +0100, Zeeshan Ali (Khattak) wrote:
> >> >> +const gchar 
> >> >> *gvir_config_domain_hostdev_pci_get_rom_file(GVirConfigDomainHostdevPci 
> >> >> *hostdev)
> >> >> +{
> >> >> +return 
> >> >> gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(hostdev), "rom", 
> >> >> "file");
> >> >
> >> >> +}
> >> >> +
> >> >> +gboolean 
> >> >> gvir_config_domain_hostdev_pci_get_rom_bar(GVirConfigDomainHostdevPci 
> >> >> *hostdev)
> >> >> +{
> >> >> +return 
> >> >> gvir_config_object_get_attribute_boolean(GVIR_CONFIG_OBJECT(hostdev),
> >> >> +"rom", "bar", 
> >> >> FALSE);
> >> >
> >> > I'd prefer to handle on/off parsing here rather than moving it to
> >> > get_attribute_boolean().
> >>
> >> Why? Quick look through libvirt XML docs, shows that on/off is used in
> >> other places too.
> >
> > libvirt treats "on"/"off" and "yes"/"no" as different types,
> > virTristateSwitch and virTristateBool.
> 
> Giving them different names don't really make them different. on/off
> and yes/no, both have two states and are essentially booleans.

Yes, but treating them as boolean means it's complicated to do the right
thing when converting them to strings as you cannot guess whether to use
"on"/"off" or "yes"/"no"

> > This patch would treat the 2 as "boolean", and only in the parsing case
> > as it obviously cannot guess what is the right behaviour when converting
> > to string.
> > So I'd rather we don't start to treat both as booleans.
> 
> So you're suggesting that I inline the implementation and not make this 
> generic?

Either that, or introduce an enum type for "on"/"off" and use that ?

Christophe


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

Re: [libvirt] [PATCH v5 1/6] graphics: introduce listen type socket and use it for VNC

2016-05-25 Thread Christophe Fergeau
On Tue, May 24, 2016 at 04:45:53PM +0200, Pavel Hrdina wrote:
> Introduce a new listen type that will be used to tell a graphics device
> to listen on unix socket and use it for VNC graphics instead of socket
> attribute.  The socket attribute will remain in the XML for backward
> compatibility.
> 
> Since old libvirt supports 'socket' attribute inside 'graphics' element
> for socket path provided by user libvirt will generate migratable XML
> without that listen type='socket' but only with 'socket' attribute in
> order to be able to migrate back to old libvirt.
> 
> Signed-off-by: Pavel Hrdina 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 72bfa35..91f41db 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -5349,6 +5349,22 @@ qemu-kvm -net nic,model=? /dev/null
>of the first forward dev will be used.
>  
>
> +  socket since 1.3.5
> +  
> +
> +  This listen type tells a graphics server to listen on unix socket.
> +  Attribute socket contains a path to unix socket. If 
> this
> +  attribute is omitted libvirt will generate this path for you.
> +  Supported by graphics type vnc.
> +
> +
> +  For vnc graphics be backward compatible
> +  the socket attribute of first listen 
> element
> +  is duplicated as socket attribute in 
> graphics
> +  element. If graphics element contains a 
> socket
> +  attribute all listen elements are ignored.
> +
> +  
>  
>  
>  Video devices
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 903fd7e..60f9f52 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -2971,6 +2971,16 @@
>
>  
>
> +  
> +
> +  socket
> +
> +
> +  
> +
> +  
> +
> +  
>  
>
>  

Reiterating an old comment on this new version, but I really think
"type" should be "unix" rather than "socket" for consistency reasons.
Less strong feelings on "socket" VS "path" for the associated attribute
name.

Christophe


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/3] qemu: Make all SPICE command-line args optional

2016-05-17 Thread Christophe Fergeau
On Tue, May 17, 2016 at 08:03:11AM -0400, Cole Robinson wrote:
> On 05/17/2016 06:11 AM, Christophe Fergeau wrote:
> > Hey,
> > 
> > After this patch series, the QEMU command line may not contain port nor
> > tls-port if they both were set to '0'. However, QEMU versions older than
> > 2.3.0 will error out because they don't have this commit:
> > http://git.qemu.org/?p=qemu.git;a=commitdiff;h=cf7856adefebe86e0
> > 
> > I assume we want to keep supporting older QEMU binaries, and that this
> > needs to be fixed on libvirt side?
> 
> Yes we will want to keep older qemu working. However I think Pavel's patches
> address this issue?

Actually as Ján pointed out, older QEMU behaviour before/after these
patches should be unchanged. Only difference is that before QEMU was
always adding port=0/tls-port=0, after the are not present, but QEMU
will default to 0 when they are missing. In both cases (present and set
to 0, and not present and default to 0), we will be getting an error.

I don't think Pavel's patches are going to help there though, but I
don't think that's a problem.

Christophe


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/3] qemu: Make all SPICE command-line args optional

2016-05-17 Thread Christophe Fergeau
On Tue, May 17, 2016 at 02:10:16PM +0200, Ján Tomko wrote:
> On Tue, May 17, 2016 at 12:11:38PM +0200, Christophe Fergeau wrote:
> > Hey,
> > 
> > After this patch series, the QEMU command line may not contain port nor
> > tls-port if they both were set to '0'. However, QEMU versions older than
> > 2.3.0 will error out because they don't have this commit:
> > http://git.qemu.org/?p=qemu.git;a=commitdiff;h=cf7856adefebe86e0
> > 
> 
> From that snippet of code it seems omitting port completely and setting
> it to 0 were equivalent.
> 
> > I assume we want to keep supporting older QEMU binaries, and that this
> > needs to be fixed on libvirt side?
> 
> It seems this never worked with older QEMUs, regardless of this series.

Ah good point, I did not pay enough attention to the commit ;)

Christophe


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

Re: [libvirt] [PATCH v3 00/14] improve graphics listen configuration

2016-05-17 Thread Christophe Fergeau
On Mon, May 16, 2016 at 10:59:47AM -0400, Cole Robinson wrote:
> On 05/13/2016 12:35 PM, Christophe Fergeau wrote:
> > Hey,
> > 
> > Something which I forgot to mention/test when going through the first
> > iteration is virsh domdisplay, it's currently failing with
> > 
> > 
> > I think something like 'spice+unix:///tmp/foo' is expected. This can be
> > addressed as a follow-up to this series though.
> 
> Can you file an upstream bug for this? Just so it doesn't get lost (unless
> it's on your todo list and it will definitely get done)
> 
> http://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Virtualization%20Tools=libvirt

Done, https://bugzilla.redhat.com/show_bug.cgi?id=1336720

Christophe


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/3] qemu: Make all SPICE command-line args optional

2016-05-17 Thread Christophe Fergeau
Hey,

After this patch series, the QEMU command line may not contain port nor
tls-port if they both were set to '0'. However, QEMU versions older than
2.3.0 will error out because they don't have this commit:
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=cf7856adefebe86e0

I assume we want to keep supporting older QEMU binaries, and that this
needs to be fixed on libvirt side?

Christophe


On Wed, Mar 16, 2016 at 05:45:03PM +0100, Christophe Fergeau wrote:
> The end goal is to avoid adding -spice port=0,addr=127.0.0.1 to QEMU command
> line when no SPICE port is specified in libvirt XML.
> 
> Currently, the code relies on port=xx to always be present, so subsequent
> args can be unconditionally appended with a leading ','. Since port=0
> will no longer be added in a subsequent commit, we append a ',' to every
> arg instead of prepending, and remove the last one before adding it to
> the arg list.
> ---
>  src/qemu/qemu_command.c | 68 
> +++--
>  1 file changed, 38 insertions(+), 30 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 32d32b1..cd20a16 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -7030,7 +7030,7 @@ 
> qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
>  }
>  
>  if (port > 0 || tlsPort <= 0)
> -virBufferAsprintf(, "port=%u", port);
> +virBufferAsprintf(, "port=%u,", port);
>  
>  if (tlsPort > 0) {
>  if (!cfg->spiceTLS) {
> @@ -7039,13 +7039,12 @@ 
> qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
>   " but TLS is disabled in qemu.conf"));
>  goto error;
>  }
> -if (port > 0)
> -virBufferAddChar(, ',');
> -virBufferAsprintf(, "tls-port=%u", tlsPort);
> +
> +virBufferAsprintf(, "tls-port=%u,", tlsPort);
>  }
>  
>  if (cfg->spiceSASL) {
> -virBufferAddLit(, ",sasl");
> +virBufferAddLit(, "sasl,");
>  
>  if (cfg->spiceSASLdir)
>  virCommandAddEnvPair(cmd, "SASL_CONF_PATH",
> @@ -7085,17 +7084,17 @@ 
> qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
>  if (!listenAddr)
>  listenAddr = cfg->spiceListen;
>  if (listenAddr)
> -virBufferAsprintf(, ",addr=%s", listenAddr);
> +virBufferAsprintf(, "addr=%s,", listenAddr);
>  
>  VIR_FREE(netAddr);
>  
>  if (graphics->data.spice.mousemode) {
>  switch (graphics->data.spice.mousemode) {
>  case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER:
> -virBufferAddLit(, ",agent-mouse=off");
> +virBufferAddLit(, "agent-mouse=off,");
>  break;
>  case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT:
> -virBufferAddLit(, ",agent-mouse=on");
> +virBufferAddLit(, "agent-mouse=on,");
>  break;
>  default:
>  break;
> @@ -7106,18 +7105,19 @@ 
> qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
>   * making it visible on CLI, so there's no use of password=XXX
>   * in this bit of the code */
>  if (!graphics->data.spice.auth.passwd &&
> -!cfg->spicePassword)
> -virBufferAddLit(, ",disable-ticketing");
> +!cfg->spicePassword) {
> +virBufferAddLit(, "disable-ticketing,");
> +}
>  
>  if (tlsPort > 0)
> -virBufferAsprintf(, ",x509-dir=%s", cfg->spiceTLSx509certdir);
> +virBufferAsprintf(, "x509-dir=%s,", cfg->spiceTLSx509certdir);
>  
>  switch (defaultMode) {
>  case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:
> -virBufferAddLit(, ",tls-channel=default");
> +virBufferAddLit(, "tls-channel=default,");
>  break;
>  case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE:
> -virBufferAddLit(, ",plaintext-channel=default");
> +virBufferAddLit(, "plaintext-channel=default,");
>  break;
>  case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY:
>  /* nothing */
> @@ -7133,7 +7133,7 @@ 
> qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
>   "but TLS port is not provided"));
>  goto error;
>  }
> -virBufferAsprintf(, ",tls-channel=%s",
> +virBufferAsprintf(, "tls-channel=

Re: [libvirt] [PATCH v3 00/14] improve graphics listen configuration

2016-05-13 Thread Christophe Fergeau
Hey,

Something which I forgot to mention/test when going through the first
iteration is virsh domdisplay, it's currently failing with


I think something like 'spice+unix:///tmp/foo' is expected. This can be
addressed as a follow-up to this series though.

Christophe

On Thu, May 12, 2016 at 05:15:44PM +0200, Pavel Hrdina wrote:
> This patch series improves the way how different listen types can be specified
> and also introduce a new listen types for graphics devices.
> 
> First improvement is to move ports out of graphics element into listen element
> with type address or network.  This is a first step to make the code
> listen-driven.
> 
> Second step is to create a new listen type socket to improve the current vnc
> configuration and to print only socket path witout any other listen types.  
> With
> the new socket type now we can add support also to spice graphics.
> 
> The last improvement is to introduce new listen type none for spice and vnc
> graphics to specify that the spice graphics shouldn't listen anywhere by 
> default.
> 
> In case of spice graphics the new listen types socket or none are required to
> start a guest with OpenGL support.
> 
> Changes in v3:
> - add listen type none support for vnc
> - fix issues pointed out in v2
> 
> Changes in v2:
> - don't remove vnc_auto_unix_socket from qemu.conf
> - add spice_auto_unix_socket
> 
> Pavel Hrdina (14):
>   graphics: don't parse listens if socket attribute is present
>   domain_conf: parse listen attribute while parsing listen elements
>   graphics: make address attribute for listen type='address' optional
>   domain_conf: cleanup virDomainGraphicsListenDefParseXML
>   graphics: move port definition to listen element
>   graphics: introduce listen type=socket and use it for VNC
>   qemu_capabilites: add QEMU_CAPS_SPICE_UNIX
>   qemu_command: refactor spice channel code
>   spice: add support for listen type socket
>   qemu_process: separate graphics socket and address generation
>   tests: cleanup vnc auto socket test
>   spice: introduce spice_auto_unix_socket config option
>   spice: introduce listen type none
>   vnc: add support for listen type none
> 
>  docs/formatdomain.html.in  | 141 +++--
>  docs/schemas/domaincommon.rng  |  63 +-
>  src/conf/domain_conf.c | 637 
> ++---
>  src/conf/domain_conf.h |  31 +-
>  src/libvirt_private.syms   |   1 +
>  src/libxl/libxl_conf.c |  53 +-
>  src/libxl/libxl_domain.c   |  17 +-
>  src/qemu/libvirtd_qemu.aug |   1 +
>  src/qemu/qemu.conf |  17 +-
>  src/qemu/qemu_capabilities.c   |   2 +
>  src/qemu/qemu_capabilities.h   |   1 +
>  src/qemu/qemu_command.c| 273 +
>  src/qemu/qemu_conf.c   |   1 +
>  src/qemu/qemu_conf.h   |   1 +
>  src/qemu/qemu_domain.c |  19 +-
>  src/qemu/qemu_hotplug.c|  40 +-
>  src/qemu/qemu_migration.c  |  50 +-
>  src/qemu/qemu_parse_command.c  |  41 +-
>  src/qemu/qemu_process.c| 351 
>  src/qemu/test_libvirtd_qemu.aug.in |   1 +
>  src/security/virt-aa-helper.c  |  15 +-
>  src/vbox/vbox_common.c |  30 +-
>  src/vbox/vbox_tmpl.c   |  34 +-
>  src/vbox/vbox_uniformed_api.h  |   4 +-
>  src/vmx/vmx.c  |  54 +-
>  src/vz/vz_sdk.c|  30 +-
>  src/xenconfig/xen_common.c |  75 ++-
>  src/xenconfig/xen_sxpr.c   |  71 +--
>  src/xenconfig/xen_xl.c |  45 +-
>  .../generic-graphics-listen-back-compat-ports.xml  |  30 +
>  ...generic-graphics-vnc-listen-element-minimal.xml |   2 +-
>  ...aphics-vnc-listen-element-with-address-port.xml |  30 +
>  ...ric-graphics-vnc-socket-attr-listen-address.xml |  30 +
>  ...hics-vnc-socket-attr-listen-socket-mismatch.xml |  30 +
>  ...eric-graphics-vnc-socket-attr-listen-socket.xml |  30 +
>  .../generic-graphics-listen-back-compat-ports.xml  |  30 +
>  .../generic-graphics-listen-back-compat.xml|   2 +-
>  .../generic-graphics-vnc-listen-attr-only.xml  |   2 +-
>  ...generic-graphics-vnc-listen-element-minimal.xml |   4 +-
>  ...aphics-vnc-listen-element-with-address-port.xml |  30 +
>  ...ic-graphics-vnc-listen-element-with-address.xml |   2 +-
>  .../generic-graphics-vnc-manual-port.xml   |   4 +-
>  .../generic-graphics-vnc-minimal.xml   |   4 +-
>  ...ric-graphics-vnc-socket-attr-listen-address.xml |  30 +
>  

Re: [libvirt] [PATCH v4 4/6] Add GVirConfigDomainHostdevPci

2016-05-12 Thread Christophe Fergeau
Looks I never answered this one.

On Tue, Apr 26, 2016 at 05:04:30PM +0100, Zeeshan Ali (Khattak) wrote:
> >> +const gchar 
> >> *gvir_config_domain_hostdev_pci_get_rom_file(GVirConfigDomainHostdevPci 
> >> *hostdev)
> >> +{
> >> +return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(hostdev), 
> >> "rom", "file");
> >
> >> +}
> >> +
> >> +gboolean 
> >> gvir_config_domain_hostdev_pci_get_rom_bar(GVirConfigDomainHostdevPci 
> >> *hostdev)
> >> +{
> >> +return 
> >> gvir_config_object_get_attribute_boolean(GVIR_CONFIG_OBJECT(hostdev),
> >> +"rom", "bar", FALSE);
> >
> > I'd prefer to handle on/off parsing here rather than moving it to
> > get_attribute_boolean().
> 
> Why? Quick look through libvirt XML docs, shows that on/off is used in
> other places too.

libvirt treats "on"/"off" and "yes"/"no" as different types,
virTristateSwitch and virTristateBool.
This patch would treat the 2 as "boolean", and only in the parsing case
as it obviously cannot guess what is the right behaviour when converting
to string.
So I'd rather we don't start to treat both as booleans.

> 
> > I don't know whether we should return TRUE or
> > FALSE as the default value as this depends on the QEMU version :(
> > "If no rom bar is specified, the qemu default will be used (older
> > versions of qemu used a default of "off", while newer qemus have a
> > default of "on")"
> 
> Maybe we can go with newer behaviour depending on whether or not rom
> file is set and leave a comment here about this?

I'm not sure these 2 attributes are related this way. We probably can
return the default used for new QEMU versions, and tweak it when needed.

Christophe


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 12/12] spice: introduce listen type none

2016-05-12 Thread Christophe Fergeau
On Wed, May 11, 2016 at 05:08:31PM +0200, Pavel Hrdina wrote:
> This new listen type is currently supported only by spice graphics.
> It's introduced to make it easier and clearer specify to not listen
> anywhere in order to start a guest with OpenGL support.
> 
> The old way to do this was set spice graphics autoport='no' and don't
> specify any ports.  The new way is to use .  In
> order to be able to migrate to old libvirt the migratable XML will be
> generated without the listen element and with autoport='no'.




> +/* If spice graphics is configured without ports and with autoport='no' 
> then
> + * we start qemu with Spice to not listen anywhere.  Let's convert this
> + * configuration to the new listen type='none' which does the same. */
> +if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
> +glisten = >listens[0];
> +
> +if (glisten->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS &&
> +glisten->port == 0 && glisten->tlsPort == 0 && 
> !glisten->autoport) {
> +VIR_FREE(glisten->address);
> +glisten->type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE;
> +}
> +}
> +

Ah I assume this means libvirt is not going to error out when it finds
configurations without ports and with autoport='no'? Maybe worth
mentioning this in the commit log as it mentions the legacy behaviour,
but I was not clear on how it would behave when encountering it.

Christophe


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 12/12] spice: introduce listen type none

2016-05-12 Thread Christophe Fergeau
On Thu, May 12, 2016 at 08:43:38AM +0200, Pavel Hrdina wrote:
> > > @@ -21630,8 +21661,6 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
> > >  }
> > >
> > >  for (i = 0; i < def->nListens; i++) {
> > > -if (def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE)
> > > -continue;
> > >  if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) {
> > >  if (def->listens[i].fromConfig)
> > >  continue;
> > > @@ -21644,6 +21673,13 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
> > >  def->listens[i].type == 
> > > VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET &&
> > >  !def->listens[i].autogenerated)
> > >  continue;
> > > +
> > > +/* The new listen type none is in the migratable XML 
> > > represented as
> > > + * port=0 and autoport=no because old libvirt support this
> > > + * configuration for spice. */
> > > +if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
> > > +def->listens[i].type == 
> > > VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE)
> > > +continue;
> > >  }
> > >  if (!children) {
> > >  virBufferAddLit(buf, ">\n");
> > > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> > > index b911076..64b383d 100644
> > > --- a/src/qemu/qemu_command.c
> > > +++ b/src/qemu/qemu_command.c
> > > @@ -7635,6 +7635,9 @@ 
> > > qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
> > >  break;
> > >
> > >  case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
> > > +/* QEMU requires either port or tls-port to be specified */
> > > +virBufferAddLit(, "port=0,");
> > 
> > Does it?
> > qemu-system-x86_64 -spice gl=on starts fine. It needs at least an
> > argument though (that looks like a bug)
> 
> qemu doesn't allow to start if there is spice without arguments.  So in case
> that there isn't anything else to add, like the gl=on we need to add port=0

The comment which was used previously was probably more explicit than
the new one:
/* If we did not add any SPICE arguments, add a dummy 'port=0' one
 * as -spice alone is not allowed on QEMU command line
 */
QEMU does not care which argument is there after -spice, port/tls-port
are good to use for that purpose as if they are set to 0 they will be ignored.

Christophe


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 11/12] spice: introduce spice_auto_unix_socket config option

2016-05-12 Thread Christophe Fergeau
On Wed, May 11, 2016 at 05:08:30PM +0200, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina 
> ---
>  src/qemu/qemu.conf | 11 +++
>  src/qemu/qemu_conf.c   |  1 +
>  src/qemu/qemu_conf.h   |  1 +
>  src/qemu/qemu_process.c|  4 +++
>  ...emuxml2argv-graphics-spice-auto-socket-cfg.args | 20 +
>  ...qemuxml2argv-graphics-spice-auto-socket-cfg.xml | 30 +++
>  tests/qemuxml2argvtest.c   |  5 
>  ...muxml2xmlout-graphics-spice-auto-socket-cfg.xml | 35 
> ++
>  tests/qemuxml2xmltest.c|  4 +++
>  9 files changed, 111 insertions(+)
>  create mode 100644 
> tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args
>  create mode 100644 
> tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.xml
>  create mode 100644 
> tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket-cfg.xml
> 
> diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
> index 4fa5e8a..baf0b00 100644
> --- a/src/qemu/qemu.conf
> +++ b/src/qemu/qemu.conf
> @@ -130,6 +130,17 @@
>  #spice_tls_x509_cert_dir = "/etc/pki/libvirt-spice"
>  
>  
> +# Enable this option to have SPICE served over an automatically created
> +# unix socket. This prevents unprivileged access from users on the
> +# host machine, though most SPICE clients do not support it.
> +#
> +# This will only be enabled for SPICE configurations that do not have
> +# a hardcoded 'listen' or 'socket' value. This setting takes preference

I think the "hardcoded 'listen' or 'socket' value" should be rephrased
to refer to  nodes instead.

Christophe


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 05/12] graphics: move port definition to listen element

2016-05-12 Thread Christophe Fergeau
On Wed, May 11, 2016 at 05:08:24PM +0200, Pavel Hrdina wrote:
> So far we have only two listen types that supports only address:port
> method, but in the future we may want to add a new different listen
> type, for example socket.
> 
> This patch moves the ports values out of graphics unions into listen
> element.  The domain XML will now duplicate the ports from first listen
> element into the graphics element as we do also for address.
> 
> This allows us to make part of the graphics code as listen-driven and
> prepare the code for new listen types.
> 
> To support migration back to older versions the new attributes from
> listen elements are not written into migratable XML.

This patch keeps the port=-1 legacy syntax in the  element,
shouln't we use this as an opportunity to drop it? Or is it making the
code much more complicated to handle 'port'/'tlsPort' differently in
 nodes?

> 
> Signed-off-by: Pavel Hrdina 
> ---
>  docs/formatdomain.html.in  |  87 +++--
>  docs/schemas/domaincommon.rng  |  40 +++
>  src/conf/domain_conf.c | 349 
> -
>  src/conf/domain_conf.h |  23 +-
>  src/libxl/libxl_conf.c |  53 ++--
>  src/libxl/libxl_domain.c   |  17 +-
>  src/qemu/qemu_command.c| 167 +-
>  src/qemu/qemu_hotplug.c|  31 +-
>  src/qemu/qemu_migration.c  |  14 +-
>  src/qemu/qemu_parse_command.c  |  39 ++-
>  src/qemu/qemu_process.c| 257 ---
>  src/vbox/vbox_common.c |  26 +-
>  src/vbox/vbox_tmpl.c   |  34 +-
>  src/vbox/vbox_uniformed_api.h  |   4 +-
>  src/vmx/vmx.c  |  52 +--
>  src/vz/vz_sdk.c|  30 +-
>  src/xenconfig/xen_common.c |  67 ++--
>  src/xenconfig/xen_sxpr.c   |  69 ++--
>  src/xenconfig/xen_xl.c |  44 +--
>  .../generic-graphics-listen-back-compat-ports.xml  |  30 ++
>  ...generic-graphics-vnc-listen-element-minimal.xml |   2 +-
>  ...aphics-vnc-listen-element-with-address-port.xml |  30 ++
>  .../generic-graphics-listen-back-compat-ports.xml  |  30 ++
>  .../generic-graphics-listen-back-compat.xml|   2 +-
>  .../generic-graphics-vnc-listen-attr-only.xml  |   2 +-
>  ...generic-graphics-vnc-listen-element-minimal.xml |   4 +-
>  ...aphics-vnc-listen-element-with-address-port.xml |  30 ++
>  ...ic-graphics-vnc-listen-element-with-address.xml |   2 +-
>  .../generic-graphics-vnc-manual-port.xml   |   2 +-
>  .../generic-graphics-vnc-minimal.xml   |   2 +-
>  tests/genericxml2xmltest.c |   3 +
>  .../qemuargv2xml-graphics-vnc-policy.xml   |   2 +-
>  .../qemuargv2xml-graphics-vnc-sasl.xml |   2 +-
>  .../qemuargv2xml-graphics-vnc-tls.xml  |   2 +-
>  .../qemuargv2xml-graphics-vnc-websocket.xml|   2 +-
>  .../qemuargv2xmldata/qemuargv2xml-graphics-vnc.xml |   2 +-
>  ...qemuhotplug-console-compat-2+console-virtio.xml |   2 +-
>  .../qemuxml2argv-console-compat-2.xml  |   2 +-
>  .../qemuxml2xmlout-graphics-listen-network.xml |   2 +-
>  .../qemuxml2xmlout-graphics-listen-network2.xml|   4 +-
>  .../qemuxml2xmlout-graphics-spice-compression.xml  |   2 +-
>  .../qemuxml2xmlout-graphics-spice-qxl-vga.xml  |   2 +-
>  .../qemuxml2xmlout-graphics-spice-timeout.xml  |   2 +-
>  .../qemuxml2xmlout-graphics-spice.xml  |   2 +-
>  .../qemuxml2xmlout-graphics-vnc-autosocket.xml |   2 +-
>  .../qemuxml2xmlout-graphics-vnc-no-listen-attr.xml |   2 +-
>  .../qemuxml2xmlout-graphics-vnc-sasl.xml   |   2 +-
>  .../qemuxml2xmlout-graphics-vnc-tls.xml|   2 +-
>  .../qemuxml2xmlout-graphics-vnc-websocket.xml  |   2 +-
>  .../qemuxml2xmlout-graphics-vnc.xml|   2 +-
>  .../qemuxml2xmlout-interface-server.xml|   2 +-
>  .../qemuxml2xmlout-net-bandwidth.xml   |   2 +-
>  .../qemuxml2xmlout-net-bandwidth2.xml  |   2 +-
>  .../qemuxml2xmlout-pci-bridge.xml  |   2 +-
>  ...emuxml2xmlout-seclabel-dynamic-none-relabel.xml |   2 +-
>  .../qemuxml2xmlout-serial-spiceport.xml|   2 +-
>  .../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml   |   2 +-
>  tests/sexpr2xmldata/sexpr2xml-curmem.xml   |   2 +-
>  tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml  |   2 +-
>  tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml  |   2 +-
>  tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml|   2 +-
>  tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml  |   2 +-
>  tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml |   2 +-
>  

Re: [libvirt] [PATCH v2 08/12] spice: add support for listen type socket

2016-05-12 Thread Christophe Fergeau
Hey,

On Wed, May 11, 2016 at 05:08:27PM +0200, Pavel Hrdina wrote:
> @@ -7665,40 +7694,12 @@ 
> qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
>  break;
>  
>  case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE:
> -if (glisten->port <= 0) {
> -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -   _("spice insecure channels set in XML "
> - "configuration, but plain port is not 
> provided"));
> -goto error;
> -}
>  virBufferAsprintf(, "plaintext-channel=%s,",
>
> virDomainGraphicsSpiceChannelNameTypeToString(i));
>  break;
>  
>  case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY:
> -switch (defaultMode) {
> -case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:
> -if (glisten->tlsPort <= 0) {
> -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -   _("spice defaultMode secure requested in 
> XML "
> - "configuration but TLS port not 
> provided"));
> -goto error;
> -}
> -break;
> -
> -case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE:
> -if (glisten->port <= 0) {
> -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -   _("spice defaultMode insecure requested 
> in XML "
> - "configuration but plain port not 
> provided"));
> -goto error;
> -}
> -break;
> -
> -case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY:
> -/* don't care */
>  break;
> -}
>  }
>  }

Didn't we lose the error when asking for plaintext channels without
setting a non-secure port?

Christophe


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 06/12] graphics: introduce listen type=socket and use it for VNC

2016-05-12 Thread Christophe Fergeau
Hey,

On Wed, May 11, 2016 at 05:08:25PM +0200, Pavel Hrdina wrote:
> Introduce a new listen type that will be used to tell a graphics device
> to listen on unix socket and use it for VNC graphics instead of socket
> attribute.  The socket attribute will remain in the XML for backward
> compatibility.
> 
> Since old libvirt supports 'socket' attribute inside 'graphics' element
> for socket path provided by user libvirt will generate migratable XML
> without that listen type='socket' but only with 'socket' attribute in
> order to be able to migrate back to old libvirt.
> 
> Signed-off-by: Pavel Hrdina 
> ---
>  docs/formatdomain.html.in  |  16 +++
>  docs/schemas/domaincommon.rng  |  10 ++
>  src/conf/domain_conf.c | 119 
> -
>  src/conf/domain_conf.h |   8 +-
>  src/libvirt_private.syms   |   1 +
>  src/qemu/qemu_command.c|  45 
>  src/qemu/qemu_domain.c |  19 ++--
>  src/qemu/qemu_hotplug.c|   9 ++
>  src/qemu/qemu_parse_command.c  |   2 +-
>  src/qemu/qemu_process.c|  47 ++--
>  src/security/virt-aa-helper.c  |  15 ++-
>  .../generic-graphics-vnc-socket-listen.xml |   4 +-
>  .../generic-graphics-vnc-socket.xml|   4 +-
>  .../qemuargv2xml-graphics-vnc-socket.xml   |   4 +-
>  .../qemuxml2argv-graphics-vnc-auto-socket.args |  20 
>  .../qemuxml2argv-graphics-vnc-auto-socket.xml  |  30 ++
>  .../qemuxml2argv-graphics-vnc-socket.args  |   4 +-
>  .../qemuxml2argv-graphics-vnc-socket.xml   |  10 +-
>  tests/qemuxml2argvtest.c   |   2 +
>  .../qemuxml2xmlout-graphics-vnc-auto-socket.xml|  35 ++
>  .../qemuxml2xmlout-graphics-vnc-autosocket.xml |   4 +-
>  .../qemuxml2xmlout-graphics-vnc-socket.xml |  35 ++
>  tests/qemuxml2xmltest.c|   2 +
>  23 files changed, 361 insertions(+), 84 deletions(-)
>  create mode 100644 
> tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.args
>  create mode 100644 
> tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.xml
>  create mode 100644 
> tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket.xml
>  create mode 100644 
> tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-socket.xml
> 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index b0847b7..f67076d 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -5359,6 +5359,22 @@ qemu-kvm -net nic,model=? /dev/null
>address.
>  
>
> +  socket since 1.3.5
> +  
> +
> +  This listen type tells a graphics server to listen on unix socket.
> +  Attribute socket contains a path to unix socket. If 
> this
> +  attribute is omitted libvirt will generate this path for you.
> +  Supported by graphics type vnc.
> +
> +
> +  For vnc graphics be backward compatible
> +  the socket attribute of first listen 
> element
> +  is duplicated as socket attribute in 
> graphics
> +  element. If graphics element contains a 
> socket
> +  attribute all listen elements are ignored.
> +


If both a socket attribute and a listen type="socket" node are present,
shouldn't this check if they are using the same path? This is what is
done for 'listen' attribute and listen type="address", but I could not
find the same thing in this patch.

> +  
>  
>  
>  Video devices
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index e7eda77..e3dbcc6 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -3014,6 +3014,16 @@
>
>  
>
> +  
> +
> +  socket
> +
> +
> +  
> +
> +  
> +
> +  

Imo this would be better as 


This would be more consistent with /disk/source/host
vhost-user also uses type="unix" but with a path attribute rather than
socket
There is also  (again with 'path' rather than
'socket').

Christophe


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

[libvirt] [PATCH] schemas: Improve outdated comment

2016-05-12 Thread Christophe Fergeau
---
 docs/schemas/domaincommon.rng | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 273715c..8798001 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2622,10 +2622,7 @@
 
   
   
   
 
-- 
2.7.4

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


Re: [libvirt] [PATCH v4 6/6] Add test for GVirConfigDomainHostdevPci API

2016-04-26 Thread Christophe Fergeau
On Tue, Apr 26, 2016 at 04:47:58PM +0100, Zeeshan Ali (Khattak) wrote:
> On Thu, Apr 21, 2016 at 3:14 PM, Christophe Fergeau <cferg...@redhat.com> 
> wrote:
> > And one more.
> 
> Yours? AFAIK it's mine.

Yes, you're right, sorry, I was too eager to get to the end of that
series ;)

Acked-by: Christophe Fergeau <cferg...@redhat.com>

> 
> > On Fri, Apr 15, 2016 at 02:38:24PM +0100, Zeeshan Ali (Khattak) wrote:
> >> ---
> >>  tests/test-gconfig.c| 43 
> >> +
> >>  tests/xml/gconfig-domain-device-pci-hostdev.xml | 11 +++
> >>  2 files changed, 54 insertions(+)
> >>  create mode 100644 tests/xml/gconfig-domain-device-pci-hostdev.xml
> >>
> >> diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
> >> index be55ef9..a26bb5f 100644
> >> --- a/tests/test-gconfig.c
> >> +++ b/tests/test-gconfig.c
> >> @@ -709,6 +709,47 @@ static void test_domain_device_usb_redir(void)
> >>  g_object_unref(G_OBJECT(domain));
> >>  }
> >>
> >> +static void test_domain_device_pci_hostdev(void)
> >> +{
> >> +GVirConfigDomain *domain;
> >> +GVirConfigDomainAddressPci *address;
> >> +GVirConfigDomainHostdevPci *hostdev;
> >> +
> >> +domain = gvir_config_domain_new();
> >> +
> >> +hostdev = gvir_config_domain_hostdev_pci_new();
> >> +
> >> gvir_config_domain_hostdev_set_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev),
> >>  1);
> >> +
> >> g_assert_cmpint(gvir_config_domain_hostdev_get_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev)),
> >>  ==, 1);
> >> +gvir_config_domain_hostdev_pci_set_managed(hostdev, TRUE);
> >> +g_assert(gvir_config_domain_hostdev_pci_get_managed(hostdev) == TRUE);
> >> +gvir_config_domain_hostdev_pci_set_rom_bar(hostdev, TRUE);
> >> +gvir_config_domain_hostdev_pci_set_rom_file(hostdev, 
> >> "/etc/fake/boot.bin");
> >> +g_assert_cmpstr(gvir_config_domain_hostdev_pci_get_rom_file(hostdev), 
> >> ==, "/etc/fake/boot.bin");
> >> +g_assert(gvir_config_domain_hostdev_pci_get_rom_bar(hostdev));
> >> +
> >> +address = gvir_config_domain_address_pci_new();
> >> +gvir_config_domain_address_pci_set_domain(address, 1);
> >> +gvir_config_domain_address_pci_set_bus(address, 2);
> >> +gvir_config_domain_address_pci_set_slot(address, 3);
> >> +gvir_config_domain_address_pci_set_function(address, 4);
> >> +gvir_config_domain_hostdev_pci_set_address(hostdev, address);
> >> +g_object_unref(G_OBJECT(address));
> >> +
> >> +address = gvir_config_domain_hostdev_pci_get_address(hostdev);
> >> +g_assert(address != NULL);
> >> +g_assert_cmpint(gvir_config_domain_address_pci_get_domain(address), 
> >> ==, 1);
> >> +g_assert_cmpint(gvir_config_domain_address_pci_get_bus(address), ==, 
> >> 2);
> >> +g_assert_cmpint(gvir_config_domain_address_pci_get_slot(address), ==, 
> >> 3);
> >> +g_assert_cmpint(gvir_config_domain_address_pci_get_function(address), 
> >> ==, 4);
> >> +g_object_unref(G_OBJECT(address));
> >> +
> >> +gvir_config_domain_add_device(domain, GVIR_CONFIG_DOMAIN_DEVICE 
> >> (hostdev));
> >> +g_object_unref(G_OBJECT(hostdev));
> >> +
> >> +check_xml(domain, "gconfig-domain-device-pci-hostdev.xml");
> >> +
> >> +g_object_unref(G_OBJECT(domain));
> >> +}
> >>
> >>  int main(int argc, char **argv)
> >>  {
> >> @@ -739,6 +780,8 @@ int main(int argc, char **argv)
> >>  test_domain_device_channel);
> >>  g_test_add_func("/libvirt-gconfig/domain-device-usb-redir",
> >>  test_domain_device_usb_redir);
> >> +g_test_add_func("/libvirt-gconfig/domain-device-pci-hostdev",
> >> +test_domain_device_pci_hostdev);
> >>
> >>  return g_test_run();
> >>  }
> >> diff --git a/tests/xml/gconfig-domain-device-pci-hostdev.xml 
> >> b/tests/xml/gconfig-domain-device-pci-hostdev.xml
> >> new file mode 100644
> >> index 000..70e32ac
> >> --- /dev/null
> >> +++ b/tests/xml/gconfig-domain-device-pci-hostdev.xml
> >> @@ -0,0 +1,11 @@
> >> +
> >> +  
> >> +
> >> +  
> >> +  
> >> +  
> >> +
> >> +  
> >> +
> >> +  
> >> +
> >> --
> >> 2.5.5
> >>
> >> --
> >> libvir-list mailing list
> >> libvir-list@redhat.com
> >> https://www.redhat.com/mailman/listinfo/libvir-list
> 
> 
> 
> -- 
> Regards,
> 
> Zeeshan Ali (Khattak)
> 
> --
> 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

Re: [libvirt] [PATCH v4 6/6] Add test for GVirConfigDomainHostdevPci API

2016-04-21 Thread Christophe Fergeau
And one more.

On Fri, Apr 15, 2016 at 02:38:24PM +0100, Zeeshan Ali (Khattak) wrote:
> ---
>  tests/test-gconfig.c| 43 
> +
>  tests/xml/gconfig-domain-device-pci-hostdev.xml | 11 +++
>  2 files changed, 54 insertions(+)
>  create mode 100644 tests/xml/gconfig-domain-device-pci-hostdev.xml
> 
> diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c
> index be55ef9..a26bb5f 100644
> --- a/tests/test-gconfig.c
> +++ b/tests/test-gconfig.c
> @@ -709,6 +709,47 @@ static void test_domain_device_usb_redir(void)
>  g_object_unref(G_OBJECT(domain));
>  }
>  
> +static void test_domain_device_pci_hostdev(void)
> +{
> +GVirConfigDomain *domain;
> +GVirConfigDomainAddressPci *address;
> +GVirConfigDomainHostdevPci *hostdev;
> +
> +domain = gvir_config_domain_new();
> +
> +hostdev = gvir_config_domain_hostdev_pci_new();
> +
> gvir_config_domain_hostdev_set_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev),
>  1);
> +
> g_assert_cmpint(gvir_config_domain_hostdev_get_boot_order(GVIR_CONFIG_DOMAIN_HOSTDEV(hostdev)),
>  ==, 1);
> +gvir_config_domain_hostdev_pci_set_managed(hostdev, TRUE);
> +g_assert(gvir_config_domain_hostdev_pci_get_managed(hostdev) == TRUE);
> +gvir_config_domain_hostdev_pci_set_rom_bar(hostdev, TRUE);
> +gvir_config_domain_hostdev_pci_set_rom_file(hostdev, 
> "/etc/fake/boot.bin");
> +g_assert_cmpstr(gvir_config_domain_hostdev_pci_get_rom_file(hostdev), 
> ==, "/etc/fake/boot.bin");
> +g_assert(gvir_config_domain_hostdev_pci_get_rom_bar(hostdev));
> +
> +address = gvir_config_domain_address_pci_new();
> +gvir_config_domain_address_pci_set_domain(address, 1);
> +gvir_config_domain_address_pci_set_bus(address, 2);
> +gvir_config_domain_address_pci_set_slot(address, 3);
> +gvir_config_domain_address_pci_set_function(address, 4);
> +gvir_config_domain_hostdev_pci_set_address(hostdev, address);
> +g_object_unref(G_OBJECT(address));
> +
> +address = gvir_config_domain_hostdev_pci_get_address(hostdev);
> +g_assert(address != NULL);
> +g_assert_cmpint(gvir_config_domain_address_pci_get_domain(address), ==, 
> 1);
> +g_assert_cmpint(gvir_config_domain_address_pci_get_bus(address), ==, 2);
> +g_assert_cmpint(gvir_config_domain_address_pci_get_slot(address), ==, 3);
> +g_assert_cmpint(gvir_config_domain_address_pci_get_function(address), 
> ==, 4);
> +g_object_unref(G_OBJECT(address));
> +
> +gvir_config_domain_add_device(domain, GVIR_CONFIG_DOMAIN_DEVICE 
> (hostdev));
> +g_object_unref(G_OBJECT(hostdev));
> +
> +check_xml(domain, "gconfig-domain-device-pci-hostdev.xml");
> +
> +g_object_unref(G_OBJECT(domain));
> +}
>  
>  int main(int argc, char **argv)
>  {
> @@ -739,6 +780,8 @@ int main(int argc, char **argv)
>  test_domain_device_channel);
>  g_test_add_func("/libvirt-gconfig/domain-device-usb-redir",
>  test_domain_device_usb_redir);
> +g_test_add_func("/libvirt-gconfig/domain-device-pci-hostdev",
> +test_domain_device_pci_hostdev);
>  
>  return g_test_run();
>  }
> diff --git a/tests/xml/gconfig-domain-device-pci-hostdev.xml 
> b/tests/xml/gconfig-domain-device-pci-hostdev.xml
> new file mode 100644
> index 000..70e32ac
> --- /dev/null
> +++ b/tests/xml/gconfig-domain-device-pci-hostdev.xml
> @@ -0,0 +1,11 @@
> +
> +  
> +
> +  
> +  
> +  
> +
> +  
> +
> +  
> +
> -- 
> 2.5.5
> 
> --
> 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

Re: [libvirt] [PATCH v4 4/6] Add GVirConfigDomainHostdevPci

2016-04-21 Thread Christophe Fergeau
On Fri, Apr 15, 2016 at 02:38:22PM +0100, Zeeshan Ali (Khattak) wrote:
> Add API to read and write PCI hostdev nodes.
> ---
>  libvirt-gconfig/Makefile.am|   2 +
>  .../libvirt-gconfig-domain-hostdev-pci.c   | 210 
> +
>  .../libvirt-gconfig-domain-hostdev-pci.h   |  81 
>  libvirt-gconfig/libvirt-gconfig-domain-hostdev.c   |   2 +-
>  libvirt-gconfig/libvirt-gconfig.h  |   1 +
>  libvirt-gconfig/libvirt-gconfig.sym|  11 ++
>  6 files changed, 306 insertions(+), 1 deletion(-)
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-hostdev-pci.c
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-hostdev-pci.h
> 
> diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
> index a7c6c4e..0400343 100644
> --- a/libvirt-gconfig/Makefile.am
> +++ b/libvirt-gconfig/Makefile.am
> @@ -51,6 +51,7 @@ GCONFIG_HEADER_FILES = \
>   libvirt-gconfig-domain-graphics-spice.h \
>   libvirt-gconfig-domain-graphics-vnc.h \
>   libvirt-gconfig-domain-hostdev.h \
> + libvirt-gconfig-domain-hostdev-pci.h \
>   libvirt-gconfig-domain-input.h \
>   libvirt-gconfig-domain-interface.h \
>   libvirt-gconfig-domain-interface-bridge.h \
> @@ -143,6 +144,7 @@ GCONFIG_SOURCE_FILES = \
>   libvirt-gconfig-domain-graphics-spice.c \
>   libvirt-gconfig-domain-graphics-vnc.c \
>   libvirt-gconfig-domain-hostdev.c \
> + libvirt-gconfig-domain-hostdev-pci.c \
>   libvirt-gconfig-domain-input.c \
>   libvirt-gconfig-domain-interface.c \
>   libvirt-gconfig-domain-interface-bridge.c \
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-hostdev-pci.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-hostdev-pci.c
> new file mode 100644
> index 000..04e3da9
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-hostdev-pci.c
> @@ -0,0 +1,210 @@
> +/*
> + * libvirt-gconfig-domain-hostdev.c: libvirt domain hostdev configuration
> + *
> + * Copyright (C) 2016 Red Hat, Inc.
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library. If not, see
> + * <http://www.gnu.org/licenses/>.
> + *
> + * Authors: Zeeshan Ali (Khattak) <zeesha...@gnome.org>
> + *  Christophe Fergeau <cferg...@redhat.com>
> + */
> +
> +#include 
> +
> +#include "libvirt-gconfig/libvirt-gconfig.h"
> +#include "libvirt-gconfig/libvirt-gconfig-private.h"
> +
> +#define GVIR_CONFIG_DOMAIN_HOSTDEV_PCI_GET_PRIVATE(obj)  
>\
> +(G_TYPE_INSTANCE_GET_PRIVATE((obj), 
> GVIR_CONFIG_TYPE_DOMAIN_HOSTDEV_PCI, GVirConfigDomainHostdevPciPrivate))
> +
> +struct _GVirConfigDomainHostdevPciPrivate
> +{
> +gboolean unused;
> +};
> +
> +G_DEFINE_TYPE(GVirConfigDomainHostdevPci, gvir_config_domain_hostdev_pci, 
> GVIR_CONFIG_TYPE_DOMAIN_HOSTDEV);
> +
> +static void 
> gvir_config_domain_hostdev_pci_class_init(GVirConfigDomainHostdevPciClass 
> *klass)
> +{
> +g_type_class_add_private(klass, 
> sizeof(GVirConfigDomainHostdevPciPrivate));
> +}
> +
> +
> +static void gvir_config_domain_hostdev_pci_init(GVirConfigDomainHostdevPci 
> *hostdev)
> +{
> +hostdev->priv = GVIR_CONFIG_DOMAIN_HOSTDEV_PCI_GET_PRIVATE(hostdev);
> +}
> +
> +/**
> + * gvir_config_domain_hostdev_pci_new:
> + *
> + * Creates a new #GVirConfigDomainHostdevPci.
> + *
> + * Returns:(transfer full): a new #GVirConfigDomainHostdevPci. The returned
> + * object should be unreffed with g_object_unref() when no longer needed.
> + */
> +GVirConfigDomainHostdevPci *gvir_config_domain_hostdev_pci_new(void)
> +{
> +GVirConfigObject *object;
> +
> +object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_HOSTDEV_PCI,
> +"hostdev", NULL);
> +gvir_confi

Re: [libvirt] [PATCH v4 3/6] libvirt-gconfig: Accept on/off as boolean attributes

2016-04-21 Thread Christophe Fergeau
On Fri, Apr 15, 2016 at 02:38:21PM +0100, Zeeshan Ali (Khattak) wrote:
> gvir_config_object_get_attribute_boolean() currently only accepts yes/no
> as boolean attribute values. Let's also accept on/off as valid values
> too.

As said in 4/6, I prefer to have the "on"/"off" check in the getter
rather than here.

Christophe

> 
> This will come handy in a following patch that adds 'hostdev' handling
> API.
> ---
>  libvirt-gconfig/libvirt-gconfig-object.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-object.c 
> b/libvirt-gconfig/libvirt-gconfig-object.c
> index 6225de2..f44cc4c 100644
> --- a/libvirt-gconfig/libvirt-gconfig-object.c
> +++ b/libvirt-gconfig/libvirt-gconfig-object.c
> @@ -690,9 +690,9 @@ gvir_config_object_get_attribute_boolean(GVirConfigObject 
> *object,
>  const char *str;
>  
>  str = gvir_config_object_get_attribute(object, node_name, attr_name);
> -if (g_strcmp0(str, "yes") == 0) {
> +if (g_strcmp0(str, "yes") == 0 || g_strcmp0(str, "on") == 0) {
>  return TRUE;
> -} else if (g_strcmp0(str, "no") == 0) {
> +} else if (g_strcmp0(str, "no") == 0 || g_strcmp0(str, "off") == 0) {
>  return FALSE;
>  } else {
>  return default_value;
> -- 
> 2.5.5
> 
> --
> 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

Re: [libvirt] [PATCH v4 5/6] gconfig: Add GVirConfigDomainAddressPci getters

2016-04-21 Thread Christophe Fergeau
Another patch that I wrote... 

Christophe

On Fri, Apr 15, 2016 at 02:38:23PM +0100, Zeeshan Ali (Khattak) wrote:
> From: Christophe Fergeau <cferg...@redhat.com>
> 
> They will be useful to do more checks in the GVirDomainDeviceHostdev
> unit test.
> ---
>  .../libvirt-gconfig-domain-address-pci.c   | 45 
> ++
>  .../libvirt-gconfig-domain-address-pci.h   |  5 +++
>  libvirt-gconfig/libvirt-gconfig.sym|  6 +++
>  3 files changed, 56 insertions(+)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-address-pci.c 
> b/libvirt-gconfig/libvirt-gconfig-domain-address-pci.c
> index 4bf94cc..0105402 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-address-pci.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-address-pci.c
> @@ -92,30 +92,75 @@ static void set_attribute_hex(GVirConfigDomainAddressPci 
> *address,
>  g_free(format);
>  }
>  
> +int gvir_config_domain_address_pci_get_domain(GVirConfigDomainAddressPci 
> *address)
> +{
> +g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_ADDRESS_PCI(address), -1);
> +
> +return 
> gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(address),
> +   NULL, "domain",
> +   -1);
> +}
> +
>  void gvir_config_domain_address_pci_set_domain(GVirConfigDomainAddressPci 
> *address,
> guint16 pci_domain)
>  {
>  set_attribute_hex(address, "domain", pci_domain, 0, G_MAXUINT16, 4);
>  }
>  
> +int gvir_config_domain_address_pci_get_bus(GVirConfigDomainAddressPci 
> *address)
> +{
> +g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_ADDRESS_PCI(address), -1);
> +
> +return 
> gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(address),
> +   NULL, "bus",
> +   -1);
> +}
> +
>  void gvir_config_domain_address_pci_set_bus(GVirConfigDomainAddressPci 
> *address,
>  guchar bus)
>  {
>  set_attribute_hex(address, "bus", bus, 0, G_MAXUINT8, 2);
>  }
>  
> +int gvir_config_domain_address_pci_get_slot(GVirConfigDomainAddressPci 
> *address)
> +{
> +g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_ADDRESS_PCI(address), -1);
> +
> +return 
> gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(address),
> +   NULL, "slot",
> +   -1);
> +}
> +
>  void gvir_config_domain_address_pci_set_slot(GVirConfigDomainAddressPci 
> *address,
>   guchar slot)
>  {
>  set_attribute_hex(address, "slot", slot, 0, 0x1f, 2);
>  }
>  
> +int gvir_config_domain_address_pci_get_function(GVirConfigDomainAddressPci 
> *address)
> +{
> +g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_ADDRESS_PCI(address), -1);
> +
> +return 
> gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(address),
> +   NULL, "function",
> +   -1);
> +}
> +
>  void gvir_config_domain_address_pci_set_function(GVirConfigDomainAddressPci 
> *address,
>   guchar function)
>  {
>  set_attribute_hex(address, "function", function, 0, 7, 1);
>  }
>  
> +gboolean 
> gvir_config_domain_address_pci_get_multifunction(GVirConfigDomainAddressPci 
> *address)
> +{
> +g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_ADDRESS_PCI(address), FALSE);
> +
> +return 
> gvir_config_object_get_attribute_boolean(GVIR_CONFIG_OBJECT(address),
> +NULL, "multifunction",
> +FALSE);
> +}
> +
>  void 
> gvir_config_domain_address_pci_set_multifunction(GVirConfigDomainAddressPci 
> *address,
>gboolean multifunction)
>  {
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-address-pci.h 
> b/libvirt-gconfig/libvirt-gconfig-domain-address-pci.h
> index 3b82624..cdef4a8 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-address-pci.h
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-address-pci.h
> @@ -62,14 +62,19 @@ GVirConfigDomainAddressPci 
> *gvir_config_domain_address_pci_new(void);
>  GVirConfigDomainAddressPci 
> *gvir_config_domain_address_pci_new_from_xml(const gch

Re: [libvirt] [PATCH v4 1/6] gconfig: Add gvir_config_object_has_child

2016-04-21 Thread Christophe Fergeau
On Fri, Apr 15, 2016 at 02:38:19PM +0100, Zeeshan Ali (Khattak) wrote:
> From: Christophe Fergeau <cferg...@redhat.com>

This patch is mine, hopefully someone else will review it ;)

Christophe


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

Re: [libvirt] [PATCH v4 2/6] Add GVirConfigDomainHostdev

2016-04-21 Thread Christophe Fergeau
On Fri, Apr 15, 2016 at 02:38:20PM +0100, Zeeshan Ali (Khattak) wrote:
> +
> +/**
> + * gvir_config_domain_hostdev_set_readonly:
> + * @hostdev: the host device
> + * @readonly: the new readonly status
> + *
> + * Set the readonly status of @hostdev to @readonly.
> + */
> +void gvir_config_domain_hostdev_set_readonly(GVirConfigDomainHostdev 
> *hostdev,
> + gboolean readonly)
> +{
> +g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_HOSTDEV(hostdev));
> +
> +if (readonly) {
> +GVirConfigObject *node;
> +
> +node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(hostdev),
> +"readonly");
> +g_object_unref(node);
> +} else {
> +gvir_config_object_delete_child(GVIR_CONFIG_OBJECT(hostdev),
> +"readonly", NULL);
> +}
> +}
> +
> +/**
> + * gvir_config_domain_hostdev_get_readonly:
> + * @hostdev: the host device
> + *
> + * Returns: %TRUE if @hostdev is readonly, %FALSE otherwise.
> + */
> +gboolean gvir_config_domain_hostdev_get_readonly(GVirConfigDomainHostdev 
> *hostdev)
> +{
> +return gvir_config_object_has_child(GVIR_CONFIG_OBJECT(hostdev),
> +"readonly");
> +}
> +
> +/**
> + * gvir_config_domain_hostdev_set_shareable:
> + * @hostdev: the host device
> + * @shareable: the new shareable status
> + *
> + * Set the whether or not @hostdev is shared between domains.
> + */

Extra "the"

Acked-by: Christophe Fergeau <cferg...@redhat.com>

Christophe


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

Re: [libvirt] gconfig: Add hostdev support v4

2016-04-21 Thread Christophe Fergeau
On Fri, Apr 15, 2016 at 02:38:18PM +0100, Zeeshan Ali (Khattak) wrote:
> Finally I got the time to clean-up and fix the patches. It's been a
> while last i looked into them already and I got a bit confused at some
> point so I appologize if I didn't address some of the review comments.

Changes since v3 seems to be: (git diff ftw!)

- Changed a few (C) 2012 to (C) 2016
- Added reference to https://bugzilla.redhat.com/show_bug.cgi?id=1327577
  in gvir_config_domain_hostdev_pci_set_address
- Split gvir_config_domain_hostdev_pci_set_rom in
  gvir_config_domain_hostdev_pci_set_rom_{file,bar}
- Added API doc for GVirConfigDomainHostdev methods
- Added support for "on"/"off" to
  gvir_config_object_get_attribute_boolean()

Christophe


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

Re: [libvirt] [libvirt-glib] events: Mark 'eventlock' as static

2016-04-21 Thread Christophe Fergeau
Ping?

Christophe

On Fri, Jan 29, 2016 at 09:32:51AM +0100, Christophe Fergeau wrote:
> It's not used outside of the libvirt-glib-event.c file, so there is no
> good reason for not having it static. As it was not listed in
> libvirt-glib.sym, this will make no change to the publicly exported
> symbols (ie this is not an ABI change).
> ---
>  libvirt-glib/libvirt-glib-event.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libvirt-glib/libvirt-glib-event.c 
> b/libvirt-glib/libvirt-glib-event.c
> index f8227d6..4548aa6 100644
> --- a/libvirt-glib/libvirt-glib-event.c
> +++ b/libvirt-glib/libvirt-glib-event.c
> @@ -110,7 +110,7 @@ struct gvir_event_timeout
>  virFreeCallback ff;
>  };
>  
> -GMutex *eventlock = NULL;
> +static GMutex *eventlock = NULL;
>  
>  static int nextwatch = 1;
>  static GPtrArray *handles;
> -- 
> 2.5.0
> 
> --
> 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

  1   2   3   4   5   6   7   8   9   10   >