Commit c17319a5 authored by Dan Smith's avatar Dan Smith

Initial checkin of libvirt-cim provider

Signed-off-by: 's avatarDan Smith <danms@us.ibm.com>
parent b600b5ba
......@@ -10,3 +10,27 @@ tests/*.err
syntax: regexp
.*\#.*\#$
Makefile$
Makefile\.in$
^aclocal\.m4$
autom4te\.cache/.*
config\.guess$
config\.h$
config\.log$
config\.status$
config\.sub$
^configure$
^install-sh$
^ltmain.sh$
^missing$
\.libs/.*
\.la$
\.lo$
\.o$
^stamp-h1$
^libtool$
.*\~$
.*\.loT$
^acinclude.m4.orig$
^config.h.in$
libcmpiutil/doc/html/.*%
\ No newline at end of file
This diff is collapsed.
# Copyright IBM Corp. 2007
SUBDIRS = libxkutil src
MOFS = \
schema/ComputerSystem.mof \
schema/LogicalDisk.mof \
schema/NetworkPort.mof \
schema/Memory.mof \
schema/Processor.mof \
schema/SystemDevice.mof \
schema/VSSD.mof \
schema/HostSystem.mof \
schema/HostedDependency.mof \
schema/VirtualSystemManagementService.mof \
schema/VirtualSystemManagementCapabilities.mof \
schema/EnabledLogicalElementCapabilities.mof \
schema/AllocationCapabilities.mof \
schema/SettingsDefineCapabilities.mof \
schema/MemoryPool.mof \
schema/ElementCapabilities.mof \
schema/ProcessorPool.mof \
schema/HostedResourcePool.mof \
schema/ElementConformsToProfile.mof \
schema/ComputerSystemIndication.mof \
schema/ResourceAllocationSettingData.mof \
schema/ResourcePoolConfigurationService.mof \
schema/ResourcePoolConfigurationCapabilities.mof \
schema/VSSDComponent.mof \
schema/SettingsDefineState.mof \
schema/NetPool.mof \
schema/ResourceAllocationFromPool.mof
schema/ElementAllocatedFromPool.mof
INTEROP_MOFS = \
schema/RegisteredProfile.mof \
schema/ElementConformsToProfile.mof
REGS = \
schema/ComputerSystem.registration \
schema/LogicalDisk.registration \
schema/NetworkPort.registration \
schema/Memory.registration \
schema/Processor.registration \
schema/SystemDevice.registration \
schema/VSSD.registration \
schema/HostSystem.registration \
schema/HostedDependency.registration \
schema/VirtualSystemManagementService.registration \
schema/VirtualSystemManagementCapabilities.registration \
schema/EnabledLogicalElementCapabilities.registration \
schema/AllocationCapabilities.registration \
schema/SettingsDefineCapabilities.registration \
schema/MemoryPool.registration \
schema/ElementCapabilities.registration \
schema/ProcessorPool.registration \
schema/HostedResourcePool.registration \
schema/ComputerSystemIndication.registration \
schema/ResourceAllocationSettingData.registration \
schema/ResourcePoolConfigurationService.registration \
schema/ResourcePoolConfigurationCapabilities.registration \
schema/VSSDComponent.registration \
schema/SettingsDefineState.registration \
schema/NetPool.registration \
schema/ResourceAllocationFromPool.registration \
schema/ElementAllocatedFromPool.registration
INTEROP_REGS = \
schema/RegisteredProfile.registration \
schema/ElementConformsToProfile.registration
pkgdata_DATA = $(MOFS) $(REGS)
pkgdata_SCRIPTS = provider-register.sh
EXTRA_DIST = schema $(pkgdata_DATA) $(pkgdata_SCRIPTS)
# Un/Register the providers and class definitions from/to the current CIMOM.
# @CIMSERVER@ is set by the configure script
postinstall:
sh provider-register.sh -t @CIMSERVER@ -n /root/ibmsd -r $(REGS) -m $(MOFS)
sh provider-register.sh -t @CIMSERVER@ -n /root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS)
preuninstall:
sh provider-register.sh -d -t @CIMSERVER@ -n /root/ibmsd -r $(REGS) -m $(MOFS)
sh provider-register.sh -d -t @CIMSERVER@ -n /root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS)
dnl
dnl $Id$
dnl
dnl
dnl © Copyright IBM Corp. 2004, 2005, 2007
dnl CHECK_CMPI: Check for CMPI headers and set the CPPFLAGS
dnl with the -I<directory>
dnl
dnl CHECK_PEGASUS_2_3_2: Check for Pegasus 2.3.2 and set
dnl the HAVE_PEGASUS_2_3_2
dnl flag
dnl
AC_DEFUN([CHECK_PEGASUS_2_3_2],
[
AC_MSG_CHECKING(for Pegasus 2.3.2)
if which cimserver > /dev/null 2>&1
then
test_CIMSERVER=`cimserver -v`
fi
if test "$test_CIMSERVER" == "2.3.2"; then
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(HAVE_PEGASUS_2_3_2,1,[Defined to 1 if Pegasus 2.3.2 is used])
else
AC_MSG_RESULT(no)
fi
]
)
dnl
dnl CHECK_PEGASUS_2_4: Check for Pegasus 2.4 and set the
dnl the -DPEGASUS_USE_EXPERIMENTAL_INTERFACES flag
dnl
AC_DEFUN([CHECK_PEGASUS_2_4],
[
AC_MSG_CHECKING(for Pegasus 2.4)
if which cimserver > /dev/null 2>&1
then
test_CIMSERVER=`cimserver -v`
fi
if test "$test_CIMSERVER" == "2.4"; then
AC_MSG_RESULT(yes)
CPPFLAGS="$CPPFLAGS -DPEGASUS_USE_EXPERIMENTAL_INTERFACES"
AC_DEFINE_UNQUOTED(HAVE_PEGASUS_2_4,1,[Defined to 1 if Pegasus 2.4 is used])
else
AC_MSG_RESULT(no)
fi
]
)
dnl
dnl Helper functions
dnl
AC_DEFUN([_CHECK_CMPI],
[
AC_MSG_CHECKING($1)
AC_TRY_LINK(
[
#include <cmpimacs.h>
#include <cmpidt.h>
#include <cmpift.h>
],
[
CMPIBroker broker;
CMPIStatus status = {CMPI_RC_OK, NULL};
CMPIString *s = CMNewString(&broker, "TEST", &status);
],
[
have_CMPI=yes
dnl AC_MSG_RESULT(yes)
],
[
have_CMPI=no
dnl AC_MSG_RESULT(no)
])
])
dnl
dnl The main function to check for CMPI headers
dnl Modifies the CPPFLAGS with the right include directory and sets
dnl the 'have_CMPI' to either 'no' or 'yes'
dnl
AC_DEFUN([CHECK_CMPI],
[
AC_MSG_CHECKING(for CMPI headers)
dnl Check just with the standard include paths
CMPI_CPP_FLAGS="$CPPFLAGS"
_CHECK_CMPI(standard)
if test "$have_CMPI" == "yes"; then
dnl The standard include paths worked.
AC_MSG_RESULT(yes)
else
_DIRS_="/usr/include/cmpi \
/usr/local/include/cmpi \
$PEGASUS_ROOT/src/Pegasus/Provider/CMPI \
/opt/tog-pegasus/include/Pegasus/Provider/CMPI \
/usr/include/Pegasus/Provider/CMPI \
/usr/include/openwbem \
/usr/sniacimom/include"
for _DIR_ in $_DIRS_
do
_cppflags=$CPPFLAGS
_include_CMPI="$_DIR_"
CPPFLAGS="$CPPFLAGS -I$_include_CMPI"
_CHECK_CMPI($_DIR_)
if test "$have_CMPI" == "yes"; then
dnl Found it
AC_MSG_RESULT(yes)
dnl Save the new -I parameter
CMPI_CPP_FLAGS="$CPPFLAGS"
break
fi
CPPFLAGS=$_cppflags
done
fi
CPPFLAGS="$CMPI_CPP_FLAGS"
if test "$have_CMPI" == "no"; then
AC_MSG_ERROR(no. Sorry cannot find CMPI headers files.)
fi
]
)
dnl
dnl The check for the CMPI provider directory
dnl Sets the PROVIDERDIR variable.
dnl
AC_DEFUN([CHECK_PROVIDERDIR],
[
AC_MSG_CHECKING(for CMPI provider directory)
_DIRS="$libdir/cmpi"
save_exec_prefix=${exec_prefix}
save_prefix=${prefix}
if test xNONE == x${prefix}; then
prefix=/usr/local
fi
if test xNONE == x${exec_prefix}; then
exec_prefix=$prefix
fi
for _dir in $_DIRS
do
_xdir=`eval echo $_dir`
AC_MSG_CHECKING( $_dir )
if test -d $_xdir ; then
dnl Found it
AC_MSG_RESULT(yes)
if test x"$PROVIDERDIR" == x ; then
PROVIDERDIR=$_dir
fi
break
fi
done
if test x"$PROVIDERDIR" == x ; then
PROVIDERDIR="$libdir"/cmpi
AC_MSG_RESULT(implied: $PROVIDERDIR)
fi
exec_prefix=$save_exec_prefix
prefix=$save_prefix
]
)
dnl
dnl The "check" for the CIM server type
dnl Sets the CIMSERVER variable.
dnl
AC_DEFUN([CHECK_CIMSERVER],
[
AC_MSG_CHECKING(for CIM servers)
if test x"$CIMSERVER" = x
then
_SERVERS="sfcbd cimserver owcimomd"
_SAVE_PATH=$PATH
PATH=/usr/sbin:/usr/local/sbin:$PATH
for _name in $_SERVERS
do
AC_MSG_CHECKING( $_name )
for _path in `echo $PATH | sed "s/:/ /g"`
do
if test -f $_path/$_name ; then
dnl Found it
AC_MSG_RESULT(yes)
if test x"$CIMSERVER" == x ; then
case $_name in
sfcbd) CIMSERVER=sfcb;;
cimserver) CIMSERVER=pegasus;;
owcimomd) CIMSERVER=openwbem;;
esac
fi
break;
fi
done
done
PATH=$_SAVE_PATH
if test x"$CIMSERVER" == x ; then
CIMSERVER=sfcb
AC_MSG_RESULT(implied: $CIMSERVER)
fi
fi
# Cross platform only needed for sfcb currently
if test $CIMSERVER = sfcb
then
AC_REQUIRE([AC_CANONICAL_HOST])
AC_CHECK_SIZEOF(int)
case "$build_cpu" in
i*86) case "$host_cpu" in
powerpc*) if test $ac_cv_sizeof_int == 4
then
REGISTER_FLAGS="-X P32"
fi ;;
esac ;;
esac
AC_SUBST(REGISTER_FLAGS)
fi
]
)
dnl
dnl The check for the libxml2 library
dnl Sets the LIBXML2DIR variable
dnl
AC_DEFUN([_CHECK_LIBXML2],
[
AC_MSG_CHECKING($1)
AC_TRY_LINK(
[
#include <libxml/tree.h>
],
[
xmlNodePtr nodeptr;
],
[
have_LIBXML2=yes
dnl AC_MSG_RESULT(yes)
],
[
have_LIBXML2=no
dnl AC_MSG_RESULT(no)
])
])
AC_DEFUN([CHECK_LIBXML2],
[
AC_MSG_CHECKING(for libxml2 package)
CPPFLAGS="$CPPFLAGS `xml2-config --cflags` "
LDFLAGS="$LDFLAGS `xml2-config --libs` "
dnl The standard include paths worked.
_CHECK_LIBXML2(standard)
if test "$have_LIBXML2" == "no"; then
AC_MSG_ERROR(no. The required libxml2 package is missing.)
fi
]
)
dnl
dnl The check for the libvirt library
dnl Sets the LIBVIRTDIR variable
dnl
AC_DEFUN([_CHECK_LIBVIRT],
[
AC_MSG_CHECKING($1)
AC_TRY_LINK(
[
#include <libvirt.h>
#include <virterror.h>
],
[
virConnectPtr connectPtr;
],
[
have_LIBVIRT=yes
dnl AC_MSG_RESULT(yes)
],
[
have_LIBVIRT=no
dnl AC_MSG_RESULT(no)
])
])
AC_DEFUN([CHECK_LIBVIRT],
[
AC_MSG_CHECKING(for libvirt package)
LIBVIRT_CPP_FLAGS="$CPPFLAGS"
dnl The standard include paths worked.
_CHECK_LIBVIRT(standard)
if test x"$LIBVIRTDIR" == x ; then
_DIRS_="/usr/include/libvirt \
/usr/local/include/libvirt"
else
_DIRS_="$LIBVIRTDIR/include/libvirt"
fi
for _DIR_ in $_DIRS_
do
_cppflags=$CPPFLAGS
_include_LIBVIRT="$_DIR_"
CPPFLAGS="$CPPFLAGS -I$_include_LIBVIRT"
_CHECK_LIBVIRT($_DIR_)
if test "$have_LIBVIRT" == "yes"; then
dnl Found it
AC_MSG_RESULT(yes)
dnl Save the new -I parameter
LIBVIRT_CPP_FLAGS="$CPPFLAGS"
LIBLIBVIRT=-lvirt
break
fi
CPPFLAGS=$_cppflags
done
CPPFLAGS=$LIBVIRT_CPP_FLAGS
AC_SUBST(LIBLIBVIRT)
if test "$have_LIBVIRT" == "no"; then
AC_MSG_ERROR(no. The required libvirt package is missing.)
fi
]
)
dnl
dnl The check for the SBLIM test suite
dnl Sets the TESTSUITEDIR variable and the TESTSUITE conditional
dnl
AC_DEFUN([CHECK_TESTSUITE],
[
AC_MSG_CHECKING(for SBLIM testsuite)
_DIRS="$datadir/sblim-testsuite"
save_exec_prefix=${exec_prefix}
save_prefix=${prefix}
if test xNONE == x${prefix}; then
prefix=/usr/local
fi
if test xNONE == x${exec_prefix}; then
exec_prefix=$prefix
fi
for _name in $_DIRS
do
AC_MSG_CHECKING( $_name )
_xname=`eval echo $_name`
if test -x $_xname/run.sh ; then
dnl Found it
AC_MSG_RESULT(yes)
if test x"$TESTSUITEDIR" == x; then
TESTSUITEDIR=$_name
fi
AC_SUBST(TESTSUITEDIR)
break;
fi
done
if test x"$TESTSUITEDIR" == x ; then
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(TESTSUITE,[test x"$TESTSUITEDIR" != x])
exec_prefix=$save_exec_prefix
prefix=$save_prefix
]
)
# A convenience macro that spits out a fail message for a particular test
#
# AC_CHECK_FAIL($LIBNAME,$PACKAGE_SUGGEST,$URL,$EXTRA)
#
AC_DEFUN([AC_CHECK_FAIL],
[
ERR_MSG=`echo -e "- $1 not found!\n"`
if test "x" != "x$4"; then
ERR_MSG=`echo -e "$ERR_MSG\n- $4"`
fi
if test "x$2" != "x"; then
ERR_MSG=`echo -e "$ERR_MSG\n- Try installing the $2 package\n"`
fi
if test "x$3" != "x"; then
ERR_MSG=`echo -e "$ERR_MSG\n- or get the latest software from $3\n"`
fi
AC_MSG_ERROR(
!
************************************************************
$ERR_MSG
************************************************************
)
]
)
#
# Check for void EnableIndications return
#
AC_DEFUN([CHECK_IND_VOID], [
AH_TEMPLATE([CMPI_EI_VOID],
[Defined if return type of EnableIndications
should be void])
AC_MSG_CHECKING([return type for indications])
CFLAGS_TMP=$CFLAGS
CFLAGS="-Werror"
AC_TRY_COMPILE([
#include <cmpift.h>
static void ei(CMPIIndicationMI *mi, const CMPIContext *c) {
return;
}
],[
struct _CMPIIndicationMIFT ft;
ft.enableIndications = ei;
return 0;
], [
echo "void"
AC_DEFINE_UNQUOTED([CMPI_EI_VOID], [yes])
], [
echo "CMPIStatus"
])
CFLAGS=$CFLAGS_TMP
])
#
# Define max mem.
#
AC_DEFUN([DEFINE_MAXMEM],
[
AC_DEFINE_UNQUOTED([MAX_MEM], $1, [Max memory for a guest.])
]
)
#!/bin/sh
# ============================================================================
# (C) Copyright IBM Corp. 2005
echo "Running libtool ..." &&
libtoolize --copy --force --automake &&
echo "Running aclocal ..." &&
aclocal --force &&
echo "Running autoheader ..." &&
autoheader --force &&
echo "Running automake ..." &&
automake -i --add-missing --copy --foreign &&
echo "Running autoconf ..." &&
autoconf --force &&
echo "You may now run ./configure"
echo "You may now run ./configure LIBVIRTDIR=/usr/local"
# (C) Copyright IBM Corp. 2005
AC_INIT(libvirt CMPI provider, 0.1, danms@us.ibm.com, libvirt-cim)
AC_CONFIG_SRCDIR([src/Virt_ComputerSystem.c])
#AC_CONFIG_FILES([xen-kvm-cmpi.spec])
AC_CHECK_HEADERS([stdarg.h errno.h])
AC_CHECK_FUNCS([popen pclose fgets asprintf vfprintf fprintf snprintf sscanf])
CPPFLAGS="$CPPFLAGS -DCMPI_VERSION=100"
#CPPFLAGS="$CPPFLAGS -DSBLIM_DEBUG"
CC_WARNINGS="\
-Wall \
-Wmissing-prototypes \
-Wmissing-declarations \
-Wstrict-prototypes \
-Wpointer-arith \
-Wformat=2 \
-Wformat-security \
-Wformat-nonliteral \
-Wno-format-y2k \
-Wcast-align \
-Wno-unused-value"
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE"
# Configure command line options
AC_ARG_VAR([CIMSERVER],[the target CIM server (pegasus|sfcb|openwbem|sniacimom).
])
AC_ARG_VAR([PROVIDERDIR],[the directory where the CMPI providers will be install
ed.])
AC_ARG_VAR([LIBVIRTDIR],[the directory where the libvirt package is installed.])
AC_ARG_VAR([TESTSUITEDIR],[the directory where the SBLIM testsuite is installed.
])
AC_ARG_WITH([maxmem],
[ --with-maxmem=FOO Set max memory (MB) for a guest.],
[DEFINE_MAXMEM($with_maxmem)],
[DEFINE_MAXMEM(4096)]
)
# Autogenerate the autoconf header file to store build settings
AC_CONFIG_HEADER([config.h])
# We need a absolute here for beam to work
topdir=`pwd`
AC_SUBST(topdir)
AC_CHECK_PROG([found_beam_compile],[beam_compile],[yes])
BEAMFILES="parser-messages BEAM_STATS BEAM-complaints MISC_ERRORS *.beam"
AC_SUBST(BEAMFILES)
# Autogenerate runbeam-c, which must be executable
#AC_CONFIG_FILES([beam/runbeam-c],[chmod a+x beam/runbeam-c])
# Autogenerate the Makefile
AC_CONFIG_FILES([
libxkutil/Makefile
libxkutil/tests/Makefile
src/Makefile
src/tests/Makefile
Makefile
])
AM_INIT_AUTOMAKE
# Check for the required C compiler
AC_PROG_CC
# Check for LEX/YACC
AC_PROG_LEX
AC_PROG_YACC
# Check if the C compiler supports 'const'
AC_C_CONST
# Check for the required libtool
AC_PROG_LIBTOOL
# Check for the required install program
AC_PROG_INSTALL
# Check for some common required headers
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
# Check if the system headers conform to ANSI C
AC_HEADER_STDC
# Check for specific add on libraries that we know we'll need
# - libuuid
#AC_CHECK_LIB([uuid], [uuid_generate], [have_uuid=yes], [
# AC_CHECK_FAIL(libuuid,e2fsprogs-devel)
# ])
# - libxenstore
#AC_CHECK_LIB([xenstore], [xs_read], [have_xen=yes], [
# AC_CHECK_FAIL(libxenstore,xen-devel)
# ])
# Check for the required CMPI header files (this macro is defined in acinclude.m4)
CHECK_CMPI
CHECK_IND_VOID
# Check for where to install CMPI libraries (this macro is defined in acinclude.m4)
CHECK_PROVIDERDIR
# Check for presense of a CIM server (this macro is defined in acinclude.m4)
CHECK_CIMSERVER
# Check for presense of libxml2 (this macro defined in acinclude.m4)
AC_CHECK_PROG([found_xml2_config],[xml2-config],[yes])
AM_CONDITIONAL([found_xml2_config], [test x$found_xml2_config = xyes])
CHECK_LIBXML2
# Check for presense of libvirt (this macro is defined in acinclude.m4)
CHECK_LIBVIRT
# Check for the SBLIM testsuite (this macro is defined in acinclude.m4)
CHECK_TESTSUITE
if test x"$TESTSUITEDIR" == x; then
TESTSUITE_SUPPORT=Disabled
else
TESTSUITE_SUPPORT=Enabled
fi
#
# Enable the beam source analysis system. This requires that beam's
# bin directory is in your path
#
CFLAGS_STRICT="-Werror"
AC_CHECK_LIB(cmpiutil, cu_check_args, [], [
echo "libcmpiutil not found"
exit 1
])
AC_ARG_ENABLE([werror],
[ --enable-werror enable werror on builds [[default=yes]]],
[if test "x$enableval" = "xno"; then
CFLAGS_STRICT=""
fi])
AC_SUBST(CFLAGS_STRICT)
AC_ARG_ENABLE([beam],
[ --enable-beam use beam to compile source [[default=no]]],
[if test "x$enableval" = "xyes"; then
if test "x$found_beam_compile" = "xyes"; then
AC_MSG_NOTICE(Building beam configuration)
beam_configure --c $CC -o beam/compiler_c_config.tcl
CC="\$(top_srcdir)/beam/runbeam-c"
else
AC_CHECK_FAIL(beam,beam,http://w3.eda.ibm.com/beam,
Can not find beam_compile in path! Can not enable beam analysis!
)
fi
fi],
)
CFLAGS="$CFLAGS $CC_WARNINGS"
# Display configuration options
echo "----------------------------------------------------------"
echo "Configuration for $PACKAGE complete."
echo ""
echo "The following configuration options have been selected:"