[Libvirt-cim] [PATCH] Add read-only support

Eduardo Lima (Etrunko) eblima at linux.vnet.ibm.com
Tue Jun 28 17:06:44 UTC 2011


On 06/27/2011 08:09 PM, Chip Vincent wrote:
>
>
> On 06/27/2011 01:45 PM, Eduardo Lima (Etrunko) wrote:
>> # HG changeset patch
>> # User Eduardo Lima (Etrunko)<eblima at br.ibm.com>
>> # Date 1308270993 14400
>> # Node ID 9be9d0b2eed352a96bd07dcff435b8de5f7a43c6
>> # Parent a2f523cd39c29977ed07247a38316d44f5123874
>> Add read-only support.
>>
>> This patch enables a consumer of libvirt-cim to put it in read-only
>> mode by adding the key-value pair 'readonly=true' to libvirt-cim.conf.
>>
>> Also clean-up some extra whitespace in touched files.
>>
>> Signed-off-by: Chip Vincent<cvincent at us.ibm.com>
>> Signed-off-by: Eduardo Lima (Etrunko)<eblima at br.ibm.com>
>>
>> diff --git a/Makefile.am b/Makefile.am
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -172,6 +172,9 @@
>>
>> pkgdata_SCRIPTS = provider-register.sh
>>
>> +libvirtcim_confdir = @sysconfdir@
>> +dist_libvirtcim_conf_DATA = @PACKAGE at .conf
>> +
>> EXTRA_DIST = schema $(MOFS) $(REGS) $(INTEROP_MOFS) $(INTEROP_REGS) \
>> $(pkgdata_SCRIPTS) libvirt-cim.spec.in libvirt-cim.spec \
>> doc/CodingStyle doc/SubmittingPatches \
>> diff --git a/acinclude.m4 b/acinclude.m4
>> --- a/acinclude.m4
>> +++ b/acinclude.m4
>> @@ -270,6 +270,15 @@
>> LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
>> ])
>>
>> +AC_DEFUN([CHECK_LIBCONFIG],
>> + [
>> + PKG_CHECK_MODULES([LIBCONFIG], [libconfig])
>> + AC_SUBST([LIBCONFIG_CFLAGS])
>> + AC_SUBST([LIBCONFIG_LIBS])
>> + CPPFLAGS="$CPPFLAGS $LIBCONFIG_CFLAGS"
>> + LDFLAGS="$LDFLAGS $LIBCONFIG_LIBS"
>> + ])
>> +
>> # A convenience macro that spits out a fail message for a particular test
>> #
>> # AC_CHECK_FAIL($LIBNAME,$PACKAGE_SUGGEST,$URL,$EXTRA)
>> diff --git a/configure.ac b/configure.ac
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -166,6 +166,7 @@
>> CHECK_LIBXML2
>> CHECK_LIBCU
>> CHECK_LIBUUID
>> +CHECK_LIBCONFIG
>>
>> CFLAGS_STRICT="-Werror"
>>
>> diff --git a/libvirt-cim.conf b/libvirt-cim.conf
>> new file mode 100644
>> --- /dev/null
>> +++ b/libvirt-cim.conf
>> @@ -0,0 +1,13 @@
>> +#
>> +# libvirt-cim config file
>> +#
>> +# This config file is based on the libconfig format. For more
>> information,
>> +# please check http://www.hyperrealm.com/libconfig/
>> +#
>> +
>> +# readonly (boolean)
>> +# Defines wether connection to libvirt is read-only or not
>
> s/wether/whether/ May just want to say 'if'

Roger.

>
>> +# Possible values: {true,false}
>> +# Default value: false
>> +#
>> +# readonly = false;
>> diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in
>> --- a/libvirt-cim.spec.in
>> +++ b/libvirt-cim.spec.in
>> @@ -26,6 +26,7 @@
>>
>> BuildRequires: libxml2-devel
>> BuildRequires: libcmpiutil-devel
>> +BuildRequires: libconfig-devel
>> BuildConflicts: sblim-cmpi-devel
>>
>> %description
>> @@ -135,6 +136,7 @@
>> %{_datadir}/libvirt-cim/*.registration
>> %{_datadir}/libvirt-cim/cim_schema_*-MOFs.zip
>> %{_sysconfdir}/ld.so.conf.d/libvirt-cim.conf
>> +%{_sysconfdir}/libvirt-cim.conf
>>
>> %changelog
>> * Wed Oct 28 2009 Richard Maciel<rmaciel at linux.vnet.ibm.com> - 0.1-1
>> diff --git a/libxkutil/Makefile.am b/libxkutil/Makefile.am
>> --- a/libxkutil/Makefile.am
>> +++ b/libxkutil/Makefile.am
>> @@ -1,7 +1,8 @@
>> # Copyright IBM Corp. 2007
>> SUBDIRS = tests
>>
>> -CFLAGS += $(CFLAGS_STRICT)
>> +AM_CFLAGS = $(CFLAGS_STRICT) \
>> + -DLIBVIRTCIM_CONF=\"@sysconfdir@/@PACKAGE at .conf\"
>>
>> noinst_HEADERS = cs_util.h misc_util.h device_parsing.h xmlgen.h
>> infostore.h \
>> pool_parsing.h acl_parsing.h
>> diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c
>> --- a/libxkutil/misc_util.c
>> +++ b/libxkutil/misc_util.c
>> @@ -35,11 +35,12 @@
>>
>> #include<libcmpiutil/libcmpiutil.h>
>> #include<libcmpiutil/std_association.h>
>> +#include<libconfig.h>
>>
>> #include "misc_util.h"
>> #include "cs_util.h"
>>
>> -#include<config.h>
>> +#include "config.h"
>>
>> #define URI_ENV "HYPURI"
>>
>> @@ -55,6 +56,37 @@
>> return NULL;
>> }
>>
>> +static int is_read_only(void)
>> +{
>> + config_t conf;
>> + int ret, readonly = 0;
>> + const char *readonly_str = "readonly";
>> +
>> + config_init(&conf);
>> +
>> + ret = config_read_file(&conf, LIBVIRTCIM_CONF);
>> + if (ret == CONFIG_FALSE) {
>> + CU_DEBUG("Error reading config file(%d): '%s'\n",
>> + conf.error_type, conf.error_text);
>> + goto out;
>> + }
>
> The above does not compile on RHEL 6 with libconfig-1.3.2-1.1.el6.x86_64
>
> misc_util.c: In function ‘is_read_only’:
> misc_util.c:69: error: ‘config_t’ has no member named ‘error_type’
>

Thanks for the spot. New version on the way.

-- 
Eduardo de Barros Lima
Software Engineer, Open Virtualization
Linux Technology Center - IBM/Brazil
eblima at br.ibm.com




More information about the Libvirt-cim mailing list