Re: [libvirt] [PATCH v2] secret: Introduce virSecretGetSecretString

2016-04-06 Thread Ján Tomko
On Mon, Apr 04, 2016 at 10:19:58PM -0400, John Ferlan wrote:
> Commit id 'fb2bd208' essentially copied the qemuGetSecretString
> creating an libxlGetSecretString.  Rather than have multiple copies
> of the same code, create src/secret/secret_util.{c,h} files and
> place the common function in there.
> 
> Modify the the build in order to build the module as a library
> which is then pulled in by both the qemu and libxl drivers for
> usage from both qemu_command.c and libxl_conf.c
> 
> Signed-off-by: John Ferlan 
> ---
> 
> My Makefile.am skills are weak at best - not sure I got it totally
> right, but I think I'm at least close (it builds and links).
> 
>  po/POTFILES.in   |   1 +
>  src/Makefile.am  |  17 ++-
>  src/libvirt_private.syms |   4 ++
>  src/libxl/libxl_conf.c   |  82 +++-
>  src/qemu/qemu_command.c  |  87 --
>  src/secret/secret_util.c | 120 
> +++
>  src/secret/secret_util.h |  35 ++
>  7 files changed, 190 insertions(+), 156 deletions(-)
>  create mode 100644 src/secret/secret_util.c
>  create mode 100644 src/secret/secret_util.h
> 

ACK

Jan

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


[libvirt] [PATCH v2] secret: Introduce virSecretGetSecretString

2016-04-04 Thread John Ferlan
Commit id 'fb2bd208' essentially copied the qemuGetSecretString
creating an libxlGetSecretString.  Rather than have multiple copies
of the same code, create src/secret/secret_util.{c,h} files and
place the common function in there.

Modify the the build in order to build the module as a library
which is then pulled in by both the qemu and libxl drivers for
usage from both qemu_command.c and libxl_conf.c

Signed-off-by: John Ferlan 
---

My Makefile.am skills are weak at best - not sure I got it totally
right, but I think I'm at least close (it builds and links).

 po/POTFILES.in   |   1 +
 src/Makefile.am  |  17 ++-
 src/libvirt_private.syms |   4 ++
 src/libxl/libxl_conf.c   |  82 +++-
 src/qemu/qemu_command.c  |  87 --
 src/secret/secret_util.c | 120 +++
 src/secret/secret_util.h |  35 ++
 7 files changed, 190 insertions(+), 156 deletions(-)
 create mode 100644 src/secret/secret_util.c
 create mode 100644 src/secret/secret_util.h

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0d7f9f9..21d4cc6 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -155,6 +155,7 @@ src/rpc/virnetserverservice.c
 src/rpc/virnetsshsession.c
 src/rpc/virnettlscontext.c
 src/secret/secret_driver.c
+src/secret/secret_util.c
 src/security/security_apparmor.c
 src/security/security_dac.c
 src/security/security_driver.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 1726d06..5a3dd11 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -936,6 +936,9 @@ INTERFACE_DRIVER_SOURCES += 
\
 endif WITH_UDEV
 endif WITH_INTERFACE
 
+SECRET_UTIL_SOURCES =  \
+   secret/secret_util.h secret/secret_util.c
+
 SECRET_DRIVER_SOURCES =\
secret/secret_driver.h secret/secret_driver.c
 
@@ -1123,6 +1126,12 @@ libvirt_cpu_la_CFLAGS = \
-I$(srcdir)/conf $(AM_CFLAGS)
 libvirt_cpu_la_SOURCES = $(CPU_SOURCES)
 
+noinst_LTLIBRARIES += libvirt_secret.la
+libvirt_la_BUILT_LIBADD += libvirt_secret.la
+libvirt_secret_la_CFLAGS = $(AM_CFLAGS)
+libvirt_secret_la_LDFLAGS = $(AM_LDFLAGS)
+libvirt_secret_la_SOURCES = $(SECRET_UTIL_SOURCES)
+
 if WITH_VMX
 noinst_LTLIBRARIES += libvirt_vmx.la
 libvirt_la_BUILT_LIBADD += libvirt_vmx.la
@@ -1303,10 +1312,13 @@ libvirt_driver_libxl_impl_la_CFLAGS =   \
$(LIBXL_CFLAGS) \
-I$(srcdir)/access  \
-I$(srcdir)/conf\
+   -I$(srcdir)/secret  \
-I$(srcdir)/xenconfig   \
$(AM_CFLAGS)
 libvirt_driver_libxl_impl_la_LDFLAGS = $(AM_LDFLAGS)
-libvirt_driver_libxl_impl_la_LIBADD = $(LIBXL_LIBS) libvirt_xenconfig.la
+libvirt_driver_libxl_impl_la_LIBADD = $(LIBXL_LIBS) \
+ libvirt_xenconfig.la \
+ libvirt_secret.la
 libvirt_driver_libxl_impl_la_SOURCES = $(LIBXL_DRIVER_SOURCES)
 
 conf_DATA += libxl/libxl.conf
@@ -1337,12 +1349,14 @@ libvirt_driver_qemu_impl_la_CFLAGS = \
$(LIBNL_CFLAGS) \
-I$(srcdir)/access \
-I$(srcdir)/conf \
+   -I$(srcdir)/secret \
$(AM_CFLAGS)
 libvirt_driver_qemu_impl_la_LDFLAGS = $(AM_LDFLAGS)
 libvirt_driver_qemu_impl_la_LIBADD = $(CAPNG_LIBS) \
 $(GNUTLS_LIBS) \
$(LIBNL_LIBS) \
$(LIBXML_LIBS) \
+   libvirt_secret.la \
$(NULL)
 libvirt_driver_qemu_impl_la_SOURCES = $(QEMU_DRIVER_SOURCES)
 
@@ -1873,6 +1887,7 @@ EXTRA_DIST += 
\
$(SECURITY_DRIVER_SELINUX_SOURCES)  \
$(SECURITY_DRIVER_APPARMOR_SOURCES) \
$(SECRET_DRIVER_SOURCES)\
+   $(SECRET_UTIL_SOURCES)  \
$(VBOX_DRIVER_EXTRA_DIST)   \
$(VMWARE_DRIVER_SOURCES)\
$(XENCONFIG_SOURCES)\
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 684f06c..a473158 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1038,6 +1038,10 @@ nodeGetThreadsPerSubcore;
 nodeSetMemoryParameters;
 
 
+# secret/secret_util.h
+virSecretGetSecretString;
+
+
 # security/security_driver.h
 virSecurityDriverLookup;
 
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 82ba417..d16280d 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -46,7 +46,7 @@
 #include "libxl_conf.h"
 #include "libxl_utils.h"
 #include "virstoragefile.h"
-#include "base64.h"
+#include