
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1208209155 25200 # Node ID 606a412caaf41e1d49ca47809ec0e94e65f29785 # Parent 67e30fff0026214f509e688bdb082d07ffd267f2 Add revision information to the VSMS This is done at build time, if possible. If not, the changeset/revision at the last automake run will be used. This should make it work for the tarball/release case as well as the RPM build. The way this works, if you build, then apply a patch or pull a new changeset, the exposed revision/version information will be stale unless you do a clean. Since this is really just for the purposes of test-tracking, I think this is a reasonable restriction that can be minded by the people doing testing. The changeset hash and revision number are exposed in aptly-named properties of the VSMS for each platform. If anyone has a better place for these to show up, or a better format, please bring it up. Changes: - Update the VSMS schema for the new values Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 67e30fff0026 -r 606a412caaf4 Makefile.am --- a/Makefile.am Mon Apr 14 10:49:02 2008 -0700 +++ b/Makefile.am Mon Apr 14 14:39:15 2008 -0700 @@ -98,7 +98,8 @@ pkgdata_SCRIPTS = provider-register.sh EXTRA_DIST = schema $(pkgdata_DATA) $(pkgdata_SCRIPTS) \ libvirt-cim.spec.in libvirt-cim.spec \ - doc/CodingStyle doc/SubmittingPatches + doc/CodingStyle doc/SubmittingPatches \ + .changeset .revision preinstall: sh -x base_schema/install_base_schema.sh `pwd`/base_schema diff -r 67e30fff0026 -r 606a412caaf4 acinclude.m4 --- a/acinclude.m4 Mon Apr 14 10:49:02 2008 -0700 +++ b/acinclude.m4 Mon Apr 14 14:39:15 2008 -0700 @@ -313,4 +313,23 @@ AC_DEFUN([DEFINE_DISK_CONFIG], [ AC_DEFINE_UNQUOTED([DISK_POOL_CONFIG], "$1", [Disk pool config filepath.]) ] -) \ No newline at end of file +) + +AC_DEFUN([SET_CSET], + [ + if test -d .hg && test -x $(which hg); then + cs='-DLIBVIRT_CIM_CS=\"`hg id -i`\"' + rv='-DLIBVIRT_CIM_RV=\"`hg id -n`\"' + elif test -f .changeset; then + cset=$(cat .changeset) + revn=$(cat .revision) + cs="-DLIBVIRT_CIM_CS=\\\"$cset\\\"" + rv="-DLIBVIRT_CIM_RV=\\\"$revn\\\"" + else + cs='-DLIBVIRT_CIM_CS=\"Unknown\"' + rv='-DLIBVIRT_CIM_RV=\"0\"' + fi + + CFLAGS="$CFLAGS $cs $rv" + ] +) diff -r 67e30fff0026 -r 606a412caaf4 autoconfiscate.sh --- a/autoconfiscate.sh Mon Apr 14 10:49:02 2008 -0700 +++ b/autoconfiscate.sh Mon Apr 14 14:39:15 2008 -0700 @@ -17,4 +17,12 @@ echo "Running autoconf ..." && echo "Running autoconf ..." && autoconf --force && +if test -x $(which hg); then + hg id -i > .changeset + hg id -n > .revision +else + echo "Unknown" > .changeset + echo "0" > .revision +fi + echo "You may now run ./configure" diff -r 67e30fff0026 -r 606a412caaf4 configure.ac --- a/configure.ac Mon Apr 14 10:49:02 2008 -0700 +++ b/configure.ac Mon Apr 14 14:39:15 2008 -0700 @@ -143,6 +143,7 @@ AC_SUBST(CFLAGS_STRICT) AC_SUBST(CFLAGS_STRICT) CFLAGS="$CFLAGS $CC_WARNINGS" +SET_CSET # Display configuration options echo "----------------------------------------------------------" diff -r 67e30fff0026 -r 606a412caaf4 schema/VirtualSystemManagementService.mof --- a/schema/VirtualSystemManagementService.mof Mon Apr 14 10:49:02 2008 -0700 +++ b/schema/VirtualSystemManagementService.mof Mon Apr 14 14:39:15 2008 -0700 @@ -3,14 +3,29 @@ [Provider("cmpi::Virt_VirtualSystemManagementService")] class Xen_VirtualSystemManagementService : CIM_VirtualSystemManagementService { + [Description("HG changeset id of the providers")] + string Changeset; + + [Description("HG revision number of the providers")] + string Revision; }; [Provider("cmpi::Virt_VirtualSystemManagementService")] class KVM_VirtualSystemManagementService : CIM_VirtualSystemManagementService { + [Description("HG changeset id of the providers")] + string Changeset; + + [Description("HG revision number of the providers")] + string Revision; }; [Provider("cmpi::Virt_VirtualSystemManagementService")] class LXC_VirtualSystemManagementService : CIM_VirtualSystemManagementService { + [Description("HG changeset id of the providers")] + string Changeset; + + [Description("HG revision number of the providers")] + string Revision; }; diff -r 67e30fff0026 -r 606a412caaf4 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Apr 14 10:49:02 2008 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Mon Apr 14 14:39:15 2008 -0700 @@ -1246,6 +1246,12 @@ CMPIStatus get_vsms(const CMPIObjectPath CMSetProperty(inst, "SystemCreationClassName", (CMPIValue *)ccname, CMPI_chars); + CMSetProperty(inst, "Changeset", + (CMPIValue *)LIBVIRT_CIM_CS, CMPI_chars); + + CMSetProperty(inst, "Revision", + (CMPIValue *)LIBVIRT_CIM_RV, CMPI_chars); + if (is_get_inst) { s = cu_validate_ref(broker, reference, inst); if (s.rc != CMPI_RC_OK)