You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(26) |
Dec
(13) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(5) |
Feb
(16) |
Mar
(5) |
Apr
(5) |
May
(13) |
Jun
(12) |
Jul
(1) |
Aug
(2) |
Sep
(13) |
Oct
(6) |
Nov
(1) |
Dec
(29) |
2008 |
Jan
(2) |
Feb
(2) |
Mar
(2) |
Apr
(57) |
May
(35) |
Jun
(45) |
Jul
(132) |
Aug
(87) |
Sep
(141) |
Oct
(86) |
Nov
(17) |
Dec
(2) |
2009 |
Jan
(3) |
Feb
(2) |
Mar
(3) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2010 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <jc...@us...> - 2008-06-02 20:19:12
|
Revision: 632 http://omc.svn.sourceforge.net/omc/?rev=632&view=rev Author: jcarey Date: 2008-06-02 13:19:18 -0700 (Mon, 02 Jun 2008) Log Message: ----------- Fixed bug...segfault when params not specified on CreateVM Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-06-02 20:18:30 UTC (rev 631) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-06-02 20:19:18 UTC (rev 632) @@ -940,7 +940,7 @@ db_delete_dead_job_recs(NULL); param = CMGetArg(in, "VMName", &status); - if (!CMIsNullValue(param)) { + if (status.rc != CMPI_RC_ERR_NOT_FOUND && !CMIsNullValue(param)) { vmname = CMGetCharPtr(param.value.string); } if (!vmname || !strlen(vmname)) { @@ -951,7 +951,7 @@ return status; } param = CMGetArg(in, "NewSystemCreationData", &status); - if (CMIsNullValue(param)) { + if (status.rc == CMPI_RC_ERR_NOT_FOUND || CMIsNullValue(param)) { rv.uint32 = 80; // Param is invalid/missing DEBUGOUT("InvokeMethod: Missing parameter: NewSystemCreationData\n"); CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, @@ -974,7 +974,7 @@ } param = CMGetArg(in, "UUID", &status); - if (!CMIsNullValue(param)) { + if (status.rc != CMPI_RC_ERR_NOT_FOUND && !CMIsNullValue(param)) { uuid = CMGetCharPtr(param.value.string); DEBUGOUT("InvokeMethod(): UUID specified: %s\n", uuid); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-06-02 20:18:24
|
Revision: 631 http://omc.svn.sourceforge.net/omc/?rev=631&view=rev Author: jcarey Date: 2008-06-02 13:18:30 -0700 (Mon, 02 Jun 2008) Log Message: ----------- fixed typo on settings define build reg Modified Paths: -------------- contrib/xen-vm-builder/trunk/mof/XEN_VMBuilder.registration Modified: contrib/xen-vm-builder/trunk/mof/XEN_VMBuilder.registration =================================================================== --- contrib/xen-vm-builder/trunk/mof/XEN_VMBuilder.registration 2008-05-30 23:45:29 UTC (rev 630) +++ contrib/xen-vm-builder/trunk/mof/XEN_VMBuilder.registration 2008-06-02 20:18:30 UTC (rev 631) @@ -10,5 +10,5 @@ XEN_VMBuilderProcessOfJob root/cimv2 cmpixenvmbuilderjob cmpixenvmbuilderjob instance association XEN_VMBuilderOwningJobElement root/cimv2 cmpixenowningjob cmpixenowningjob instance association XEN_VMBuilderVirtualSystemCreationData root/cimv2 cmpixencreationdata cmpixencreationdata instance -XEN_SettingsDefineBuild root/cimv2 cmpixensettingdefinebuild cmpixensettingsdefinebuild instance association +XEN_SettingsDefineBuild root/cimv2 cmpixensettingsdefinebuild cmpixensettingsdefinebuild instance association This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-30 23:45:21
|
Revision: 630 http://omc.svn.sourceforge.net/omc/?rev=630&view=rev Author: jcarey Date: 2008-05-30 16:45:29 -0700 (Fri, 30 May 2008) Log Message: ----------- sfcb transition... Modified Paths: -------------- contrib/xen-vm-builder/trunk/mof/builder-job-peg.reg contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/setting-define-build.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c Added Paths: ----------- contrib/xen-vm-builder/trunk/mof/XEN_VMBuilder.registration contrib/xen-vm-builder/trunk/mof/doreg Added: contrib/xen-vm-builder/trunk/mof/XEN_VMBuilder.registration =================================================================== --- contrib/xen-vm-builder/trunk/mof/XEN_VMBuilder.registration (rev 0) +++ contrib/xen-vm-builder/trunk/mof/XEN_VMBuilder.registration 2008-05-30 23:45:29 UTC (rev 630) @@ -0,0 +1,14 @@ +# Classname Namespace ProviderName ProviderModule ProviderTypes ... + +# ProviderName: Name of the provider +# ProviderModule: Library name without lib prefix or .so suffix +# ProviderTypes: instance association method indication + +XEN_VMBuilderService root/cimv2 cmpixenvmbuilder cmpixenvmbuilder instance method +XEN_VMBuilderHostedService root/cimv2 cmpixenvmbuilder cmpixenvmbuilder instance association +XEN_VMBuilderJob root/cimv2 cmpixenvmbuilderjob cmpixenvmbuilderjob instance method +XEN_VMBuilderProcessOfJob root/cimv2 cmpixenvmbuilderjob cmpixenvmbuilderjob instance association +XEN_VMBuilderOwningJobElement root/cimv2 cmpixenowningjob cmpixenowningjob instance association +XEN_VMBuilderVirtualSystemCreationData root/cimv2 cmpixencreationdata cmpixencreationdata instance +XEN_SettingsDefineBuild root/cimv2 cmpixensettingdefinebuild cmpixensettingsdefinebuild instance association + Modified: contrib/xen-vm-builder/trunk/mof/builder-job-peg.reg =================================================================== --- contrib/xen-vm-builder/trunk/mof/builder-job-peg.reg 2008-05-30 17:31:13 UTC (rev 629) +++ contrib/xen-vm-builder/trunk/mof/builder-job-peg.reg 2008-05-30 23:45:29 UTC (rev 630) @@ -1,7 +1,7 @@ instance of PG_ProviderModule { Name = "OMC_XENVMBuilderJob_Module"; - Location = "omc_xenvmbuilderjob"; + Location = "sblim_xenvmbuilderjob"; Vendor = "OMC"; Version = "1.0.0"; InterfaceType = "CMPI"; Added: contrib/xen-vm-builder/trunk/mof/doreg =================================================================== --- contrib/xen-vm-builder/trunk/mof/doreg (rev 0) +++ contrib/xen-vm-builder/trunk/mof/doreg 2008-05-30 23:45:29 UTC (rev 630) @@ -0,0 +1 @@ +/usr/share/sblim-cmpi-base/provider-register.sh -t sfcb -r XEN_VMBuilder.registration -m XEN_VMBuilder.mof -n root/cimv2 Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am 2008-05-30 17:31:13 UTC (rev 629) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am 2008-05-30 23:45:29 UTC (rev 630) @@ -1,98 +1,98 @@ include $(top_srcdir)/Makefile.incl.am provider_LTLIBRARIES = \ - libsblim_xenvmbuilder.la \ - libsblim_xenvmbuilderjob.la \ - libsblim_xencreationdata.la \ - libsblim_xenowningjob.la \ - libsblim_xensettingsdefinebuild.la + libcmpixenvmbuilder.la \ + libcmpixenvmbuilderjob.la \ + libcmpixencreationdata.la \ + libcmpixenowningjob.la \ + libcmpixensettingsdefinebuild.la lib_LTLIBRARIES = \ - libsblim_xenvmbuilder_common.la + libcmpixenvmbuilder_common.la INCLUDES = -I$(top_builddir) ### -# libsblim_xenvmbuilder_common +# libcmpixenvmbuilder_common ### -libsblim_xenvmbuilder_common_la_SOURCES = \ +libcmpixenvmbuilder_common_la_SOURCES = \ vmbuilder-util.c \ vmbuilder-db.c \ vmbuilder-db.h -libsblim_xenvmbuilder_common_la_LDFLAGS = \ +libcmpixenvmbuilder_common_la_LDFLAGS = \ -lpthread \ -lsblim_cmpiutil \ -lsqlite3 \ -version-info 1 ### -# libsblim_xenvmbuilder +# libcmpixenvmbuilder ### -libsblim_xenvmbuilder_la_SOURCES = \ +libcmpixenvmbuilder_la_SOURCES = \ builder-service.c -libsblim_xenvmbuilder_la_LDFLAGS = \ +libcmpixenvmbuilder_la_LDFLAGS = \ -lpthread \ -lsblim_cmpiutil \ -version-info 1 -libsblim_xenvmbuilder_la_LIBADD = \ - $(top_builddir)/src/providers/vm-builder/libsblim_xenvmbuilder_common.la +libcmpixenvmbuilder_la_LIBADD = \ + $(top_builddir)/src/providers/vm-builder/libcmpixenvmbuilder_common.la ### -# libsblim_xenvmbuilderjob +# libcmpixenvmbuilderjob ### -libsblim_xenvmbuilderjob_la_SOURCES = \ +libcmpixenvmbuilderjob_la_SOURCES = \ builder-job.c -libsblim_xenvmbuilderjob_la_LDFLAGS = \ +libcmpixenvmbuilderjob_la_LDFLAGS = \ -lpthread \ -lsblim_cmpiutil \ -version-info 1 -libsblim_xenvmbuilderjob_la_LIBADD = \ - $(top_builddir)/src/providers/vm-builder/libsblim_xenvmbuilder_common.la +libcmpixenvmbuilderjob_la_LIBADD = \ + $(top_builddir)/src/providers/vm-builder/libcmpixenvmbuilder_common.la ### -# libsblim_xencreationdata +# libcmpixencreationdata ### -libsblim_xencreationdata_la_SOURCES = \ +libcmpixencreationdata_la_SOURCES = \ vmcreation-data.c -libsblim_xencreationdata_la_LDFLAGS = \ +libcmpixencreationdata_la_LDFLAGS = \ -lpthread \ -lsblim_cmpiutil \ -version-info 1 -libsblim_xencreationdata_la_LIBADD = \ - $(top_builddir)/src/providers/vm-builder/libsblim_xenvmbuilder_common.la +libcmpixencreationdata_la_LIBADD = \ + $(top_builddir)/src/providers/vm-builder/libcmpixenvmbuilder_common.la ### -# libsblim_xenowningjob +# libcmpixenowningjob ### -libsblim_xenowningjob_la_SOURCES = \ +libcmpixenowningjob_la_SOURCES = \ owning-job.c -libsblim_xenowningjob_la_LDFLAGS = \ +libcmpixenowningjob_la_LDFLAGS = \ -lpthread \ -lsblim_cmpiutil \ -version-info 1 -libsblim_xenowningjob_la_LIBADD = \ - $(top_builddir)/src/providers/vm-builder/libsblim_xenvmbuilder_common.la +libcmpixenowningjob_la_LIBADD = \ + $(top_builddir)/src/providers/vm-builder/libcmpixenvmbuilder_common.la ### -# libsblim_xensettingsdefinebuild +# libcmpixensettingsdefinebuild ### -libsblim_xensettingsdefinebuild_la_SOURCES = \ +libcmpixensettingsdefinebuild_la_SOURCES = \ setting-define-build.c -libsblim_xensettingsdefinebuild_la_LDFLAGS = \ +libcmpixensettingsdefinebuild_la_LDFLAGS = \ -lpthread \ -lsblim_cmpiutil \ -version-info 1 -libsblim_xensettingsdefinebuild_la_LIBADD = \ - $(top_builddir)/src/providers/vm-builder/libsblim_xenvmbuilder_common.la +libcmpixensettingsdefinebuild_la_LIBADD = \ + $(top_builddir)/src/providers/vm-builder/libcmpixenvmbuilder_common.la Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-30 17:31:13 UTC (rev 629) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-30 23:45:29 UTC (rev 630) @@ -1197,9 +1197,9 @@ return status; } -CMInstanceMIStub( , sblim_xenvmbuilderjob, _broker, Init(&mi)); -CMMethodMIStub( , sblim_xenvmbuilderjob, _broker, MethodInit(&mi)); -CMAssociationMIStub( , sblim_xenvmbuilderjob, _broker, AssocInit(&mi)); +CMInstanceMIStub( , cmpixenvmbuilderjob, _broker, Init(&mi)); +CMMethodMIStub( , cmpixenvmbuilderjob, _broker, MethodInit(&mi)); +CMAssociationMIStub( , cmpixenvmbuilderjob, _broker, AssocInit(&mi)); Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-30 17:31:13 UTC (rev 629) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-30 23:45:29 UTC (rev 630) @@ -1312,9 +1312,9 @@ SETUP CMPI INSTANCE PROVIDER FUNCTION TABLE ******************************************************************************/ -CMInstanceMIStub( , sblim_xenvmbuilder, _broker, Init(&mi)); -CMMethodMIStub( , sblim_xenvmbuilder, _broker, MethodInit(&mi)); -CMAssociationMIStub( , sblim_xenvmbuilder, _broker, AssocInit(&mi)); +CMInstanceMIStub( , cmpixenvmbuilder, _broker, Init(&mi)); +CMMethodMIStub( , cmpixenvmbuilder, _broker, MethodInit(&mi)); +CMAssociationMIStub( , cmpixenvmbuilder, _broker, AssocInit(&mi)); Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c 2008-05-30 17:31:13 UTC (rev 629) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c 2008-05-30 23:45:29 UTC (rev 630) @@ -737,8 +737,8 @@ SETUP CMPI INSTANCE PROVIDER FUNCTION TABLE ******************************************************************************/ -CMInstanceMIStub( , sblim_xenowningjob, _broker, Init(&mi)); -CMAssociationMIStub( , sblim_xenowningjob, _broker, AssocInit(&mi)); +CMInstanceMIStub( , cmpixenowningjob, _broker, Init(&mi)); +CMAssociationMIStub( , cmpixenowningjob, _broker, AssocInit(&mi)); Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/setting-define-build.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/setting-define-build.c 2008-05-30 17:31:13 UTC (rev 629) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/setting-define-build.c 2008-05-30 23:45:29 UTC (rev 630) @@ -795,8 +795,8 @@ /***************************************************************************** SETUP CMPI INSTANCE PROVIDER FUNCTION TABLE ******************************************************************************/ -CMInstanceMIStub( , sblim_xensettingsdefinebuild, _broker, Init(&mi)); -CMAssociationMIStub( , sblim_xensettingsdefinebuild, _broker, AssocInit(&mi)); +CMInstanceMIStub( , cmpixensettingsdefinebuild, _broker, Init(&mi)); +CMAssociationMIStub( , cmpixensettingsdefinebuild, _broker, AssocInit(&mi)); Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c 2008-05-30 17:31:13 UTC (rev 629) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c 2008-05-30 23:45:29 UTC (rev 630) @@ -1365,8 +1365,8 @@ SETUP CMPI INSTANCE PROVIDER FUNCTION TABLE ******************************************************************************/ -CMInstanceMIStub( , sblim_xencreationdata, _broker, Init(&mi)); -CMMethodMIStub( , sblim_xencreationdata, _broker, MethodInit(&mi)); +CMInstanceMIStub( , cmpixencreationdata, _broker, Init(&mi)); +CMMethodMIStub( , cmpixencreationdata, _broker, MethodInit(&mi)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-30 17:31:26
|
Revision: 629 http://omc.svn.sourceforge.net/omc/?rev=629&view=rev Author: jcarey Date: 2008-05-30 10:31:13 -0700 (Fri, 30 May 2008) Log Message: ----------- Moving over to sblim... Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/setting-define-build.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.h contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.h contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am 2008-05-29 18:31:09 UTC (rev 628) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am 2008-05-30 17:31:13 UTC (rev 629) @@ -1,98 +1,98 @@ include $(top_srcdir)/Makefile.incl.am provider_LTLIBRARIES = \ - libomc_xenvmbuilder.la \ - libomc_xenvmbuilderjob.la \ - libomc_xencreationdata.la \ - libomc_xenowningjob.la \ - libomc_xensettingsdefinebuild.la + libsblim_xenvmbuilder.la \ + libsblim_xenvmbuilderjob.la \ + libsblim_xencreationdata.la \ + libsblim_xenowningjob.la \ + libsblim_xensettingsdefinebuild.la lib_LTLIBRARIES = \ - libomc_xenvmbuilder_common.la + libsblim_xenvmbuilder_common.la INCLUDES = -I$(top_builddir) ### -# libomc_xenvmbuilder_common +# libsblim_xenvmbuilder_common ### -libomc_xenvmbuilder_common_la_SOURCES = \ +libsblim_xenvmbuilder_common_la_SOURCES = \ vmbuilder-util.c \ vmbuilder-db.c \ vmbuilder-db.h -libomc_xenvmbuilder_common_la_LDFLAGS = \ +libsblim_xenvmbuilder_common_la_LDFLAGS = \ -lpthread \ - -lomc_cmpi \ + -lsblim_cmpiutil \ -lsqlite3 \ -version-info 1 ### -# libomc_xenvmbuilder +# libsblim_xenvmbuilder ### -libomc_xenvmbuilder_la_SOURCES = \ +libsblim_xenvmbuilder_la_SOURCES = \ builder-service.c -libomc_xenvmbuilder_la_LDFLAGS = \ +libsblim_xenvmbuilder_la_LDFLAGS = \ -lpthread \ - -lomc_cmpi \ + -lsblim_cmpiutil \ -version-info 1 -libomc_xenvmbuilder_la_LIBADD = \ - $(top_builddir)/src/providers/vm-builder/libomc_xenvmbuilder_common.la +libsblim_xenvmbuilder_la_LIBADD = \ + $(top_builddir)/src/providers/vm-builder/libsblim_xenvmbuilder_common.la ### -# libomc_xenvmbuilderjob +# libsblim_xenvmbuilderjob ### -libomc_xenvmbuilderjob_la_SOURCES = \ +libsblim_xenvmbuilderjob_la_SOURCES = \ builder-job.c -libomc_xenvmbuilderjob_la_LDFLAGS = \ +libsblim_xenvmbuilderjob_la_LDFLAGS = \ -lpthread \ - -lomc_cmpi \ + -lsblim_cmpiutil \ -version-info 1 -libomc_xenvmbuilderjob_la_LIBADD = \ - $(top_builddir)/src/providers/vm-builder/libomc_xenvmbuilder_common.la +libsblim_xenvmbuilderjob_la_LIBADD = \ + $(top_builddir)/src/providers/vm-builder/libsblim_xenvmbuilder_common.la ### -# libomc_xencreationdata +# libsblim_xencreationdata ### -libomc_xencreationdata_la_SOURCES = \ +libsblim_xencreationdata_la_SOURCES = \ vmcreation-data.c -libomc_xencreationdata_la_LDFLAGS = \ +libsblim_xencreationdata_la_LDFLAGS = \ -lpthread \ - -lomc_cmpi \ + -lsblim_cmpiutil \ -version-info 1 -libomc_xencreationdata_la_LIBADD = \ - $(top_builddir)/src/providers/vm-builder/libomc_xenvmbuilder_common.la +libsblim_xencreationdata_la_LIBADD = \ + $(top_builddir)/src/providers/vm-builder/libsblim_xenvmbuilder_common.la ### -# libomc_xenowningjob +# libsblim_xenowningjob ### -libomc_xenowningjob_la_SOURCES = \ +libsblim_xenowningjob_la_SOURCES = \ owning-job.c -libomc_xenowningjob_la_LDFLAGS = \ +libsblim_xenowningjob_la_LDFLAGS = \ -lpthread \ - -lomc_cmpi \ + -lsblim_cmpiutil \ -version-info 1 -libomc_xenowningjob_la_LIBADD = \ - $(top_builddir)/src/providers/vm-builder/libomc_xenvmbuilder_common.la +libsblim_xenowningjob_la_LIBADD = \ + $(top_builddir)/src/providers/vm-builder/libsblim_xenvmbuilder_common.la ### -# libomc_xensettingsdefinebuild +# libsblim_xensettingsdefinebuild ### -libomc_xensettingsdefinebuild_la_SOURCES = \ +libsblim_xensettingsdefinebuild_la_SOURCES = \ setting-define-build.c -libomc_xensettingsdefinebuild_la_LDFLAGS = \ +libsblim_xensettingsdefinebuild_la_LDFLAGS = \ -lpthread \ - -lomc_cmpi \ + -lsblim_cmpiutil \ -version-info 1 -libomc_xensettingsdefinebuild_la_LIBADD = \ - $(top_builddir)/src/providers/vm-builder/libomc_xenvmbuilder_common.la +libsblim_xensettingsdefinebuild_la_LIBADD = \ + $(top_builddir)/src/providers/vm-builder/libsblim_xenvmbuilder_common.la Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-29 18:31:09 UTC (rev 628) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-30 17:31:13 UTC (rev 629) @@ -45,12 +45,12 @@ #include <cmpidt.h> #include <cmpift.h> #include <cmpimacs.h> -#include <omc/linuxProcUtils.h> -#include <omc/string.h> -#include <omc/exec.h> -#include <omc/base.h> -#include <omc/cmpiUtils.h> -#include <omc/cmpiSimpleAssoc.h> +#include <cmpiutil/linuxProcUtils.h> +#include <cmpiutil/string.h> +#include <cmpiutil/exec.h> +#include <cmpiutil/base.h> +#include <cmpiutil/cmpiUtils.h> +#include <cmpiutil/cmpiSimpleAssoc.h> /* NULL terminated list of key property names for this class */ @@ -117,21 +117,21 @@ char wkbfr[128]; char hname[256]; - ref = CMNewObjectPath(_broker, ns, "OMC_UnixProcess", + ref = CMNewObjectPath(_broker, ns, "Linux_UnixProcess", pstatus); if (pstatus->rc != CMPI_RC_OK || CMIsNullObject(ref)) { - OMC_SETSTATUS(_broker, pstatus, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, pstatus, CMPI_RC_ERROR_SYSTEM, "Failed creating new object path for process"); return NULL; } - if (!omcGetComputerSystemName(hname, sizeof(hname))) { - omcStrNCpy(hname, "localhost", sizeof(hname)); + if (!cmpiutilGetComputerSystemName(hname, sizeof(hname))) { + cmpiutilStrNCpy(hname, "localhost", sizeof(hname)); } - CMAddKey(ref, "CSCreationClassName", (CMPIValue*)omcGetComputerSystemClassName(), CMPI_chars); + CMAddKey(ref, "CSCreationClassName", (CMPIValue*)cmpiutilGetComputerSystemClassName(), CMPI_chars); CMAddKey(ref, "CSName", (CMPIValue*)hname, CMPI_chars); - CMAddKey(ref, "OSCreationClassName", (CMPIValue*)omcGetOperatingSystemClassName(), CMPI_chars); + CMAddKey(ref, "OSCreationClassName", (CMPIValue*)cmpiutilGetOperatingSystemClassName(), CMPI_chars); CMAddKey(ref, "OSName", (CMPIValue*)"Linux", CMPI_chars); - CMAddKey(ref, "CreationClassName", (CMPIValue*)"OMC_UnixProcess", CMPI_chars); + CMAddKey(ref, "CreationClassName", (CMPIValue*)"Linux_UnixProcess", CMPI_chars); snprintf(wkbfr, sizeof(wkbfr), "%d", pid); CMAddKey(ref, "Handle", (CMPIValue*)wkbfr, CMPI_chars); return ref; @@ -155,38 +155,38 @@ DEBUGOUT("get_job_info called with %s\n", id); memset(pinfo, 0, sizeof(*pinfo)); - if (omcExecuteProcessAndGatherOutputAndError((char* const*)cmd, NULL, &output, + if (cmpiutilExecuteProcessAndGatherOutputAndError((char* const*)cmd, NULL, &output, &output_size, -1, NULL, NULL, -1, NULL, &status, -1) == 0) { //DEBUGOUT("vm-install-jobs -s returned %d - %s\n", status, output); unsigned int num_elements; - lines = omcStrTokenize(output, "\r\n", &num_elements); + lines = cmpiutilStrTokenize(output, "\r\n", &num_elements); if (lines) { int i; for (i = 0; lines[i]; i++) { - if (omcStrStartsWith(lines[i], "vnc ")) { - omcStrNCpy(pinfo->vnc, lines[i]+4, sizeof(pinfo->vnc)); - omcStrTrim(pinfo->vnc); - } else if (omcStrStartsWith(lines[i], "uuid ")) { - omcStrNCpy(pinfo->uuid, lines[i]+5, sizeof(pinfo->uuid)); - omcStrTrim(pinfo->uuid); - } else if (omcStrStartsWith(lines[i], "name ")) { - omcStrNCpy(pinfo->name, lines[i]+5, sizeof(pinfo->name)); - omcStrTrim(pinfo->name); - } else if (omcStrStartsWith(lines[i], "exit ")) { + if (cmpiutilStrStartsWith(lines[i], "vnc ")) { + cmpiutilStrNCpy(pinfo->vnc, lines[i]+4, sizeof(pinfo->vnc)); + cmpiutilStrTrim(pinfo->vnc); + } else if (cmpiutilStrStartsWith(lines[i], "uuid ")) { + cmpiutilStrNCpy(pinfo->uuid, lines[i]+5, sizeof(pinfo->uuid)); + cmpiutilStrTrim(pinfo->uuid); + } else if (cmpiutilStrStartsWith(lines[i], "name ")) { + cmpiutilStrNCpy(pinfo->name, lines[i]+5, sizeof(pinfo->name)); + cmpiutilStrTrim(pinfo->name); + } else if (cmpiutilStrStartsWith(lines[i], "exit ")) { pinfo->exit_code = atoi(lines[i]+5); - } else if (omcStrStartsWith(lines[i], "id ")) { - omcStrNCpy(pinfo->id, lines[i]+3, sizeof(pinfo->id)); - omcStrTrim(pinfo->id); - } else if (omcStrStartsWith(lines[i], "log ")) { - omcStrNCpy(pinfo->log, lines[i]+4, sizeof(pinfo->log)); - omcStrTrim(pinfo->log); - } else if (omcStrStartsWith(lines[i], "state ")) { + } else if (cmpiutilStrStartsWith(lines[i], "id ")) { + cmpiutilStrNCpy(pinfo->id, lines[i]+3, sizeof(pinfo->id)); + cmpiutilStrTrim(pinfo->id); + } else if (cmpiutilStrStartsWith(lines[i], "log ")) { + cmpiutilStrNCpy(pinfo->log, lines[i]+4, sizeof(pinfo->log)); + cmpiutilStrTrim(pinfo->log); + } else if (cmpiutilStrStartsWith(lines[i], "state ")) { pinfo->state = atoi(lines[i]+6); - } else if (omcStrStartsWith(lines[i], "pid ")) { + } else if (cmpiutilStrStartsWith(lines[i], "pid ")) { pinfo->pid = atoi(lines[i]+4); - } else if (omcStrStartsWith(lines[i], "inotify ")) { - omcStrNCpy(pinfo->inotify, lines[i]+8, sizeof(pinfo->inotify)); - omcStrTrim(pinfo->inotify); + } else if (cmpiutilStrStartsWith(lines[i], "inotify ")) { + cmpiutilStrNCpy(pinfo->inotify, lines[i]+8, sizeof(pinfo->inotify)); + cmpiutilStrTrim(pinfo->inotify); } } free(lines); @@ -213,7 +213,7 @@ NULL }; - return omcSafeSystem((char* const*)cmd, NULL); + return cmpiutilSafeSystem((char* const*)cmd, NULL); } /*****************************************************************************/ @@ -227,7 +227,7 @@ NULL }; - return omcSafeSystem((char* const*)cmd, NULL); + return cmpiutilSafeSystem((char* const*)cmd, NULL); } /*****************************************************************************/ @@ -241,7 +241,7 @@ NULL }; - return omcSafeSystem((char* const*)cmd, NULL); + return cmpiutilSafeSystem((char* const*)cmd, NULL); } /*****************************************************************************/ @@ -252,7 +252,7 @@ VMInstallInfo info; CMPIInstance *instance = NULL; if(get_job_info(job_name_key, &info) == 0) { - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderJob", + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderJob", job_class_keys, properties, pstatus); if (pstatus->rc != CMPI_RC_OK || CMIsNullObject(instance)) { DEBUGOUT("_getJobInstance(): CMNewInstance() failed - %d\n", @@ -282,7 +282,7 @@ CMPI_chars); } } else { - OMC_SETSTATUS(_broker, pstatus, CMPI_RC_ERR_NOT_FOUND, + CMPIUTIL_SETSTATUS(_broker, pstatus, CMPI_RC_ERR_NOT_FOUND, "Unable to get job info for job"); } return instance; @@ -321,7 +321,7 @@ if (status.rc != CMPI_RC_OK || CMIsNullObject(ref)) { DEBUGOUT("EnumInstanceNames(): CMNewObjectPath() " "failed - %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating object path"); return status; } @@ -341,7 +341,7 @@ if (status.rc != CMPI_RC_OK || CMIsNullObject(ref)) { DEBUGOUT("EnumInstanceNames(): CMNewObjectPath() " "failed - %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating object path"); return status; } @@ -351,7 +351,7 @@ DEBUGOUT("EnumInstanceNames(): CMNewObjectPath() " "failed creating job ref - %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating job reference"); return status; } @@ -422,12 +422,12 @@ } CMReturnDone(results); } else if (strcasecmp(className, "XEN_VMBuilderProcessOfJob") == 0) { - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderProcessOfJob", + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderProcessOfJob", proc_of_job_class_keys, properties, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { DEBUGOUT("EnumInstances(): failed to create new instance: %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed to create new instance"); return status; } @@ -437,7 +437,7 @@ DEBUGOUT("EnumInstances(): CMNewObjectPath() " "failed creating job ref - %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating job reference"); return status; } @@ -502,14 +502,14 @@ key = CMGetKey(cop, "Name", &status); if (status.rc != CMPI_RC_OK || CMIsNullValue(key)) { DEBUGOUT("GetInstance(): CMGetKey(\"Name\") failed - %d\n", status.rc); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Cannot get 'Name' property"); return status; } job_name_key = CMGetCharPtr(key.value.string); if (!job_name_key || !strlen(job_name_key)) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Empty Name property"); + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Empty Name property"); return status; } @@ -539,7 +539,7 @@ ci = CBGetInstance(_broker, context, job.value.ref, NULL, &lstatus); if (ci == NULL) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Instance does not exists"); return status; } @@ -562,12 +562,12 @@ ci = CBGetInstance(_broker, context, proc.value.ref, NULL, &lstatus); if (ci == NULL) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Instance does not exists"); return status; } - instance = omccmpiNewInstance(_broker, ns, + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderProcessOfJob", proc_of_job_class_keys, properties, &status); @@ -651,7 +651,7 @@ if (strcasecmp(CMGetCharPtr(class), "XEN_VMBuilderJob") != 0) { DEBUGOUT("DeleteInstance() INVALID class name %s\n", CMGetCharPtr(class)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_CLASS, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_CLASS, CMGetCharPtr(class)); return status; } @@ -659,19 +659,19 @@ key = CMGetKey(cop, "Name", &status); if (status.rc != CMPI_RC_OK || CMIsNullValue(key)) { DEBUGOUT("DeleteInstance(): CMGetKey(\"Name\") failed - %d\n", status.rc); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Cannot get 'Name' property from specified object name"); return status; } job_name_key = CMGetCharPtr(key.value.string); if (!job_name_key || !strlen(job_name_key)) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Empty Name property"); + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Empty Name property"); return status; } if(get_job_info(job_name_key, &info) != 0) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Unable to get job information"); return status; } @@ -679,14 +679,14 @@ if (info.state != JOBSTATE_FINISHED && info.state != JOBSTATE_FAILED && info.state != JOBSTATE_CANCELED) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_SUPPORTED, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_SUPPORTED, "Job must be in the FINISHED, FAILED or CANCELED states " "to be deleted"); return status; } if (delete_job(job_name_key) != 0) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_FAILED, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_FAILED, "Unabled to delete job"); return status; } @@ -822,7 +822,7 @@ if (strcasecmp(CMGetCharPtr(class), "XEN_VMBuilderJob") != 0) { DEBUGOUT("InvokeMethod() INVALID class name %s\n", CMGetCharPtr(class)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_CLASS, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_CLASS, CMGetCharPtr(class)); CMReturnData(results, &rv, CMPI_uint32); CMReturnDone(results); @@ -832,7 +832,7 @@ key = CMGetKey(cop, "Name", &status); if (status.rc != CMPI_RC_OK || CMIsNullValue(key)) { DEBUGOUT("InvokeMethod(): CMGetKey(\"Name\") failed - %d\n", status.rc); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Cannot get 'Name' property from specified object name"); CMReturnData(results, &rv, CMPI_uint32); CMReturnDone(results); @@ -841,14 +841,14 @@ job_name_key = CMGetCharPtr(key.value.string); if (!job_name_key || !strlen(job_name_key)) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Empty Name property"); + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Empty Name property"); CMReturnData(results, &rv, CMPI_uint32); CMReturnDone(results); return status; } if(get_job_info(job_name_key, &info) != 0) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Unable to get job information"); CMReturnData(results, &rv, CMPI_uint32); CMReturnDone(results); @@ -877,14 +877,14 @@ } } } else if (strcasecmp("KillJob", methodName) == 0) { - OMC_SETSTATUS(_broker, &status, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_SUPPORTED, "KillJob called, but not supported - Deprecated"); CMLogMessage(_broker, 1, "VMBuilderService provider", "KillJob called, but not supported - Deprecated", NULL); rv.uint32 = 1; // Not supported } else { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, methodName); + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, methodName); rv.uint32 = 1; // Not supported } CMReturnData(results, &rv, CMPI_uint32); @@ -929,7 +929,7 @@ /*****************************************************************************/ static CMPIStatus doReferences( - omccmpiSimpleAssocCtx ctx, + cmpiutilSimpleAssocCtx ctx, CMPIAssociationMI *self, const CMPIBroker *broker, const CMPIContext *context, @@ -955,7 +955,7 @@ DEBUGOUT("doReferences called\n"); object_class_name = CMGetCharPtr(CMGetClassName(cop, NULL)); - if(strcasecmp(object_class_name, "OMC_UnixProcess") == 0) { + if(strcasecmp(object_class_name, "Linux_UnixProcess") == 0) { if (role && *role && strcasecmp(role, "PartComponent") != 0) { /* Unknown role */ return okstatus; @@ -966,7 +966,7 @@ return okstatus; } if (resultClass && *resultClass) { - if (!omccmpiClassIsDerivedFrom("XEN_VMBuilderJob", + if (!cmpiutilClassIsDerivedFrom("XEN_VMBuilderJob", resultClass, _broker, ns, &status)) { return okstatus; } @@ -993,7 +993,7 @@ if (status.rc != CMPI_RC_OK || CMIsNullObject(jobref)) { DEBUGOUT("doReferences(): CMNewObjectPath() " "failed - %d\n", status.rc); - OMC_SETSTATUS(_broker, &status, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating object path"); jobref = NULL; @@ -1007,17 +1007,17 @@ free(names); } if (jobref) { - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderProcessOfJob", + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderProcessOfJob", proc_of_job_class_keys, properties, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { - DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + DEBUGOUT("doReferences(): cmpiutilNewInstance() failed - %s\n", CMGetCharPtr(status.msg)); return status; } CMSetProperty(instance, "GroupComponent", (CMPIValue*)&jobref, CMPI_ref); CMSetProperty(instance, "PartComponent", (CMPIValue*)&cop, CMPI_ref); - omccmpiSimpleAssocResults(ctx, instance, &status); + cmpiutilSimpleAssocResults(ctx, instance, &status); } } else if(strcasecmp(object_class_name, "XEN_VMBuilderJob") == 0) { if (role && *role && strcasecmp(role, "GroupComponent") != 0) { @@ -1030,7 +1030,7 @@ return okstatus; } if (resultClass && *resultClass) { - if (!omccmpiClassIsDerivedFrom("OMC_UnixProcess", + if (!cmpiutilClassIsDerivedFrom("Linux_UnixProcess", resultClass, _broker, ns, &status)) { return okstatus; } @@ -1051,16 +1051,16 @@ if (!procref) { return status; } - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderProcessOfJob", + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderProcessOfJob", proc_of_job_class_keys, properties, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { - DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + DEBUGOUT("doReferences(): cmpiutilNewInstance() failed - %s\n", CMGetCharPtr(status.msg)); return status; } CMSetProperty(instance, "GroupComponent", (CMPIValue*)&cop, CMPI_ref); CMSetProperty(instance, "PartComponent", (CMPIValue*)&procref, CMPI_ref); - omccmpiSimpleAssocResults(ctx, instance, &status); + cmpiutilSimpleAssocResults(ctx, instance, &status); } DEBUGOUT("Leaving doReferences\n"); return okstatus; @@ -1094,7 +1094,7 @@ DEBUGOUT("Associators() called"); - status = omccmpiSimpleAssociators(doReferences, self, + status = cmpiutilSimpleAssociators(doReferences, self, _broker, context, results, cop, assocClass, resultClass, role, resultRole, properties); @@ -1129,7 +1129,7 @@ DEBUGOUT("AssociatorNames() called"); - status = omccmpiSimpleAssociatorNames(doReferences, self, _broker, + status = cmpiutilSimpleAssociatorNames(doReferences, self, _broker, context, results, cop, assocClass, resultClass, role, resultRole); @@ -1160,7 +1160,7 @@ DEBUGOUT("References() called"); - status = omccmpiSimpleReferences( doReferences, self, _broker, context, + status = cmpiutilSimpleReferences( doReferences, self, _broker, context, results, cop, resultClass, role, properties); DEBUGOUT("Leaving References(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); @@ -1190,16 +1190,16 @@ DEBUGOUT("ReferenceNames() called"); - status = omccmpiSimpleReferenceNames( doReferences, self, _broker, + status = cmpiutilSimpleReferenceNames( doReferences, self, _broker, context, results, cop, resultClass, role); DEBUGOUT("Leaving ReferenceNames(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); return status; } -CMInstanceMIStub( , omc_xenvmbuilderjob, _broker, Init(&mi)); -CMMethodMIStub( , omc_xenvmbuilderjob, _broker, MethodInit(&mi)); -CMAssociationMIStub( , omc_xenvmbuilderjob, _broker, AssocInit(&mi)); +CMInstanceMIStub( , sblim_xenvmbuilderjob, _broker, Init(&mi)); +CMMethodMIStub( , sblim_xenvmbuilderjob, _broker, MethodInit(&mi)); +CMAssociationMIStub( , sblim_xenvmbuilderjob, _broker, AssocInit(&mi)); Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-29 18:31:09 UTC (rev 628) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-30 17:31:13 UTC (rev 629) @@ -40,19 +40,15 @@ #include <sys/types.h> #include <sys/wait.h> -//#include <pwd.h> -//#include <time.h> -//#include <signal.h> #include <cmpidt.h> #include <cmpift.h> #include <cmpimacs.h> -//#include <omc/linuxProcUtils.h> -#include <omc/string.h> -#include <omc/exec.h> -#include <omc/base.h> -#include <omc/ioUtils.h> -#include <omc/cmpiUtils.h> -#include <omc/cmpiSimpleAssoc.h> +#include <cmpiutil/string.h> +#include <cmpiutil/exec.h> +#include <cmpiutil/base.h> +#include <cmpiutil/ioUtils.h> +#include <cmpiutil/cmpiUtils.h> +#include <cmpiutil/cmpiSimpleAssoc.h> /* NULL terminated list of key property names for this class */ @@ -102,7 +98,7 @@ size_t NumOsTypes = sizeof(OSTypes) / sizeof(char*); #define SERVICE_NAME "xen-vmbuilder" -#define RPM_NAME "omc-xenvm-builder" +#define RPM_NAME "sblim-xenvm-builder" /* @@ -125,15 +121,15 @@ return NULL; } - if (!omcGetComputerSystemName(hname, sizeof(hname))) { - omcStrNCpy(hname, "localhost", sizeof(hname)); + if (!cmpiutilGetComputerSystemName(hname, sizeof(hname))) { + cmpiutilStrNCpy(hname, "localhost", sizeof(hname)); } CMAddKey(objectpath, "CreationClassName", (CMPIValue*)"XEN_VMBuilderService", CMPI_chars); CMAddKey(objectpath, "Name", (CMPIValue*)SERVICE_NAME, CMPI_chars); CMAddKey(objectpath, "SystemCreationClassName", - (CMPIValue*)omcGetComputerSystemClassName(), CMPI_chars); + (CMPIValue*)cmpiutilGetComputerSystemClassName(), CMPI_chars); CMAddKey(objectpath, "SystemName", (CMPIValue*)hname, CMPI_chars); return objectpath; } @@ -148,15 +144,15 @@ CMPIArray *pra; char hostName[256]; - if (!omcGetComputerSystemName(hostName, sizeof(hostName))) { - omcStrNCpy(hostName, "localhost", sizeof(hostName)); + if (!cmpiutilGetComputerSystemName(hostName, sizeof(hostName))) { + cmpiutilStrNCpy(hostName, "localhost", sizeof(hostName)); } CMSetProperty(instance, "CreationClassName", (CMPIValue*)"XEN_VMBuilderService", CMPI_chars); CMSetProperty(instance, "Name", (CMPIValue*)SERVICE_NAME, CMPI_chars); CMSetProperty(instance, "SystemCreationClassName", - (CMPIValue*)omcGetComputerSystemClassName(), CMPI_chars); + (CMPIValue*)cmpiutilGetComputerSystemClassName(), CMPI_chars); CMSetProperty(instance, "SystemName", (CMPIValue*)hostName, CMPI_chars); pra = CMNewArray(_broker, 1, CMPI_uint16, NULL); wku16 = 2; @@ -172,7 +168,7 @@ CMSetProperty(instance, "EnabledState", (CMPIValue*)&wku16, CMPI_uint16); wku16 = 5; CMSetProperty(instance, "HealthState", (CMPIValue*)&wku16, CMPI_uint16); - datetime = CMNewDateTimeFromBinary(_broker, omcGetRPMInstallDate(RPM_NAME), 0, NULL); + datetime = CMNewDateTimeFromBinary(_broker, cmpiutilGetRPMInstallDate(RPM_NAME), 0, NULL); CMSetProperty(instance, "InstallDate", (CMPIValue*)&datetime, CMPI_dateTime); pra = CMNewArray(_broker, 1, CMPI_uint16, NULL); wku16 = 2; @@ -218,7 +214,7 @@ if ((status.rc != CMPI_RC_OK) || objectpath == NULL) { DEBUGOUT("EnumInstanceNames(): get_service_ref() failed - %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating new object path"); return status; } @@ -230,7 +226,7 @@ if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { DEBUGOUT("EnumInstanceNames(): CMNewObjectPath() failed - %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating new object path"); return status; } @@ -238,14 +234,14 @@ if ((status.rc != CMPI_RC_OK) || depref == NULL) { DEBUGOUT("EnumInstanceNames(): get_service_ref() failed - %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating new object path"); return status; } CMAddKey(objectpath, "Dependent", (CMPIValue*)&depref, CMPI_ref); - antref = omccmpiCreateCSObjectPath(_broker, ns, &status); + antref = cmpiutilCreateCSObjectPath(_broker, ns, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(antref)) { - DEBUGOUT("EnumInstanceNames(): omccmpiCreateCSObjectPath failed - %s\n", + DEBUGOUT("EnumInstanceNames(): cmpiutilcmpiCreateCSObjectPath failed - %s\n", CMGetCharPtr(status.msg)); return status; } @@ -283,7 +279,7 @@ className = (char*) CMGetCharPtr(CMGetClassName(cop, NULL)); if (strcasecmp(className, "XEN_VMBuilderService") == 0) { - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderService", + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderService", service_class_keys, properties, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { DEBUGOUT("EnumInstances(): CMNewInstance() failed - %s\n", CMGetCharPtr(status.msg)); @@ -295,12 +291,12 @@ CMReturnDone(results); } else if (strcasecmp(className, "XEN_VMBuilderHostedService") == 0) { CMPIObjectPath *antref, *depref; - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderHostedService", + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderHostedService", hosted_service_class_keys, properties, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { DEBUGOUT("EnumInstances(): failed to create new instance: %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed to create new instance"); return status; } @@ -308,14 +304,14 @@ if ((status.rc != CMPI_RC_OK) || depref == NULL) { DEBUGOUT("EnumInstances(): get_service_ref() failed - %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating new object path"); return status; } CMSetProperty(instance, "Dependent", (CMPIValue*)&depref, CMPI_ref); - antref = omccmpiCreateCSObjectPath(_broker, ns, &status); + antref = cmpiutilCreateCSObjectPath(_broker, ns, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(antref)) { - DEBUGOUT("EnumInstances(): omccmpiCreateCSObjectPath failed - %s\n", + DEBUGOUT("EnumInstances(): cmpiutilCreateCSObjectPath failed - %s\n", CMGetCharPtr(status.msg)); return status; } @@ -360,12 +356,12 @@ CMGetCharPtr(status.msg)); return status; } - if (!omccmpiAreObjectPathsSame(cop, objectpath, &status)) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + if (!cmpiutilAreObjectPathsSame(cop, objectpath, &status)) { + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Instance does not exists"); return status; } - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderService", + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderService", service_class_keys, properties, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { DEBUGOUT("EnumInstances(): CMNewInstance() failed - %s\n", CMGetCharPtr(status.msg)); @@ -390,18 +386,18 @@ "Antecedent key invalid"); return status; } - objectpath = omccmpiCreateCSObjectPath(_broker, ns, &status); + objectpath = cmpiutilCreateCSObjectPath(_broker, ns, &status); if (status.rc != CMPI_RC_OK || CMIsNullObject(objectpath)) { - DEBUGOUT("GetInstance(): omccmpiCreateCSObjectPath failed - %s\n", + DEBUGOUT("GetInstance(): cmpiutilCreateCSObjectPath failed - %s\n", CMGetCharPtr(status.msg)); return status; } - if (!omccmpiAreObjectPathsSame(antecedent.value.ref, objectpath, &status)) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + if (!cmpiutilAreObjectPathsSame(antecedent.value.ref, objectpath, &status)) { + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Instance does not exists"); return status; } - instance = omccmpiNewInstance(_broker, ns, + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderHostedService", hosted_service_class_keys, properties, &status); CMSetProperty(instance, "Antecedent", (CMPIValue*)&objectpath, CMPI_ref); @@ -427,9 +423,9 @@ CMGetCharPtr(status.msg)); return status; } - if (!omccmpiAreObjectPathsSame(dependent.value.ref, objectpath, + if (!cmpiutilAreObjectPathsSame(dependent.value.ref, objectpath, &status)) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Instance does not exists"); return status; } @@ -596,12 +592,12 @@ create_response_file(const char* rf, char *filename, size_t filename_length, CMPIStatus* pstatus) { - FILE* fd = omcCreateTempFile(filename, filename_length); + FILE* fd = cmpiutilCreateTempFile(filename, filename_length); size_t rflen = strlen(rf); if (fwrite(rf, sizeof(char), rflen, fd) != rflen) { fclose(fd); unlink(filename); - OMC_SETSTATUS(_broker, pstatus, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, pstatus, CMPI_RC_ERROR_SYSTEM, "Failed to create temp file for response file"); return NULL; } @@ -621,7 +617,7 @@ CMPIStatus *pstatus) { CMPIData data; - omcStrArray *pstra; + cmpiutilStrArray *pstra; const char *iid = NULL; const char *os_type; char wkbfr[256]; @@ -638,7 +634,7 @@ iid = CMGetCharPtr(data.value.string); } if (!iid || !strlen(iid)) { - OMC_SETSTATUS(_broker, pstatus, CMPI_RC_ERR_INVALID_PARAMETER, + CMPIUTIL_SETSTATUS(_broker, pstatus, CMPI_RC_ERR_INVALID_PARAMETER, "'InstanceID' is not set on instance"); return NULL; } @@ -646,7 +642,7 @@ data = CMGetProperty(cdci, "OSType", NULL); if (!CMIsNullValue(data)) { if (data.value.uint32 >= NumOsTypes) { - OMC_SETSTATUS(_broker, pstatus, CMPI_RC_ERR_INVALID_PARAMETER, + CMPIUTIL_SETSTATUS(_broker, pstatus, CMPI_RC_ERR_INVALID_PARAMETER, "CreationData has invalid OS type specification"); return NULL; } @@ -654,29 +650,29 @@ } else { os_type = "other"; } - pstra = omcStrArray_create(); + pstra = cmpiutilStrArray_create(); if (!pstra) { - OMC_SETSTATUS(_broker, pstatus, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, pstatus, CMPI_RC_ERROR_SYSTEM, "Failed to create string array object"); return NULL; } - omcStrArray_append(pstra, "/usr/bin/vm-install"); - omcStrArray_append(pstra, "--background"); - omcStrArray_append(pstra, "-n"); - omcStrArray_append(pstra, vmname); - omcStrArray_append(pstra, "--os-type"); - omcStrArray_append(pstra, os_type); + cmpiutilStrArray_append(pstra, "/usr/bin/vm-install"); + cmpiutilStrArray_append(pstra, "--background"); + cmpiutilStrArray_append(pstra, "-n"); + cmpiutilStrArray_append(pstra, vmname); + cmpiutilStrArray_append(pstra, "--os-type"); + cmpiutilStrArray_append(pstra, os_type); if (uuid && strlen(uuid)) { - omcStrArray_append(pstra, "--uuid"); - omcStrArray_append(pstra, uuid); + cmpiutilStrArray_append(pstra, "--uuid"); + cmpiutilStrArray_append(pstra, uuid); } /**** NumVCPUs ****/ data = CMGetProperty(cdci, "NumVCPUs", NULL); if (!CMIsNullValue(data)) { if (data.value.uint8) { snprintf(wkbfr, sizeof(wkbfr), "%u", data.value.uint8); - omcStrArray_append(pstra, "-c"); - omcStrArray_append(pstra, wkbfr); + cmpiutilStrArray_append(pstra, "-c"); + cmpiutilStrArray_append(pstra, wkbfr); } } /**** Disks ****/ @@ -689,8 +685,8 @@ if (!CMIsNullValue(ddata)) { const char* pd = (char*) CMGetCharPtr(ddata.value.string); if (pd && strlen(pd)) { - omcStrArray_append(pstra, "-d"); - omcStrArray_append(pstra, pd); + cmpiutilStrArray_append(pstra, "-d"); + cmpiutilStrArray_append(pstra, pd); } } } @@ -698,36 +694,36 @@ } /**** GraphicsType ****/ data = CMGetProperty(cdci, "GraphicsType", NULL); - omcStrArray_append(pstra, "--graphics"); + cmpiutilStrArray_append(pstra, "--graphics"); if (!CMIsNullValue(data)) { switch(data.value.uint32) { case 1: // cirrus - omcStrArray_append(pstra, "cirrus"); + cmpiutilStrArray_append(pstra, "cirrus"); break; case 3: // para - omcStrArray_append(pstra, "para"); + cmpiutilStrArray_append(pstra, "para"); break; case 4: // vesa - omcStrArray_append(pstra, "vesa"); + cmpiutilStrArray_append(pstra, "vesa"); break; case 2: // none case 0: // Unknown default: // unknown - omcStrArray_append(pstra, "none"); + cmpiutilStrArray_append(pstra, "none"); break; } } else { - omcStrArray_append(pstra, "none"); + cmpiutilStrArray_append(pstra, "none"); } /**** GraphicsViewerType ****/ data = CMGetProperty(cdci, "GraphicsViewerType", NULL); if (!CMIsNullValue(data)) { if (data.value.uint32 == 1) { - omcStrArray_append(pstra, "--graphics-viewer"); - omcStrArray_append(pstra, "sdl"); + cmpiutilStrArray_append(pstra, "--graphics-viewer"); + cmpiutilStrArray_append(pstra, "sdl"); } else if (data.value.uint32 == 2) { - omcStrArray_append(pstra, "--graphics-viewer"); - omcStrArray_append(pstra, "vnc"); + cmpiutilStrArray_append(pstra, "--graphics-viewer"); + cmpiutilStrArray_append(pstra, "vnc"); } } /**** Memory ****/ @@ -735,8 +731,8 @@ if (!CMIsNullValue(data)) { if (data.value.uint32) { snprintf(wkbfr, sizeof(wkbfr), "%u", data.value.uint32); - omcStrArray_append(pstra, "--memory"); - omcStrArray_append(pstra, wkbfr); + cmpiutilStrArray_append(pstra, "--memory"); + cmpiutilStrArray_append(pstra, wkbfr); } } /**** MaxMemory ****/ @@ -744,8 +740,8 @@ if (!CMIsNullValue(data)) { if (data.value.uint32) { snprintf(wkbfr, sizeof(wkbfr), "%u", data.value.uint32); - omcStrArray_append(pstra, "--max-memory"); - omcStrArray_append(pstra, wkbfr); + cmpiutilStrArray_append(pstra, "--max-memory"); + cmpiutilStrArray_append(pstra, wkbfr); } } /**** Nics ****/ @@ -758,8 +754,8 @@ if (!CMIsNullValue(ndata)) { const char* pd = (char*) CMGetCharPtr(ndata.value.string); if (pd) { - omcStrArray_append(pstra, "--nic"); - omcStrArray_append(pstra, pd); + cmpiutilStrArray_append(pstra, "--nic"); + cmpiutilStrArray_append(pstra, pd); } } } @@ -768,17 +764,17 @@ /**** VirtType ****/ data = CMGetProperty(cdci, "VirtType", NULL); if (!CMIsNullValue(data) && data.value.uint32 == 2) { - omcStrArray_append(pstra, "--full-virt"); + cmpiutilStrArray_append(pstra, "--full-virt"); } else { - omcStrArray_append(pstra, "--para-virt"); + cmpiutilStrArray_append(pstra, "--para-virt"); } /**** VNCPort ****/ data = CMGetProperty(cdci, "VNCPort", NULL); if (!CMIsNullValue(data)) { if (data.value.uint32) { snprintf(wkbfr, sizeof(wkbfr), "%u", data.value.uint32); - omcStrArray_append(pstra, "--vnc-port"); - omcStrArray_append(pstra, wkbfr); + cmpiutilStrArray_append(pstra, "--vnc-port"); + cmpiutilStrArray_append(pstra, wkbfr); } } /**** SourceURL ****/ @@ -786,8 +782,8 @@ if (!CMIsNullValue(data)) { const char *su = CMGetCharPtr(data.value.string); if (su && strlen(su)) { - omcStrArray_append(pstra, "-s"); - omcStrArray_append(pstra, su); + cmpiutilStrArray_append(pstra, "-s"); + cmpiutilStrArray_append(pstra, su); } } /**** ExtraInstallArgs ****/ @@ -795,8 +791,8 @@ if (!CMIsNullValue(data)) { const char *xa = CMGetCharPtr(data.value.string); if (xa && strlen(xa)) { - omcStrArray_append(pstra, "-x"); - omcStrArray_append(pstra, xa); + cmpiutilStrArray_append(pstra, "-x"); + cmpiutilStrArray_append(pstra, xa); } } /**** ResponseFile ****/ @@ -806,11 +802,11 @@ if (rf && strlen(rf)) { response_file = create_response_file(rf, rspbfr, sizeof(rspbfr), pstatus); if (!response_file) { - omcStrArray_destroy(pstra); + cmpiutilStrArray_destroy(pstra); return NULL; } - omcStrArray_append(pstra, "--os-settings"); - omcStrArray_append(pstra, response_file); + cmpiutilStrArray_append(pstra, "--os-settings"); + cmpiutilStrArray_append(pstra, response_file); } } @@ -825,12 +821,12 @@ output = NULL; DEBUGOUT("Calling vm-install...\n"); - if (omcExecuteProcessAndGatherOutputAndError((char* const*) pstra->strs, + if (cmpiutilExecuteProcessAndGatherOutputAndError((char* const*) pstra->strs, NULL, &output, &output_size, -1, NULL, NULL, -1, NULL, &cc, -1) == 0) { DEBUGOUT("vm-install returned 0\n"); if (cc == 0 && output) { - const char* job_name = omcStrTrim(output); /* remove \n */ + const char* job_name = cmpiutilStrTrim(output); /* remove \n */ DEBUGOUT("vm-install status is 0\n"); jobref = CMNewObjectPath(_broker, ns, "XEN_VMBUilderJob", pstatus); CMAddKey(jobref, "Name", (CMPIValue*)job_name, CMPI_chars); @@ -852,13 +848,13 @@ "Failed to execute vm-install: %s\n", wkbfr); DEBUGOUT("%s\n", rspbfr); prv->uint32 = 1; - OMC_SETSTATUS(_broker, pstatus, CMPI_RC_ERR_FAILED, rspbfr); + CMPIUTIL_SETSTATUS(_broker, pstatus, CMPI_RC_ERR_FAILED, rspbfr); } if (output) { free(output); } - omcStrArray_destroy(pstra); + cmpiutilStrArray_destroy(pstra); DEBUGOUT("checking for existence response file\n"); if (response_file) { DEBUGOUT("Should have response file %s\n", response_file); @@ -873,7 +869,7 @@ int fail_count = 0; DEBUGOUT("Entering GetInstance loop for Job instance...\n"); while(fail_count < 10) { - omcMilliSleep(1000); + cmpiutilMilliSleep(1000); jobci = CBGetInstance(_broker, context, jobref, NULL, &lstatus); if (jobci == NULL) { @@ -950,7 +946,7 @@ if (!vmname || !strlen(vmname)) { rv.uint32 = 80; // Param is invalid/missing DEBUGOUT("InvokeMethod: Missing parameter: VMName\n"); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, "'VMName' is a required parameter"); return status; } @@ -958,7 +954,7 @@ if (CMIsNullValue(param)) { rv.uint32 = 80; // Param is invalid/missing DEBUGOUT("InvokeMethod: Missing parameter: NewSystemCreationData\n"); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, "'NewSystemCreationData' is a required parameter"); return status; } @@ -967,10 +963,10 @@ if (cdci == NULL) { if (status.rc == CMPI_RC_ERR_NOT_FOUND) { DEBUGOUT("Failed to get creation data instance\n"); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, "'NewSystemCreationData' does not refer to a valid object"); } else { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_FAILED, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_FAILED, "Failed to get XEN_VMBuilderVirtualSystemCreationData " "instance"); } @@ -1005,7 +1001,7 @@ CMLogMessage(_broker, 1, "VMBuilderService provider", "StartService called, but not supported", NULL); rv.uint32 = 1; // Not supported - OMC_SETSTATUS(_broker, &status, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_SUPPORTED, "Cannot start VMBuilder Service. Always running"); rv.uint32 = 1; // Not supported @@ -1014,14 +1010,14 @@ } else if (strcasecmp("StopService", methodName) == 0) { CMLogMessage(_broker, 1, "VMBuilderService provider", "StopService called, but not supported", NULL); - OMC_SETSTATUS(_broker, &status, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_SUPPORTED, "Cannot stop VMBuilder Service. Always running"); rv.uint32 = 1; // Not supported CMReturnData(results, &rv, CMPI_uint32); CMReturnDone(results); } else { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, methodName); + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, methodName); } } DEBUGOUT("Leaving InvokeMethod(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); @@ -1068,7 +1064,7 @@ /*****************************************************************************/ static CMPIStatus doReferences( - omccmpiSimpleAssocCtx ctx, + cmpiutilSimpleAssocCtx ctx, CMPIAssociationMI *self, const CMPIBroker *broker, const CMPIContext *context, @@ -1090,7 +1086,7 @@ char *objsClassName = (char*) CMGetCharPtr(CMGetClassName(cop, NULL)); /* Is target an OS object? */ - if(strcasecmp(objsClassName, "OMC_UnitaryComputerSystem") == 0) { + if(strcasecmp(objsClassName, "Linux_ComputerSystem") == 0) { if (role && *role && strcasecmp(role, "Antecedent") != 0) { /* Unknown role */ return status; @@ -1101,22 +1097,22 @@ return status; } if (resultClass && *resultClass) { - if (!omccmpiClassIsDerivedFrom("XEN_VMBuilderService", + if (!cmpiutilClassIsDerivedFrom("XEN_VMBuilderService", resultClass, _broker, ns, &status)) { return status; } } - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderHostedService", + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderHostedService", hosted_service_class_keys, properties, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { - DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + DEBUGOUT("doReferences(): cmpiutilNewInstance() failed - %s\n", CMGetCharPtr(status.msg)); return status; } - csOp = omccmpiCreateCSObjectPath(_broker, ns, &status); + csOp = cmpiutilCreateCSObjectPath(_broker, ns, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(csOp)) { - DEBUGOUT("doReferences(): omccmpiCreateCSObjectPath failed - %s\n", + DEBUGOUT("doReferences(): cmpiutilCreateCSObjectPath failed - %s\n", CMGetCharPtr(status.msg)); return status; } @@ -1127,12 +1123,12 @@ if ((status.rc != CMPI_RC_OK) || objectpath == NULL) { DEBUGOUT("doReferences(): get_service_ref() failed - %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating new object path"); return status; } CMSetProperty(instance, "Dependent", (CMPIValue*)&objectpath, CMPI_ref); - omccmpiSimpleAssocResults(ctx, instance, &status); + cmpiutilSimpleAssocResults(ctx, instance, &status); } else if(strcasecmp(objsClassName, "XEN_VMBuilderService") == 0) { if (role && *role && strcasecmp(role, "Dependent") != 0) { /* Unknown role */ @@ -1144,22 +1140,22 @@ return status; } if (resultClass && *resultClass) { - if (!omccmpiClassIsDerivedFrom("OMC_UnitaryComputerSystem", + if (!cmpiutilClassIsDerivedFrom("Linux_ComputerSystem", resultClass, _broker, ns, &status)) { return status; } } - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderHostedService", + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderHostedService", hosted_service_class_keys, properties, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { - DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + DEBUGOUT("doReferences(): cmpiutilNewInstance() failed - %s\n", CMGetCharPtr(status.msg)); return status; } - csOp = omccmpiCreateCSObjectPath(_broker, ns, &status); + csOp = cmpiutilCreateCSObjectPath(_broker, ns, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(csOp)) { - DEBUGOUT("doReferences(): omccmpiCreateCSObjectPath failed - %s\n", + DEBUGOUT("doReferences(): cmpiutilCreateCSObjectPath failed - %s\n", CMGetCharPtr(status.msg)); return status; } @@ -1169,12 +1165,12 @@ if ((status.rc != CMPI_RC_OK) || objectpath == NULL) { DEBUGOUT("doReferences(): get_service_ref() failed - %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating new object path"); return status; } CMSetProperty(instance, "Dependent", (CMPIValue*)&objectpath, CMPI_ref); - omccmpiSimpleAssocResults(ctx, instance, &status); + cmpiutilSimpleAssocResults(ctx, instance, &status); } DEBUGOUT("Leaving doReferences\n"); @@ -1209,7 +1205,7 @@ DEBUGOUT("Associators() called"); - status = omccmpiSimpleAssociators(doReferences, self, + status = cmpiutilSimpleAssociators(doReferences, self, _broker, context, results, cop, assocClass, resultClass, role, resultRole, properties); @@ -1244,7 +1240,7 @@ DEBUGOUT("AssociatorNames() called"); - status = omccmpiSimpleAssociatorNames(doReferences, self, _broker, + status = cmpiutilSimpleAssociatorNames(doReferences, self, _broker, context, results, cop, assocClass, resultClass, role, resultRole); @@ -1275,7 +1271,7 @@ DEBUGOUT("References() called"); - status = omccmpiSimpleReferences( doReferences, self, _broker, context, + status = cmpiutilSimpleReferences( doReferences, self, _broker, context, results, cop, resultClass, role, properties); DEBUGOUT("Leaving References(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); @@ -1305,7 +1301,7 @@ DEBUGOUT("ReferenceNames() called"); - status = omccmpiSimpleReferenceNames( doReferences, self, _broker, + status = cmpiutilSimpleReferenceNames( doReferences, self, _broker, context, results, cop, resultClass, role); DEBUGOUT("Leaving ReferenceNames(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); @@ -1316,21 +1312,9 @@ SETUP CMPI INSTANCE PROVIDER FUNCTION TABLE ******************************************************************************/ -/* Macros to create entry points, function tables, etc. - Params: - 1: _optional_ prefix for function names. - 2: the name of the provider (within the cimom - must be unique among all - providers. Recommended: <OMC_FooClass>_Provider - This is the same name that must be used to register the provider - with the cimom - 3: local static variable for CMPIBroker (cimom handle) - Initialized by cimom when the provider is loaded. - 4: provider's additional init function, called right after provider load. - If no additional init is required, specify "CMNoHook" -*/ -CMInstanceMIStub( , omc_xenvmbuilder, _broker, Init(&mi)); -CMMethodMIStub( , omc_xenvmbuilder, _broker, MethodInit(&mi)); -CMAssociationMIStub( , omc_xenvmbuilder, _broker, AssocInit(&mi)); +CMInstanceMIStub( , sblim_xenvmbuilder, _broker, Init(&mi)); +CMMethodMIStub( , sblim_xenvmbuilder, _broker, MethodInit(&mi)); +CMAssociationMIStub( , sblim_xenvmbuilder, _broker, AssocInit(&mi)); Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c 2008-05-29 18:31:09 UTC (rev 628) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c 2008-05-30 17:31:13 UTC (rev 629) @@ -43,12 +43,12 @@ #include <cmpidt.h> #include <cmpift.h> #include <cmpimacs.h> -#include <omc/string.h> -#include <omc/exec.h> -#include <omc/base.h> -#include <omc/ioUtils.h> -#include <omc/cmpiUtils.h> -#include <omc/cmpiSimpleAssoc.h> +#include <cmpiutil/string.h> +#include <cmpiutil/exec.h> +#include <cmpiutil/base.h> +#include <cmpiutil/ioUtils.h> +#include <cmpiutil/cmpiUtils.h> +#include <cmpiutil/cmpiSimpleAssoc.h> static const char* owning_job_class_keys[] = { @@ -126,7 +126,7 @@ if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { DEBUGOUT("EnumInstanceNames(): CMNewObjectPath() failed - %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating new object path"); return status; } @@ -194,12 +194,12 @@ className = (char*) CMGetCharPtr(CMGetClassName(cop, NULL)); if (strcasecmp(className, "XEN_VMBuilderOwningJobElement") == 0) { CMPIObjectPath *jobref, *serviceref; - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderOwningJobElement", + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderOwningJobElement", owning_job_class_keys, properties, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { DEBUGOUT("EnumInstances(): failed to create new instance: %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed to create new instance"); return status; } @@ -282,7 +282,7 @@ ci = CBGetInstance(_broker, context, service.value.ref, NULL, &lstatus); if (ci == NULL) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Instance does not exists"); return status; } @@ -305,12 +305,12 @@ ci = CBGetInstance(_broker, context, job.value.ref, NULL, &lstatus); if (ci == NULL) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Instance does not exists"); return status; } - instance = omccmpiNewInstance(_broker, ns, + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderOwningJobElement", owning_job_class_keys, properties, &status); CMSetProperty(instance, "OwningElement", @@ -481,7 +481,7 @@ /*****************************************************************************/ static CMPIStatus doReferences( - omccmpiSimpleAssocCtx ctx, + cmpiutilSimpleAssocCtx ctx, CMPIAssociationMI *self, const CMPIBroker *broker, const CMPIContext *context, @@ -517,7 +517,7 @@ return status; } if (resultClass && *resultClass) { - if (!omccmpiClassIsDerivedFrom("XEN_VMBuilderJob", + if (!cmpiutilClassIsDerivedFrom("XEN_VMBuilderJob", resultClass, _broker, ns, &status)) { return status; } @@ -530,10 +530,10 @@ return status; } - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderOwningJobElement", + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderOwningJobElement", owning_job_class_keys, properties, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { - DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + DEBUGOUT("doReferences(): cmpiutilNewInstance() failed - %s\n", CMGetCharPtr(status.msg)); return status; } @@ -554,7 +554,7 @@ } else { CMSetProperty(instance, "OwnedElement", (CMPIValue*)&data.value.ref, CMPI_ref); - omccmpiSimpleAssocResults(ctx, instance, &status); + cmpiutilSimpleAssocResults(ctx, instance, &status); } } } else if(strcasecmp(objsClassName, "XEN_VMBuilderJob") == 0) { @@ -568,7 +568,7 @@ return status; } if (resultClass && *resultClass) { - if (!omccmpiClassIsDerivedFrom("XEN_VMBuilderService", + if (!cmpiutilClassIsDerivedFrom("XEN_VMBuilderService", resultClass, _broker, ns, &status)) { return status; } @@ -581,10 +581,10 @@ return status; } - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderOwningJobElement", + instance = cmpiutilNewInstance(_broker, ns, "XEN_VMBuilderOwningJobElement", owning_job_class_keys, properties, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { - DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + DEBUGOUT("doReferences(): cmpiutilNewInstance() failed - %s\n", CMGetCharPtr(status.msg)); return status; } @@ -594,7 +594,7 @@ if (objectpath) { CMSetProperty(instance, "OwningElement", (CMPIValue*)&objectpath, CMPI_ref); - omccmpiSimpleAssocResults(ctx, instance, &status); + cmpiutilSimpleAssocResults(ctx, instance, &status); } } @@ -630,7 +630,7 @@ DEBUGOUT("Associators() called"); - status = omccmpiSimpleAssociators(doReferences, self, + status = cmpiutilSimpleAssociators(doReferences, self, _broker, context, results, cop, assocClass, resultClass, role, resultRole, properties); @@ -665,7 +665,7 @@ DEBUGOUT("AssociatorNames() called"); - status = omccmpiSimpleAssociatorNames(doReferences, self, _broker, + status = cmpiutilSimpleAssociatorNames(doReferences, self, _broker, context, results, cop, assocClass, resultClass, role, resultRole); @@ -696,7 +696,7 @@ DEBUGOUT("References() called"); - status = omccmpiSimpleReferences( doReferences, self, _broker, context, + status = cmpiutilSimpleReferences( doReferences, self, _broker, context, results, cop, resultClass, role, properties); DEBUGOUT("Leaving References(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); @@ -726,7 +726,7 @@ DEBUGOUT("ReferenceNames() called"); - status = omccmpiSimpleReferenceNames( doReferences, self, _broker, + status = cmpiutilSimpleReferenceNames( doReferences, self, _broker, context, results, cop, resultClass, role); DEBUGOUT("Leaving ReferenceNames(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); @@ -737,20 +737,8 @@ SETUP CMPI INSTANCE PROVIDER FUNCTION TABLE ******************************************************************************/ -/* Macros to create entry points, function tables, etc. - Params: - 1: _optional_ prefix for function names. - 2: the name of the provider (within the cimom - must be unique among all - providers. Recommended: <OMC_FooClass>_Provider - This is the same name that must be used to register the provider - with the cimom - 3: local static variable for CMPIBroker (cimom handle) - Initialized by cimom when the provider is loaded. - 4: provider's additional init function, called right after provider load. - If no additional init is required, specify "CMNoHook" -*/ -CMInstanceMIStub( , omc_xenowningjob, _broker, Init(&mi)); -CMAssociationMIStub( , omc_xenowningjob, _broker, AssocInit(&mi)); +CMInstanceMIStub( , sblim_xenowningjob, _broker, Init(&mi)); +CMAssociationMIStub( , sblim_xenowningjob, _broker, AssocInit(&mi)); Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/setting-define-build.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/setting-define-build.c 2008-05-29 18:31:09 UTC (rev 628) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/setting-define-build.c 2008-05-30 17:31:13 UTC (rev 629) @@ -43,12 +43,12 @@ #include <cmpidt.h> #include <cmpift.h> #include <cmpimacs.h> -#include <omc/string.h> -#include <omc/exec.h> -#include <omc/base.h> -#include <omc/ioUtils.h> -#include <omc/cmpiUtils.h> -#include <omc/cmpiSimpleAssoc.h> +#include <cmpiutil/string.h> +#include <cmpiutil/exec.h> +#include <cmpiutil/base.h> +#include <cmpiutil/ioUtils.h> +#include <cmpiutil/cmpiUtils.h> +#include <cmpiutil/cmpiSimpleAssoc.h> static const char* the_class_keys[] = { @@ -98,7 +98,7 @@ if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { DEBUGOUT("EnumInstanceNames(): CMNewObjectPath() failed - %s\n", CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, "Failed creating new object path"); return status; } @@ -110,7 +110,7 @@ if (cc != 0) { DEBUGOUT("EnumInstanceNames(): Failed to connect to " "database: %s\n", err_msg); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, err_msg); + CMPIUTIL_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, err_msg); return status; } @@ -168,12 +168,12 @@ className = (char*) CMGetCharPtr(CMGetClassName(cop, NULL)); if (strcasecmp(className, "XEN_SettingsDefineBuild") == 0) { - instance = omccmpiNewInstance(_broker, ns, "XEN_SettingsDefineBuild", + instance = cmpiutilNewInstance(_broker, ns, "XEN_SettingsDefineBuild", the_class_keys, properties, &status); if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { DEBU... [truncated message content] |
From: <jc...@us...> - 2008-05-29 18:31:05
|
Revision: 628 http://omc.svn.sourceforge.net/omc/?rev=628&view=rev Author: jcarey Date: 2008-05-29 11:31:09 -0700 (Thu, 29 May 2008) Log Message: ----------- Tagged before transition to SFCB. Added Paths: ----------- contrib/xen-vm-builder/tags/PRE-SFCB/ Copied: contrib/xen-vm-builder/tags/PRE-SFCB (from rev 627, contrib/xen-vm-builder/trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-29 17:19:23
|
Revision: 627 http://omc.svn.sourceforge.net/omc/?rev=627&view=rev Author: jcarey Date: 2008-05-29 10:19:11 -0700 (Thu, 29 May 2008) Log Message: ----------- clean up Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-29 17:03:16 UTC (rev 626) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-29 17:19:11 UTC (rev 627) @@ -855,8 +855,7 @@ return status; } - if (strcasecmp("Cancel", methodName) == 0) - { + if (strcasecmp("Cancel", methodName) == 0) { DEBUGOUT("InvokeMethod(): Cancel called for job %s\n", job_name_key); cc = cancel_job(job_name_key); if (cc != 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-29 17:03:08
|
Revision: 626 http://omc.svn.sourceforge.net/omc/?rev=626&view=rev Author: jcarey Date: 2008-05-29 10:03:16 -0700 (Thu, 29 May 2008) Log Message: ----------- Removed code to delete job on cancel call Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-28 22:32:23 UTC (rev 625) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-29 17:03:16 UTC (rev 626) @@ -863,7 +863,6 @@ rv.uint32 = 4; } else { rv.uint32 = 0; - delete_job(job_name_key); } } else if (strcasecmp("Detach", methodName) == 0) { DEBUGOUT("InvokeMethod(): Detach called for job %s\n", job_name_key); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-28 22:32:16
|
Revision: 625 http://omc.svn.sourceforge.net/omc/?rev=625&view=rev Author: jcarey Date: 2008-05-28 15:32:23 -0700 (Wed, 28 May 2008) Log Message: ----------- Added new mof files to Makefile.am Modified Paths: -------------- contrib/xen-vm-builder/trunk/mof/Makefile.am Modified: contrib/xen-vm-builder/trunk/mof/Makefile.am =================================================================== --- contrib/xen-vm-builder/trunk/mof/Makefile.am 2008-05-28 22:30:03 UTC (rev 624) +++ contrib/xen-vm-builder/trunk/mof/Makefile.am 2008-05-28 22:32:23 UTC (rev 625) @@ -1,9 +1,15 @@ EXTRA_DIST = \ XEN_SettingsDefineBuild.mof \ XEN_VMBuilder.mof \ + XEN_VMBuilderHostedService.mof \ XEN_VMBuilderJob.mof \ XEN_VMBuilderOwningJobElement.mof \ XEN_VMBuilderProcessOfJob.mof \ XEN_VMBuilderService.mof \ - XEN_VMBuilderHostedService.mof \ - XEN_VMBuilderVirtualSystemCreationData.mof + XEN_VMBuilderVirtualSystemCreationData.mof \ + builder-job-peg.reg \ + builder-service-peg.reg \ + owning-job-peg.reg \ + settings-define-build-peg.reg \ + vmcreation-data-peg.reg + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-28 22:30:07
|
Revision: 624 http://omc.svn.sourceforge.net/omc/?rev=624&view=rev Author: jcarey Date: 2008-05-28 15:30:03 -0700 (Wed, 28 May 2008) Log Message: ----------- Bug fixes and implementation of the settingsdefinebuild association Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.h contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c Added Paths: ----------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/setting-define-build.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am 2008-05-28 17:46:24 UTC (rev 623) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am 2008-05-28 22:30:03 UTC (rev 624) @@ -4,7 +4,8 @@ libomc_xenvmbuilder.la \ libomc_xenvmbuilderjob.la \ libomc_xencreationdata.la \ - libomc_xenowningjob.la + libomc_xenowningjob.la \ + libomc_xensettingsdefinebuild.la lib_LTLIBRARIES = \ libomc_xenvmbuilder_common.la @@ -12,6 +13,20 @@ INCLUDES = -I$(top_builddir) ### +# libomc_xenvmbuilder_common +### +libomc_xenvmbuilder_common_la_SOURCES = \ + vmbuilder-util.c \ + vmbuilder-db.c \ + vmbuilder-db.h + +libomc_xenvmbuilder_common_la_LDFLAGS = \ + -lpthread \ + -lomc_cmpi \ + -lsqlite3 \ + -version-info 1 + +### # libomc_xenvmbuilder ### libomc_xenvmbuilder_la_SOURCES = \ @@ -68,19 +83,16 @@ $(top_builddir)/src/providers/vm-builder/libomc_xenvmbuilder_common.la ### -# libomc_xenvmbuilder_common +# libomc_xensettingsdefinebuild ### -libomc_xenvmbuilder_common_la_SOURCES = \ - vmbuilder-util.c \ - vmbuilder-db.c \ - vmbuilder-db.h +libomc_xensettingsdefinebuild_la_SOURCES = \ + setting-define-build.c -libomc_xenvmbuilder_common_la_LDFLAGS = \ +libomc_xensettingsdefinebuild_la_LDFLAGS = \ -lpthread \ -lomc_cmpi \ - -lsqlite3 \ -version-info 1 +libomc_xensettingsdefinebuild_la_LIBADD = \ + $(top_builddir)/src/providers/vm-builder/libomc_xenvmbuilder_common.la - - Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-28 17:46:24 UTC (rev 623) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-28 22:30:03 UTC (rev 624) @@ -317,7 +317,7 @@ DEBUGOUT("EnumInstanceNames() called class:%s\n", className); if (strcasecmp(className, "XEN_VMBuilderJob") == 0) { CMPIObjectPath* ref = CMNewObjectPath(_broker, ns, - "XEN_VMBUilderJob", &status); + "XEN_VMBuilderJob", &status); if (status.rc != CMPI_RC_OK || CMIsNullObject(ref)) { DEBUGOUT("EnumInstanceNames(): CMNewObjectPath() " "failed - %s\n", CMGetCharPtr(status.msg)); @@ -346,7 +346,7 @@ return status; } CMPIObjectPath* jobref = CMNewObjectPath(_broker, ns, - "XEN_VMBUilderJob", &status); + "XEN_VMBuilderJob", &status); if (status.rc != CMPI_RC_OK || CMIsNullObject(jobref)) { DEBUGOUT("EnumInstanceNames(): CMNewObjectPath() " "failed creating job ref - %s\n", @@ -432,7 +432,7 @@ return status; } CMPIObjectPath* jobref = CMNewObjectPath(_broker, ns, - "XEN_VMBUilderJob", &status); + "XEN_VMBuilderJob", &status); if (status.rc != CMPI_RC_OK || CMIsNullObject(jobref)) { DEBUGOUT("EnumInstances(): CMNewObjectPath() " "failed creating job ref - %s\n", @@ -727,7 +727,7 @@ DEBUGOUT("Initialize() called\n"); DEBUGOUT("Deleting job xref recs that no longer exist\n"); - db_delete_dead_job_recs(); + db_delete_dead_job_recs(NULL); DEBUGOUT("Leaving Initialize()\n"); } @@ -991,7 +991,7 @@ if(get_job_info(names[i], &info) == 0) { if (info.pid == pid) { jobref = CMNewObjectPath(_broker, ns, - "XEN_VMBUilderJob", &status); + "XEN_VMBuilderJob", &status); if (status.rc != CMPI_RC_OK || CMIsNullObject(jobref)) { DEBUGOUT("doReferences(): CMNewObjectPath() " "failed - %d\n", status.rc); Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-28 17:46:24 UTC (rev 623) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-28 22:30:03 UTC (rev 624) @@ -830,12 +830,13 @@ NULL, &cc, -1) == 0) { DEBUGOUT("vm-install returned 0\n"); if (cc == 0 && output) { + const char* job_name = omcStrTrim(output); /* remove \n */ DEBUGOUT("vm-install status is 0\n"); jobref = CMNewObjectPath(_broker, ns, "XEN_VMBUilderJob", pstatus); - CMAddKey(jobref, "Name", (CMPIValue*)output, CMPI_chars); + CMAddKey(jobref, "Name", (CMPIValue*)job_name, CMPI_chars); prv->uint32 = 0; /* Create createdata/job xref record */ - db_add_job_to_creation_data(iid, output); + db_add_job_to_creation_data(iid, job_name); } else { prv->uint32 = (CMPIUint32)WEXITSTATUS(cc); DEBUGOUT("vm-install failed status: %u\n", prv->uint32); @@ -884,8 +885,7 @@ data = CMGetProperty(jobci, "JobStatus", NULL); if (!CMIsNullValue(data)) { const char *p = CMGetCharPtr(data.value.string); - if (strcasecmp(p, "SETTINGS") - && strcasecmp(p, "PREP_INSTALL")) { + if (strcasecmp(p, "SETTINGS") == 0) { DEBUGOUT("Still to soon to delete Response file\n"); continue; } @@ -942,7 +942,7 @@ const char *vmname = NULL; const char *uuid = NULL; - db_delete_dead_job_recs(); + db_delete_dead_job_recs(NULL); param = CMGetArg(in, "VMName", &status); if (!CMIsNullValue(param)) { vmname = CMGetCharPtr(param.value.string); @@ -1175,9 +1175,6 @@ } CMSetProperty(instance, "Dependent", (CMPIValue*)&objectpath, CMPI_ref); omccmpiSimpleAssocResults(ctx, instance, &status); - } else { - DEBUGOUT("!!! Object type unknown: %s\n", objsClassName); - return status; } DEBUGOUT("Leaving doReferences\n"); Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c 2008-05-28 17:46:24 UTC (rev 623) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c 2008-05-28 22:30:03 UTC (rev 624) @@ -416,6 +416,8 @@ { DEBUGOUT("Initialize() called\n"); + db_delete_dead_job_recs(NULL); + DEBUGOUT("Leaving Initialize()\n"); } @@ -591,12 +593,9 @@ objectpath = get_service_ref(context, ns); if (objectpath) { CMSetProperty(instance, "OwningElement", - (CMPIValue*)&data.value.ref, CMPI_ref); + (CMPIValue*)&objectpath, CMPI_ref); omccmpiSimpleAssocResults(ctx, instance, &status); } - } else { - DEBUGOUT("!!! Object type unknown: %s\n", objsClassName); - return status; } DEBUGOUT("Leaving doReferences\n"); Added: contrib/xen-vm-builder/trunk/src/providers/vm-builder/setting-define-build.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/setting-define-build.c (rev 0) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/setting-define-build.c 2008-05-28 22:30:03 UTC (rev 624) @@ -0,0 +1,803 @@ +/******************************************************************************* +* Copyright (C) 2005,2006,2007,2008 Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell, Inc. nor the names of its +* contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +* Author: Jon Carey (jc...@no...) +******************************************************************************/ +#include "config.h" +#include "vmbuilder-util.h" + +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <limits.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/wait.h> + +#include <cmpidt.h> +#include <cmpift.h> +#include <cmpimacs.h> +#include <omc/string.h> +#include <omc/exec.h> +#include <omc/base.h> +#include <omc/ioUtils.h> +#include <omc/cmpiUtils.h> +#include <omc/cmpiSimpleAssoc.h> + +static const char* the_class_keys[] = +{ + "ManagedElement", + "SettingData", + NULL +}; + +/* + * Global handle to the CIM broker + * This is initialized by the CIMOM when the provider is loaded + */ +static const CMPIBroker* _broker; + +/****************************************************************************** + CMPI INSTANCE PROVIDER FUNCTIONS +******************************************************************************/ + +/****************************************************************************** +EnumInstanceNames() + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char **properties: [in] propertylist filter, null=all +******************************************************************************/ +static CMPIStatus +EnumInstanceNames( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + CMPIStatus lstatus = {CMPI_RC_OK, NULL}; + CMPIObjectPath *objectpath, *wkref; + char *ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); + char *className, err_msg[256]; + VMBDBCtx dbctx; + int cc; + + DEBUGOUT("EnumInstanceNames() called\n"); + + className = (char*) CMGetCharPtr(CMGetClassName(cop, NULL)); + if (strcasecmp(className, "XEN_SettingsDefineBuild") == 0) { + objectpath = CMNewObjectPath(_broker, ns, "XEN_SettingsDefineBuild", &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { + DEBUGOUT("EnumInstanceNames(): CMNewObjectPath() failed - %s\n", + CMGetCharPtr(status.msg)); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + "Failed creating new object path"); + return status; + } + + db_delete_dead_job_recs(NULL); + cc = db_create_select_results(&dbctx, + "SELECT JobName,CreationDataInstanceID FROM Job", + err_msg, sizeof(err_msg)); + if (cc != 0) { + DEBUGOUT("EnumInstanceNames(): Failed to connect to " + "database: %s\n", err_msg); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, err_msg); + return status; + } + + while (db_results_have_more_rows(dbctx)) { + const unsigned char* job_name = db_get_results_column_text(dbctx, 0, NULL); + const unsigned char* cdid = db_get_results_column_text(dbctx, 1, NULL); + if (job_name && cdid) { + wkref = CMNewObjectPath(_broker, ns, + "XEN_VMBuilderVirtualSystemCreationData", + &lstatus); + CMAddKey(wkref, "InstanceID", (CMPIValue*)cdid, CMPI_chars); + CMAddKey(objectpath, "SettingData", (CMPIValue*)&wkref, CMPI_ref); + wkref = CMNewObjectPath(_broker, ns, "XEN_VMBuilderJob", + &lstatus); + CMAddKey(wkref, "Name", (CMPIValue*)job_name, CMPI_chars); + CMAddKey(objectpath, "ManagedElement", (CMPIValue*)&wkref, CMPI_ref); + CMReturnObjectPath(results, objectpath); + } + db_results_next_row(dbctx); + } + db_destroy_select_results(dbctx); + CMReturnDone(results); + } + DEBUGOUT("Leaving EnumInstanceNames(): %s\n", + (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + return status; +} + +/****************************************************************************** +EnumInstances() + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char **properties: [in] propertylist filter, null=all +******************************************************************************/ +static CMPIStatus +EnumInstances( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + CMPIStatus lstatus = {CMPI_RC_OK, NULL}; + char * ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); + CMPIInstance* instance; + CMPIObjectPath *wkref; + char *className, err_msg[256]; + VMBDBCtx dbctx; + int cc; + + DEBUGOUT("EnumInstances() called\n"); + + className = (char*) CMGetCharPtr(CMGetClassName(cop, NULL)); + if (strcasecmp(className, "XEN_SettingsDefineBuild") == 0) { + instance = omccmpiNewInstance(_broker, ns, "XEN_SettingsDefineBuild", + the_class_keys, properties, &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { + DEBUGOUT("EnumInstances(): failed to create new instance: %s\n", + CMGetCharPtr(status.msg)); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + "Failed to create new instance"); + return status; + } + + db_delete_dead_job_recs(NULL); + cc = db_create_select_results(&dbctx, + "SELECT JobName,CreationDataInstanceID FROM Job", + err_msg, sizeof(err_msg)); + if (cc != 0) { + DEBUGOUT("EnumInstances(): Failed to connect to " + "database: %s\n", err_msg); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, err_msg); + return status; + } + + while (db_results_have_more_rows(dbctx)) { + const unsigned char* job_name = db_get_results_column_text(dbctx, 0, NULL); + const unsigned char* cdid = db_get_results_column_text(dbctx, 1, NULL); + if (job_name && cdid) { + wkref = CMNewObjectPath(_broker, ns, + "XEN_VMBuilderVirtualSystemCreationData", + &lstatus); + CMAddKey(wkref, "InstanceID", (CMPIValue*)cdid, CMPI_chars); + CMSetProperty(instance, "SettingData", + (CMPIValue*)&wkref, CMPI_ref); + wkref = CMNewObjectPath(_broker, ns, "XEN_VMBuilderJob", + &lstatus); + CMAddKey(wkref, "Name", (CMPIValue*)job_name, CMPI_chars); + CMSetProperty(instance, "ManagedElement", + (CMPIValue*)&wkref, CMPI_ref); + CMReturnInstance(results, instance); + } + db_results_next_row(dbctx); + } + db_destroy_select_results(dbctx); + CMReturnDone(results); + } + DEBUGOUT("Leaving EnumInstances(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + return status; +} + + +/****************************************************************************** +GetInstance() + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char **properties: [in] propertylist filter, null=all +******************************************************************************/ +static CMPIStatus +GetInstance( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char** properties) +{ + CMPIInstance *instance; + CMPIStatus status = {CMPI_RC_OK, NULL}; + char *ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); + char *sql, err_msg[256]; + const char *className; + VMBDBCtx dbctx; + int cc; + + DEBUGOUT("GetInstance() called\n"); + + className = CMGetCharPtr(CMGetClassName(cop, NULL)); + if (strcasecmp(className, "XEN_SettingsDefineBuild") == 0) { + CMPIData key; + CMPIData jobrefdata, cdrefdata; + const char *job_name_key, *cdiid; + + /* Get the Job reference for the given REF */ + + jobrefdata = CMGetKey(cop, "ManagedElement", &status); + if (status.rc != CMPI_RC_OK || CMIsNullValue(jobrefdata)) { + DEBUGOUT("GetInstance(): CMGetKey(\"ManagedElement\") " + "failed - %s\n", CMGetCharPtr(status.msg)); + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_NO_SUCH_PROPERTY, + "ManagedElement missing"); + return status; + } + if (jobrefdata.type != CMPI_ref) { + DEBUGOUT("GetInstance(): Invalid 'ManagedElement' key " + "property type\n"); + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, + "ManagedElement key invalid"); + return status; + } + + key = CMGetKey(jobrefdata.value.ref, "Name", &status); + if (status.rc != CMPI_RC_OK || CMIsNullValue(key)) { + DEBUGOUT("GetInstance. 'Name' prop missing from ManagedElement REF\n"); + CMSetStatus(&status, CMPI_RC_ERR_NOT_FOUND); + return status; + } + + job_name_key = CMGetCharPtr(key.value.string); + if (!job_name_key || !strlen(job_name_key)) { + DEBUGOUT("GetInstance. Empty 'Name' prop on ManagedElement REF\n"); + CMSetStatus(&status, CMPI_RC_ERR_NOT_FOUND); + return status; + } + + /* Get the CreationData reference for the given REF */ + + cdrefdata = CMGetKey(cop, "SettingData", &status); + if (status.rc != CMPI_RC_OK || CMIsNullValue(cdrefdata)) { + DEBUGOUT("GetInstance(): CMGetKey(\"SettingData\") " + "failed - %s\n", CMGetCharPtr(status.msg)); + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_NO_SUCH_PROPERTY, + "SettingData missing"); + return status; + } + if (cdrefdata.type != CMPI_ref) { + DEBUGOUT("GetInstance(): Invalid 'SettingData' key " + "property type\n"); + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, + "SettingData key invalid"); + return status; + } + + key = CMGetKey(cdrefdata.value.ref, "InstanceID", &status); + if (status.rc != CMPI_RC_OK || CMIsNullValue(key)) { + DEBUGOUT("GetInstance. 'InstanceID' prop missing from SettingData REF\n"); + CMSetStatus(&status, CMPI_RC_ERR_NOT_FOUND); + return status; + } + + cdiid = CMGetCharPtr(key.value.string); + if (!cdiid || !strlen(cdiid)) { + DEBUGOUT("GetInstance. Empty 'InstanceID' prop on SettingData REF\n"); + CMSetStatus(&status, CMPI_RC_ERR_NOT_FOUND); + return status; + } + + sql = db_create_formatted_sql("SELECT CreationDataInstanceID FROM " + "Job WHERE JobName=%Q AND CreationDataInstanceID=%Q;", + job_name_key, cdiid); + + cc = db_create_select_results(&dbctx, sql, err_msg, sizeof(err_msg)); + db_destroy_formatted_sql(sql); + if (cc != 0) { + DEBUGOUT("GetInstance(): Failed to connect to database: %s\n", + err_msg); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, err_msg); + return status; + } + + if (db_results_have_more_rows(dbctx)) { + instance = omccmpiNewInstance(_broker, ns, + "XEN_SettingsDefineBuild", + the_class_keys, properties, &status); + CMSetProperty(instance, "ManagedElement", + (CMPIValue*)&jobrefdata.value.ref, CMPI_ref); + CMSetProperty(instance, "SettingData", + (CMPIValue*)&cdrefdata.value.ref, CMPI_ref); + CMReturnInstance(results, instance); + } else { + DEBUGOUT("GetInstance(): Not found. Job: %s CreationData: %s\n", + job_name_key, cdiid); + CMSetStatus(&status, CMPI_RC_ERR_NOT_FOUND); + } + db_destroy_select_results(dbctx); + } + DEBUGOUT("Leaving GetInstance(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + return status; +} + +/****************************************************************************** +ModifyInstance() - modify instance + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and objectpath + CMPIInstance* newInst: [in] new (modified) instance data +******************************************************************************/ +static CMPIStatus +ModifyInstance( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const CMPIInstance* newinstance, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + return status; +} + + +/****************************************************************************** +CreateInstance() + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and objectpath + CMPIInstance* newInst: [in] new instance data +******************************************************************************/ +static CMPIStatus +CreateInstance( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const CMPIInstance* newinstance) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + return status; +} + + +/****************************************************************************** +DeleteInstance() + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname +******************************************************************************/ +static CMPIStatus +DeleteInstance( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + return status; +} + +/****************************************************************************** +ExecQuery() - like getInstance, but that match query + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname + char *language: [in] query language, ie "WQL" + char *query: [in] text of query, in <query language> +******************************************************************************/ +static CMPIStatus +ExecQuery( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char* language, + const char* query) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + return status; +} + +/****************************************************************************** + Init() + params: CMPIInstanceMI* self: [in] Handle to this provider +******************************************************************************/ +static void +Init( + CMPIInstanceMI* self) +{ + DEBUGOUT("Initialize() called\n"); + + db_delete_dead_job_recs(NULL); + + DEBUGOUT("Leaving Initialize()\n"); +} + +/****************************************************************************** +Cleanup() - pre unload + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIBoolean terminating +******************************************************************************/ +static CMPIStatus +Cleanup( + CMPIInstanceMI* self, + const CMPIContext* context, + CMPIBoolean terminating) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("Cleanup() called\n"); + + DEBUGOUT("Leaving Cleanup(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + return status; +} + +/****************************************************************************** +CMPI ASSOCIATION PROVIDER FUNCTIONS +******************************************************************************/ + +/****************************************************************************** +AssocInit() - init + params: CMPIAssociationMI* self: [in] Handle to this provider +******************************************************************************/ +static void +AssocInit( + CMPIAssociationMI* self) +{ + DEBUGOUT("AssocInit() called"); + + DEBUGOUT("Leaving AssocInit()\n"); +} + +/****************************************************************************** +AssociationCleanup() - pre unload + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIBoolean terminating +******************************************************************************/ +static CMPIStatus +AssociationCleanup( + CMPIAssociationMI* self, + const CMPIContext* context, + CMPIBoolean terminating) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("AssociationCleanup() called"); + + DEBUGOUT("Leaving AssociationCleanup(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + return status; +} + +/*****************************************************************************/ +static CMPIStatus +doReferences( + omccmpiSimpleAssocCtx ctx, + CMPIAssociationMI *self, + const CMPIBroker *broker, + const CMPIContext *context, + const CMPIResult *results, + const CMPIObjectPath *cop, + const char *assocClass, + const char *resultClass, + const char *role, + const char *resultRole, + const char **properties) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + CMPIStatus lstatus = {CMPI_RC_OK, NULL}; + char * ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); + CMPIObjectPath *objectpath; + CMPIInstance *instance; + VMBDBCtx dbctx; + char err_msg[256]; + + CMPIData key; + char* sql; + const char* job_name_key; + const char* iid; + int cc; + + DEBUGOUT("doReferences called\n"); + + char *objsClassName = (char*) CMGetCharPtr(CMGetClassName(cop, NULL)); + + /* Is target an VM Builder Job object? */ + if(strcasecmp(objsClassName, "XEN_VMBuilderJob") == 0) { + if (role && *role && strcasecmp(role, "ManagedElement") != 0) { + /* Unknown role */ + return status; + } + if (resultRole && *resultRole && strcasecmp(resultRole, + "SettingData") != 0) { + /* Unknown resultRole */ + return status; + } + if (resultClass && *resultClass) { + if (!omccmpiClassIsDerivedFrom("XEN_VMBuilderVirtualSystemCreationData", + resultClass, _broker, ns, &status)) { + return status; + } + } + + key = CMGetKey(cop, "Name", &lstatus); + if (lstatus.rc != CMPI_RC_OK || CMIsNullValue(key)) { + return status; + } + job_name_key = CMGetCharPtr(key.value.string); + if (!job_name_key || !strlen(job_name_key)) { + return status; + } + + instance = omccmpiNewInstance(_broker, ns, "XEN_SettingsDefineBuild", + the_class_keys, properties, &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { + DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + CMGetCharPtr(status.msg)); + return status; + } + CMSetProperty(instance, "ManagedElement", (CMPIValue*)&cop, CMPI_ref); + + sql = db_create_formatted_sql("SELECT CreationDataInstanceID FROM " + "Job WHERE JobName=%Q;", job_name_key); + cc = db_create_select_results(&dbctx, sql, err_msg, sizeof(err_msg)); + db_destroy_formatted_sql(sql); + if (cc != 0) { + DEBUGOUT("doReferences(): Failed to connect to database: %s\n", + err_msg); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, err_msg); + return status; + } + + if (db_results_have_more_rows(dbctx)) { + const unsigned char* txt = db_get_results_column_text(dbctx, 0, NULL); + if (txt) { + objectpath = CMNewObjectPath(_broker, ns, + "XEN_VMBuilderVirtualSystemCreationData", + &lstatus); + CMAddKey(objectpath, "InstanceID", (CMPIValue*)txt, CMPI_chars); + CMSetProperty(instance, "SettingData", + (CMPIValue*)&objectpath, CMPI_ref); + omccmpiSimpleAssocResults(ctx, instance, &status); + } + } + db_destroy_select_results(dbctx); + + } else if(strcasecmp(objsClassName, + "XEN_VMBuilderVirtualSystemCreationData") == 0) { + if (role && *role && strcasecmp(role, "SettingData") != 0) { + /* Unknown role */ + return status; + } + if (resultRole && *resultRole && strcasecmp(resultRole, + "ManagedElement") != 0) { + /* Unknown resultRole */ + return status; + } + if (resultClass && *resultClass) { + if (!omccmpiClassIsDerivedFrom("XEN_VMBuilderJob", + resultClass, _broker, ns, &status)) { + return status; + } + } + + key = CMGetKey(cop, "InstanceID", &lstatus); + if (lstatus.rc != CMPI_RC_OK || CMIsNullValue(key)) { + return status; + } + iid = CMGetCharPtr(key.value.string); + if (!iid || !strlen(iid)) { + return status; + } + + instance = omccmpiNewInstance(_broker, ns, "XEN_SettingsDefineBuild", + the_class_keys, properties, &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { + DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + CMGetCharPtr(status.msg)); + return status; + } + CMSetProperty(instance, "SettingData", (CMPIValue*)&cop, CMPI_ref); + + sql = db_create_formatted_sql("SELECT JobName FROM Job WHERE " + "CreationDataInstanceID=%Q;", iid); + cc = db_create_select_results(&dbctx, sql, err_msg, sizeof(err_msg)); + db_destroy_formatted_sql(sql); + if (cc != 0) { + DEBUGOUT("GetInstance(): Failed to connect to database: %s", + err_msg); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, err_msg); + return status; + } + + while (db_results_have_more_rows(dbctx)) { + const unsigned char* txt = db_get_results_column_text(dbctx, 0, NULL); + if (txt) { + objectpath = CMNewObjectPath(_broker, ns, + "XEN_VMBuilderJob", + &lstatus); + CMAddKey(objectpath, "Name", (CMPIValue*)txt, CMPI_chars); + CMSetProperty(instance, "ManagedElement", + (CMPIValue*)&objectpath, CMPI_ref); + omccmpiSimpleAssocResults(ctx, instance, &status); + } + db_results_next_row(dbctx); + } + db_destroy_select_results(dbctx); + } + + DEBUGOUT("Leaving doReferences\n"); + return status; +} + +/****************************************************************************** +Associators() + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char *assocClass + char *resultClass + char *role + char *resultRole + char **properties +******************************************************************************/ +static CMPIStatus +Associators( + CMPIAssociationMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char *assocClass, + const char *resultClass, + const char *role, + const char *resultRole, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("Associators() called"); + + status = omccmpiSimpleAssociators(doReferences, self, + _broker, context, results, cop, assocClass, + resultClass, role, resultRole, properties); + + DEBUGOUT("Leaving Associatiors(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); + return status; +} + + +/****************************************************************************** +AssociatorNames() + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char *assocClass + char *resultClass + char *role + char *resultRole +******************************************************************************/ +static CMPIStatus +AssociatorNames( + CMPIAssociationMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char *assocClass, + const char *resultClass, + const char *role, + const char *resultRole) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("AssociatorNames() called"); + + status = omccmpiSimpleAssociatorNames(doReferences, self, _broker, + context, results, cop, assocClass, resultClass, role, + resultRole); + + DEBUGOUT("Leaving AssociatiorNames(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); + return status; +} + +/****************************************************************************** +References() + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char *resultClass + char *role + char **properties +******************************************************************************/ +static CMPIStatus References( + CMPIAssociationMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char* resultClass, + const char* role, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("References() called"); + + status = omccmpiSimpleReferences( doReferences, self, _broker, context, + results, cop, resultClass, role, properties); + + DEBUGOUT("Leaving References(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); + return status; +} + + +/****************************************************************************** +ReferenceNames() + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char *resultClass + char *role +******************************************************************************/ +static CMPIStatus +ReferenceNames( + CMPIAssociationMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char* resultClass, + const char* role) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("ReferenceNames() called"); + + status = omccmpiSimpleReferenceNames( doReferences, self, _broker, + context, results, cop, resultClass, role); + + DEBUGOUT("Leaving ReferenceNames(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); + return status; +} + +/***************************************************************************** + SETUP CMPI INSTANCE PROVIDER FUNCTION TABLE +******************************************************************************/ +CMInstanceMIStub( , omc_xensettingsdefinebuild, _broker, Init(&mi)); +CMAssociationMIStub( , omc_xensettingsdefinebuild, _broker, AssocInit(&mi)); + + + + Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.c 2008-05-28 17:46:24 UTC (rev 623) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.c 2008-05-28 22:30:03 UTC (rev 624) @@ -489,43 +489,47 @@ * that no longer exist. */ int -db_delete_dead_job_recs() +db_delete_dead_job_recs(char** job_names_arg) { char** job_names = NULL; omcStrBuf* pstrbuf = NULL; int i, cc = 0; char err_msg[256]; - job_names = get_job_names(); - if (!job_names) { - return 0; - } - pstrbuf = omcStrBuf_create(); if (!pstrbuf) { - free(job_names); return -1; } + omcStrBuf_cat(pstrbuf, "DELETE FROM Job", 0); - omcStrBuf_cat(pstrbuf, "DELETE FROM Job WHERE JobName NOT IN (", 0); - - for (i = 0; job_names[i]; i++) { - if (!i) { - db_sql_insert(pstrbuf, "%Q", job_names[i]); - } else { - db_sql_insert(pstrbuf, ",%Q", job_names[i]); + job_names = (job_names_arg) ? job_names_arg : get_job_names(); + if (job_names && job_names[0]) { + omcStrBuf_cat(pstrbuf, " WHERE JobName NOT IN (", 0); + for (i = 0; job_names[i]; i++) { + const char* fmt = (!i) ? "%Q" : ",%Q"; + db_sql_insert(pstrbuf, fmt, job_names[i]); } + omcStrBuf_cat(pstrbuf, ")", 0); } - free(job_names); - omcStrBuf_cat(pstrbuf, ");", 0); + + omcStrBuf_cat(pstrbuf, ";", 0); + if (!job_names_arg && job_names) { + free(job_names); + } + if (db_exec(pstrbuf->bfr, err_msg, sizeof(err_msg)) == -1LL) { DEBUGOUT("Error: delete dead job recs: %s\n", err_msg); cc = -1; } + omcStrBuf_destroy(pstrbuf); return cc; } +/* + * Delete all job/creationdata xref records for + * a given creationdata + */ int db_delete_creation_data_job_recs(const char* cdid) { @@ -539,13 +543,17 @@ } if (db_exec(sql, err_msg, sizeof(err_msg)) == -1LL) { - DEBUGOUT("Error: delete job for creationdata: %s\n", err_msg); + DEBUGOUT("Error: delete job recs for creationdata: %s\n", err_msg); cc = -1; } db_destroy_formatted_sql(sql); return cc; } +/* + * Add a creationdata/job xref record for a given + * creationdata and job + */ int db_add_job_to_creation_data(const char* cdid, const char* job_name) { Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.h =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.h 2008-05-28 17:46:24 UTC (rev 623) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.h 2008-05-28 22:30:03 UTC (rev 624) @@ -25,7 +25,7 @@ char* db_create_formatted_sql(const char* format, ...); void db_destroy_formatted_sql(char* formatted_sql); char* db_sql_insert(omcStrBuf* pstrbuf, const char* format, ...); -int db_delete_dead_job_recs(); +int db_delete_dead_job_recs(char** job_names_arg); int db_add_job_to_creation_data(const char* cdid, const char* job_name); int db_delete_creation_data_job_recs(const char* cdid); Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c 2008-05-28 17:46:24 UTC (rev 623) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c 2008-05-28 22:30:03 UTC (rev 624) @@ -1234,7 +1234,7 @@ DEBUGOUT("Initialize() called\n"); /* Delete jobs xref recs for jobs that no longer exist */ - db_delete_dead_job_recs(); + db_delete_dead_job_recs(NULL); DEBUGOUT("Leaving Initialize()\n"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-28 17:46:34
|
Revision: 623 http://omc.svn.sourceforge.net/omc/?rev=623&view=rev Author: jcarey Date: 2008-05-28 10:46:24 -0700 (Wed, 28 May 2008) Log Message: ----------- prov reg for settings-define-build and owning-job associations... Added Paths: ----------- contrib/xen-vm-builder/trunk/mof/owning-job-peg.reg contrib/xen-vm-builder/trunk/mof/settings-define-build-peg.reg Added: contrib/xen-vm-builder/trunk/mof/owning-job-peg.reg =================================================================== --- contrib/xen-vm-builder/trunk/mof/owning-job-peg.reg (rev 0) +++ contrib/xen-vm-builder/trunk/mof/owning-job-peg.reg 2008-05-28 17:46:24 UTC (rev 623) @@ -0,0 +1,28 @@ +instance of PG_ProviderModule +{ + Name = "OMC_XENVMBuilderOwningJob_Module"; + Location = "omc_xenowningjob"; + Vendor = "OMC"; + Version = "1.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + ProviderModuleName = "OMC_XENVMBuilderOwningJob_Module"; + Name = "omc_xenowningjob"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_XENVMBuilderOwningJob_Module"; + ProviderName = "omc_xenowningjob"; + CapabilityID = "OMC_XENVMBuilderOwningJob_Module0001"; + ClassName = "XEN_VMBuilderOwningJobElement"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 3 }; // Instance, Associator + SupportedProperties = NULL; // All properties + SupportedMethods = NULL; // All methods +}; + Added: contrib/xen-vm-builder/trunk/mof/settings-define-build-peg.reg =================================================================== --- contrib/xen-vm-builder/trunk/mof/settings-define-build-peg.reg (rev 0) +++ contrib/xen-vm-builder/trunk/mof/settings-define-build-peg.reg 2008-05-28 17:46:24 UTC (rev 623) @@ -0,0 +1,28 @@ +instance of PG_ProviderModule +{ + Name = "OMC_XENVMBuilderSettingsDefineBuild_Module"; + Location = "omc_xensettingsdefinebuild"; + Vendor = "OMC"; + Version = "1.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + ProviderModuleName = "OMC_XENVMBuilderSettingsDefineBuild_Module"; + Name = "omc_xensettingsdefinebuild"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_XENVMBuilderSettingsDefineBuild_Module"; + ProviderName = "omc_xensettingsdefinebuild"; + CapabilityID = "OMC_XENVMBuilderSettingsDefineBuild_Module0001"; + ClassName = "XEN_SettingsDefineBuild"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 3 }; // Instance, Associator + SupportedProperties = NULL; // All properties + SupportedMethods = NULL; // All methods +}; + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-27 23:58:57
|
Revision: 622 http://omc.svn.sourceforge.net/omc/?rev=622&view=rev Author: jcarey Date: 2008-05-27 16:59:04 -0700 (Tue, 27 May 2008) Log Message: ----------- Added code to maintain creationdata/job xrefs Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.h contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.h contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-27 19:40:18 UTC (rev 621) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-27 23:59:04 UTC (rev 622) @@ -30,6 +30,7 @@ * Author: Jon Carey (jc...@no...) ******************************************************************************/ #include "config.h" +#include "vmbuilder-util.h" #include <unistd.h> #include <stdio.h> @@ -102,13 +103,6 @@ char inotify[256]; } VMInstallInfo; -/* If built for debug, enable tracing */ -#ifdef XEN_VMBUILDER_DEBUG -#define DEBUGOUT(fmt, args...) printf(fmt,## args) -#else -#define DEBUGOUT(fmt, args...) -#endif - /* * Global handle to the CIM broker * This is initialized by the CIMOM when the provider is loaded @@ -251,36 +245,6 @@ } /*****************************************************************************/ -static char** -get_job_names() -{ - int status; - char *output = NULL; - char** names = NULL; - unsigned int output_size; - char* const cmd[] = { - "/usr/bin/vm-install-jobs", - "-l", - NULL - }; - - if (omcExecuteProcessAndGatherOutputAndError(cmd, NULL, &output, - &output_size, -1, NULL, NULL, -1, NULL, &status, -1) == 0) { - //DEBUGOUT("vm-install-jobs returned %d - %s\n", status, output); - if(omcStrTrim(output)) { - unsigned int num_elements; - names = omcStrTokenize(output, "\r\n", &num_elements); - } - } else { - DEBUGOUT("exec & gather errno: %d-%s\n", errno, strerror(errno)); - } - if (output) { - free(output); - } - return names; -} - -/*****************************************************************************/ static CMPIInstance* _getJobInstance(const char* job_name_key, const char* ns, const char** properties, CMPIStatus* pstatus) @@ -762,6 +726,9 @@ { DEBUGOUT("Initialize() called\n"); + DEBUGOUT("Deleting job xref recs that no longer exist\n"); + db_delete_dead_job_recs(); + DEBUGOUT("Leaving Initialize()\n"); } Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-27 19:40:18 UTC (rev 621) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-27 23:59:04 UTC (rev 622) @@ -105,13 +105,6 @@ #define RPM_NAME "omc-xenvm-builder" -/* If built for debug, enable tracing */ -#ifdef XEN_VMBUILDER_DEBUG -#define DEBUGOUT(fmt, args...) printf(fmt,## args) -#else -#define DEBUGOUT(fmt, args...) -#endif - /* * Global handle to the CIM broker * This is initialized by the CIMOM when the provider is loaded @@ -841,6 +834,8 @@ jobref = CMNewObjectPath(_broker, ns, "XEN_VMBUilderJob", pstatus); CMAddKey(jobref, "Name", (CMPIValue*)output, CMPI_chars); prv->uint32 = 0; + /* Create createdata/job xref record */ + db_add_job_to_creation_data(iid, output); } else { prv->uint32 = (CMPIUint32)WEXITSTATUS(cc); DEBUGOUT("vm-install failed status: %u\n", prv->uint32); @@ -877,7 +872,7 @@ int fail_count = 0; DEBUGOUT("Entering GetInstance loop for Job instance...\n"); while(fail_count < 10) { - omcMilliSleep(500); + omcMilliSleep(1000); jobci = CBGetInstance(_broker, context, jobref, NULL, &lstatus); if (jobci == NULL) { @@ -947,6 +942,7 @@ const char *vmname = NULL; const char *uuid = NULL; + db_delete_dead_job_recs(); param = CMGetArg(in, "VMName", &status); if (!CMIsNullValue(param)) { vmname = CMGetCharPtr(param.value.string); Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c 2008-05-27 19:40:18 UTC (rev 621) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c 2008-05-27 23:59:04 UTC (rev 622) @@ -57,13 +57,6 @@ NULL }; -/* If built for debug, enable tracing */ -#ifdef XEN_VMBUILDER_DEBUG -#define DEBUGOUT(fmt, args...) printf(fmt,## args) -#else -#define DEBUGOUT(fmt, args...) -#endif - /* * Global handle to the CIM broker * This is initialized by the CIMOM when the provider is loaded Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.c 2008-05-27 19:40:18 UTC (rev 621) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.c 2008-05-27 23:59:04 UTC (rev 622) @@ -1,4 +1,4 @@ -#include "vmbuilder-db.h" +#include "vmbuilder-util.h" #include <sqlite3.h> #include <sys/types.h> #include <sys/stat.h> @@ -89,7 +89,8 @@ "CREATE TABLE Job(" "JobName TEXT NOT NULL," "CreationDataInstanceID TEXT NOT NULL COLLATE NOCASE," - "PRIMARY KEY(JobName, CreationDataInstanceID COLLATE NOCASE));"; + "PRIMARY KEY(JobName, CreationDataInstanceID COLLATE NOCASE));" +"CREATE INDEX JobCDNdx ON Job(CreationDataInstanceID);"; typedef struct { @@ -482,6 +483,96 @@ sqlite3_close(db); return insert_row_id; } + +/* + * Delete all job/creationdata xref records for jobs + * that no longer exist. + */ +int +db_delete_dead_job_recs() +{ + char** job_names = NULL; + omcStrBuf* pstrbuf = NULL; + int i, cc = 0; + char err_msg[256]; + + job_names = get_job_names(); + if (!job_names) { + return 0; + } + + pstrbuf = omcStrBuf_create(); + if (!pstrbuf) { + free(job_names); + return -1; + } + + omcStrBuf_cat(pstrbuf, "DELETE FROM Job WHERE JobName NOT IN (", 0); + + for (i = 0; job_names[i]; i++) { + if (!i) { + db_sql_insert(pstrbuf, "%Q", job_names[i]); + } else { + db_sql_insert(pstrbuf, ",%Q", job_names[i]); + } + } + free(job_names); + omcStrBuf_cat(pstrbuf, ");", 0); + if (db_exec(pstrbuf->bfr, err_msg, sizeof(err_msg)) == -1LL) { + DEBUGOUT("Error: delete dead job recs: %s\n", err_msg); + cc = -1; + } + omcStrBuf_destroy(pstrbuf); + return cc; +} + +int +db_delete_creation_data_job_recs(const char* cdid) +{ + int cc = 0; + char err_msg[256]; + + char* sql = db_create_formatted_sql( + "DELETE FROM Job WHERE CreationDataInstanceID=%Q;", cdid); + if (!sql) { + return -1; + } + + if (db_exec(sql, err_msg, sizeof(err_msg)) == -1LL) { + DEBUGOUT("Error: delete job for creationdata: %s\n", err_msg); + cc = -1; + } + db_destroy_formatted_sql(sql); + return cc; +} + +int +db_add_job_to_creation_data(const char* cdid, const char* job_name) +{ + int cc = 0; + char err_msg[256]; + + char* sql = db_create_formatted_sql( + "INSERT INTO Job VALUES(%Q,%Q);", job_name, cdid); + if (!sql) { + return -1; + } + + if (db_exec(sql, err_msg, sizeof(err_msg)) == -1LL) { + DEBUGOUT("Error: creating job xref rec for creationdata: %s\n", + err_msg); + cc = -1; + } + db_destroy_formatted_sql(sql); + return cc; +} + + + + + + + Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.h =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.h 2008-05-27 19:40:18 UTC (rev 621) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-db.h 2008-05-27 23:59:04 UTC (rev 622) @@ -25,5 +25,8 @@ char* db_create_formatted_sql(const char* format, ...); void db_destroy_formatted_sql(char* formatted_sql); char* db_sql_insert(omcStrBuf* pstrbuf, const char* format, ...); +int db_delete_dead_job_recs(); +int db_add_job_to_creation_data(const char* cdid, const char* job_name); +int db_delete_creation_data_job_recs(const char* cdid); #endif // VMBGUILDER_DB_H_GUARD_ Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.c 2008-05-27 19:40:18 UTC (rev 621) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.c 2008-05-27 23:59:04 UTC (rev 622) @@ -1,9 +1,12 @@ #include "vmbuilder-util.h" + #include <stdio.h> +#include <errno.h> #include <cmpidt.h> #include <cmpift.h> #include <cmpimacs.h> #include <omc/string.h> +#include <omc/exec.h> /******************************************************************************/ CMPIArray* @@ -220,4 +223,33 @@ } } +/*****************************************************************************/ +char** +get_job_names() +{ + int status; + char *output = NULL; + char** names = NULL; + unsigned int output_size; + char* const cmd[] = { + "/usr/bin/vm-install-jobs", + "-l", + NULL + }; + if (omcExecuteProcessAndGatherOutputAndError(cmd, NULL, &output, + &output_size, -1, NULL, NULL, -1, NULL, &status, -1) == 0) { + if(omcStrTrim(output)) { + unsigned int num_elements; + names = omcStrTokenize(output, "\r\n", &num_elements); + } + } else { + DEBUGOUT("exec & gather errno: %d-%s\n", errno, strerror(errno)); + } + if (output) { + free(output); + } + return names; +} + + Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.h =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.h 2008-05-27 19:40:18 UTC (rev 621) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.h 2008-05-27 23:59:04 UTC (rev 622) @@ -1,10 +1,12 @@ #ifndef VMBUILDER_UTIL_H_GUARD #define VMBUILDER_UTIL_H_GUARD +#include "config.h" #include "vmbuilder-db.h" #include <cmpidt.h> #include <cmpift.h> #include <cmpimacs.h> +#include <stdio.h> CMPIArray* str2UInt16Array(const CMPIBroker* broker, const char* str); CMPIArray* str2StringArray(const CMPIBroker* broker, const char* str); @@ -21,5 +23,13 @@ const char* prop_name); void set_dt_prop(const CMPIBroker* broker, VMBDBCtx dbctx, int col_ndx, CMPIInstance* instance, const char* prop_name, CMPIBoolean isInterval); +char** get_job_names(); +/* If built for debug, enable tracing */ +#ifdef XEN_VMBUILDER_DEBUG +#define DEBUGOUT(fmt, args...) printf(fmt,## args) +#else +#define DEBUGOUT(fmt, args...) +#endif + #endif /* VMBUILDER_UTIL_H_GUARD */ Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c 2008-05-27 19:40:18 UTC (rev 621) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c 2008-05-27 23:59:04 UTC (rev 622) @@ -60,13 +60,6 @@ NULL }; -/* If built for debug, enable tracing */ -#ifdef XEN_VMBUILDER_DEBUG -#define DEBUGOUT(fmt, args...) printf(fmt,## args) -#else -#define DEBUGOUT(fmt, args...) -#endif - #define CSV_FIELDS \ "InstanceID," \ "AutoMaticRecoveryAction," \ @@ -1198,6 +1191,8 @@ DEBUGOUT("DeleteInstance(): failed deleting record from " "database: %s", err_msg); OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, err_msg); + } else { + db_delete_creation_data_job_recs(iid); } db_destroy_formatted_sql(query); } @@ -1238,6 +1233,9 @@ { DEBUGOUT("Initialize() called\n"); + /* Delete jobs xref recs for jobs that no longer exist */ + db_delete_dead_job_recs(); + DEBUGOUT("Leaving Initialize()\n"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-27 19:40:17
|
Revision: 621 http://omc.svn.sourceforge.net/omc/?rev=621&view=rev Author: jcarey Date: 2008-05-27 12:40:18 -0700 (Tue, 27 May 2008) Log Message: ----------- getinstance and friends for ProcessOfJob association Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-27 17:37:39 UTC (rev 620) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-27 19:40:18 UTC (rev 621) @@ -344,6 +344,7 @@ const CMPIObjectPath* cop) { CMPIStatus status = {CMPI_RC_OK, NULL}; + CMPIStatus lstatus = {CMPI_RC_OK, NULL}; char *ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); char *className; @@ -370,7 +371,48 @@ free(names); } CMReturnDone(results); + } else if (strcasecmp(className, "XEN_VMBuilderProcessOfJob") == 0) { + CMPIObjectPath* ref = CMNewObjectPath(_broker, ns, + "XEN_VMBUilderProcessOfJob", &status); + if (status.rc != CMPI_RC_OK || CMIsNullObject(ref)) { + DEBUGOUT("EnumInstanceNames(): CMNewObjectPath() " + "failed - %s\n", CMGetCharPtr(status.msg)); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + "Failed creating object path"); + return status; + } + CMPIObjectPath* jobref = CMNewObjectPath(_broker, ns, + "XEN_VMBUilderJob", &status); + if (status.rc != CMPI_RC_OK || CMIsNullObject(jobref)) { + DEBUGOUT("EnumInstanceNames(): CMNewObjectPath() " + "failed creating job ref - %s\n", + CMGetCharPtr(status.msg)); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + "Failed creating job reference"); + return status; + } + + char** names = get_job_names(); + if (names) { + VMInstallInfo info; + CMPIObjectPath* procref; + int i; + for(i = 0; names[i]; i++) { + if (get_job_info(names[i], &info) == 0) { + if (info.pid) { + procref = get_proc_ref(ns, info.pid, &lstatus); + CMAddKey(ref, "PartComponent", (CMPIValue*)&procref, CMPI_ref); + CMAddKey(jobref, "Name", (CMPIValue*)names[i], CMPI_chars); + CMAddKey(ref, "GroupComponent", (CMPIValue*)&jobref, CMPI_ref); + CMReturnObjectPath(results, ref); + } + } + } + free(names); + } + CMReturnDone(results); } + DEBUGOUT("Leaving EnumInstanceNames(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; @@ -393,6 +435,7 @@ const char** properties) { CMPIStatus status = {CMPI_RC_OK, NULL}; + CMPIStatus lstatus = {CMPI_RC_OK, NULL}; char * ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); CMPIInstance* instance; char *className; @@ -414,6 +457,48 @@ free(names); } CMReturnDone(results); + } else if (strcasecmp(className, "XEN_VMBuilderProcessOfJob") == 0) { + instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderProcessOfJob", + proc_of_job_class_keys, properties, &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { + DEBUGOUT("EnumInstances(): failed to create new instance: %s\n", + CMGetCharPtr(status.msg)); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + "Failed to create new instance"); + return status; + } + CMPIObjectPath* jobref = CMNewObjectPath(_broker, ns, + "XEN_VMBUilderJob", &status); + if (status.rc != CMPI_RC_OK || CMIsNullObject(jobref)) { + DEBUGOUT("EnumInstances(): CMNewObjectPath() " + "failed creating job ref - %s\n", + CMGetCharPtr(status.msg)); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + "Failed creating job reference"); + return status; + } + + char** names = get_job_names(); + if (names) { + VMInstallInfo info; + CMPIObjectPath* procref; + int i; + for(i = 0; names[i]; i++) { + if (get_job_info(names[i], &info) == 0) { + if (info.pid) { + procref = get_proc_ref(ns, info.pid, &lstatus); + CMSetProperty(instance, "PartComponent", + (CMPIValue*)&procref, CMPI_ref); + CMAddKey(jobref, "Name", (CMPIValue*)names[i], CMPI_chars); + CMSetProperty(instance, "GroupComponent", + (CMPIValue*)&jobref, CMPI_ref); + CMReturnInstance(results, instance); + } + } + } + free(names); + } + CMReturnDone(results); } DEBUGOUT("Leaving EnumInstances(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); @@ -436,9 +521,10 @@ const CMPIObjectPath* cop, const char** properties) { - CMPIInstance* instance; + CMPIInstance *instance, *ci; //CMPIObjectPath *objectpath; CMPIStatus status = {CMPI_RC_OK, NULL}; + CMPIStatus lstatus = {CMPI_RC_OK, NULL}; char *ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); const char *className; CMPIData key; @@ -463,11 +549,71 @@ return status; } + /* status will be set if not found below */ instance = _getJobInstance(job_name_key, ns, properties, &status); if (instance) { CMReturnInstance(results, instance); } + + } else if (strcasecmp(className, "XEN_VMBuilderProcessOfJob") == 0) { + CMPIData proc, job; + job = CMGetKey(cop, "GroupComponent", &status); + if (status.rc != CMPI_RC_OK || CMIsNullValue(job)) { + DEBUGOUT("GetInstance(): CMGetKey(\"GroupComponent\") " + "failed - %s\n", CMGetCharPtr(status.msg)); + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_NO_SUCH_PROPERTY, + "GroupComponent missing"); + return status; + } + if (job.type != CMPI_ref) { + DEBUGOUT("GetInstance(): Invalid 'GroupComponent' key " + "property type\n"); + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, + "GroupComponent key invalid"); + return status; + } + + ci = CBGetInstance(_broker, context, job.value.ref, NULL, &lstatus); + if (ci == NULL) { + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + "Instance does not exists"); + return status; + } + + proc = CMGetKey(cop, "PartComponent", &status); + if (status.rc != CMPI_RC_OK || CMIsNullValue(proc)) { + DEBUGOUT("GetInstance(): CMGetKey(\"PartComponent\") " + "failed - %s\n", CMGetCharPtr(status.msg)); + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_NO_SUCH_PROPERTY, + "PartComponent missing"); + return status; + } + if (proc.type != CMPI_ref) { + DEBUGOUT("GetInstance(): Invalid 'PartComponent' key " + "property type\n"); + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, + "PartComponent key invalid"); + return status; + } + + ci = CBGetInstance(_broker, context, proc.value.ref, NULL, &lstatus); + if (ci == NULL) { + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + "Instance does not exists"); + return status; + } + + instance = omccmpiNewInstance(_broker, ns, + "XEN_VMBuilderProcessOfJob", + proc_of_job_class_keys, properties, &status); + + CMSetProperty(instance, "GroupComponent", + (CMPIValue*)&job.value.ref, CMPI_ref); + CMSetProperty(instance, "PartComponent", + (CMPIValue*)&proc.value.ref, CMPI_ref); + CMReturnInstance(results, instance); } + DEBUGOUT("Leaving GetInstance(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-27 17:38:50
|
Revision: 620 http://omc.svn.sourceforge.net/omc/?rev=620&view=rev Author: jcarey Date: 2008-05-27 10:37:39 -0700 (Tue, 27 May 2008) Log Message: ----------- Implemented OwningJobElement association Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c Added Paths: ----------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am 2008-05-23 22:42:32 UTC (rev 619) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am 2008-05-27 17:37:39 UTC (rev 620) @@ -3,7 +3,8 @@ provider_LTLIBRARIES = \ libomc_xenvmbuilder.la \ libomc_xenvmbuilderjob.la \ - libomc_xencreationdata.la + libomc_xencreationdata.la \ + libomc_xenowningjob.la lib_LTLIBRARIES = \ libomc_xenvmbuilder_common.la @@ -53,6 +54,20 @@ $(top_builddir)/src/providers/vm-builder/libomc_xenvmbuilder_common.la ### +# libomc_xenowningjob +### +libomc_xenowningjob_la_SOURCES = \ + owning-job.c + +libomc_xenowningjob_la_LDFLAGS = \ + -lpthread \ + -lomc_cmpi \ + -version-info 1 + +libomc_xenowningjob_la_LIBADD = \ + $(top_builddir)/src/providers/vm-builder/libomc_xenvmbuilder_common.la + +### # libomc_xenvmbuilder_common ### libomc_xenvmbuilder_common_la_SOURCES = \ Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-23 22:42:32 UTC (rev 619) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-27 17:37:39 UTC (rev 620) @@ -1091,100 +1091,99 @@ DEBUGOUT("doReferences called\n"); - if (strcasecmp(assocClass, "XEN_VMBuilderHostedService") == 0) { - char *objsClassName = (char*) CMGetCharPtr(CMGetClassName(cop, NULL)); + char *objsClassName = (char*) CMGetCharPtr(CMGetClassName(cop, NULL)); - /* Is target an OS object? */ - if(strcasecmp(objsClassName, "OMC_UnitaryComputerSystem") == 0) { - if (role && *role && strcasecmp(role, "Antecedent") != 0) { - /* Unknown role */ + /* Is target an OS object? */ + if(strcasecmp(objsClassName, "OMC_UnitaryComputerSystem") == 0) { + if (role && *role && strcasecmp(role, "Antecedent") != 0) { + /* Unknown role */ + return status; + } + if (resultRole && *resultRole && strcasecmp(resultRole, + "Dependent") != 0) { + /* Unknown resultRole */ + return status; + } + if (resultClass && *resultClass) { + if (!omccmpiClassIsDerivedFrom("XEN_VMBuilderService", + resultClass, _broker, ns, &status)) { return status; } - if (resultRole && *resultRole && strcasecmp(resultRole, - "Dependent") != 0) { - /* Unknown resultRole */ - return status; - } - if (resultClass && *resultClass) { - if (!omccmpiClassIsDerivedFrom("XEN_VMBuilderService", - resultClass, _broker, ns, &status)) { - return status; - } - } - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderHostedService", - hosted_service_class_keys, properties, &status); - if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { - DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", - CMGetCharPtr(status.msg)); - return status; - } + } + instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderHostedService", + hosted_service_class_keys, properties, &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { + DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + CMGetCharPtr(status.msg)); + return status; + } - csOp = omccmpiCreateCSObjectPath(_broker, ns, &status); - if ((status.rc != CMPI_RC_OK) || CMIsNullObject(csOp)) { - DEBUGOUT("doReferences(): omccmpiCreateCSObjectPath failed - %s\n", - CMGetCharPtr(status.msg)); - return status; - } + csOp = omccmpiCreateCSObjectPath(_broker, ns, &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(csOp)) { + DEBUGOUT("doReferences(): omccmpiCreateCSObjectPath failed - %s\n", + CMGetCharPtr(status.msg)); + return status; + } - CMSetProperty(instance, "Antecedent", (CMPIValue*)&csOp, CMPI_ref); + CMSetProperty(instance, "Antecedent", (CMPIValue*)&csOp, CMPI_ref); - objectpath = get_service_ref(ns, &status); - if ((status.rc != CMPI_RC_OK) || objectpath == NULL) { - DEBUGOUT("doReferences(): get_service_ref() failed - %s\n", - CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, - "Failed creating new object path"); + objectpath = get_service_ref(ns, &status); + if ((status.rc != CMPI_RC_OK) || objectpath == NULL) { + DEBUGOUT("doReferences(): get_service_ref() failed - %s\n", + CMGetCharPtr(status.msg)); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + "Failed creating new object path"); + return status; + } + CMSetProperty(instance, "Dependent", (CMPIValue*)&objectpath, CMPI_ref); + omccmpiSimpleAssocResults(ctx, instance, &status); + } else if(strcasecmp(objsClassName, "XEN_VMBuilderService") == 0) { + if (role && *role && strcasecmp(role, "Dependent") != 0) { + /* Unknown role */ + return status; + } + if (resultRole && *resultRole && strcasecmp(resultRole, + "Antecedent") != 0) { + /* Unknown resultRole */ + return status; + } + if (resultClass && *resultClass) { + if (!omccmpiClassIsDerivedFrom("OMC_UnitaryComputerSystem", + resultClass, _broker, ns, &status)) { return status; } - CMSetProperty(instance, "Dependent", (CMPIValue*)&objectpath, CMPI_ref); - omccmpiSimpleAssocResults(ctx, instance, &status); - } else if(strcasecmp(objsClassName, "XEN_VMBuilderService") == 0) { - if (role && *role && strcasecmp(role, "Dependent") != 0) { - /* Unknown role */ - return status; - } - if (resultRole && *resultRole && strcasecmp(resultRole, - "Antecedent") != 0) { - /* Unknown resultRole */ - return status; - } - if (resultClass && *resultClass) { - if (!omccmpiClassIsDerivedFrom("OMC_UnitaryComputerSystem", - resultClass, _broker, ns, &status)) { - return status; - } - } - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderHostedService", - hosted_service_class_keys, properties, &status); - if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { - DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", - CMGetCharPtr(status.msg)); - return status; - } + } + instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderHostedService", + hosted_service_class_keys, properties, &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { + DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + CMGetCharPtr(status.msg)); + return status; + } - csOp = omccmpiCreateCSObjectPath(_broker, ns, &status); - if ((status.rc != CMPI_RC_OK) || CMIsNullObject(csOp)) { - DEBUGOUT("doReferences(): omccmpiCreateCSObjectPath failed - %s\n", - CMGetCharPtr(status.msg)); - return status; - } + csOp = omccmpiCreateCSObjectPath(_broker, ns, &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(csOp)) { + DEBUGOUT("doReferences(): omccmpiCreateCSObjectPath failed - %s\n", + CMGetCharPtr(status.msg)); + return status; + } - CMSetProperty(instance, "Antecedent", (CMPIValue*)&csOp, CMPI_ref); - objectpath = get_service_ref(ns, &status); - if ((status.rc != CMPI_RC_OK) || objectpath == NULL) { - DEBUGOUT("doReferences(): get_service_ref() failed - %s\n", - CMGetCharPtr(status.msg)); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, - "Failed creating new object path"); - return status; - } - CMSetProperty(instance, "Dependent", (CMPIValue*)&objectpath, CMPI_ref); - omccmpiSimpleAssocResults(ctx, instance, &status); - } else { - DEBUGOUT("!!! Object type unknown: %s\n", objsClassName); + CMSetProperty(instance, "Antecedent", (CMPIValue*)&csOp, CMPI_ref); + objectpath = get_service_ref(ns, &status); + if ((status.rc != CMPI_RC_OK) || objectpath == NULL) { + DEBUGOUT("doReferences(): get_service_ref() failed - %s\n", + CMGetCharPtr(status.msg)); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + "Failed creating new object path"); return status; } + CMSetProperty(instance, "Dependent", (CMPIValue*)&objectpath, CMPI_ref); + omccmpiSimpleAssocResults(ctx, instance, &status); + } else { + DEBUGOUT("!!! Object type unknown: %s\n", objsClassName); + return status; } + DEBUGOUT("Leaving doReferences\n"); return status; } Added: contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c (rev 0) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/owning-job.c 2008-05-27 17:37:39 UTC (rev 620) @@ -0,0 +1,765 @@ +/******************************************************************************* +* Copyright (C) 2005,2006,2007,2008 Novell, Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell, Inc. nor the names of its +* contributors may be used to endorse or promote products derived from this +* software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +* +* Author: Jon Carey (jc...@no...) +******************************************************************************/ +#include "config.h" +#include "vmbuilder-util.h" + +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <limits.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/wait.h> + +#include <cmpidt.h> +#include <cmpift.h> +#include <cmpimacs.h> +#include <omc/string.h> +#include <omc/exec.h> +#include <omc/base.h> +#include <omc/ioUtils.h> +#include <omc/cmpiUtils.h> +#include <omc/cmpiSimpleAssoc.h> + +static const char* owning_job_class_keys[] = +{ + "OwningElement", + "OwnedElement", + NULL +}; + +/* If built for debug, enable tracing */ +#ifdef XEN_VMBUILDER_DEBUG +#define DEBUGOUT(fmt, args...) printf(fmt,## args) +#else +#define DEBUGOUT(fmt, args...) +#endif + +/* + * Global handle to the CIM broker + * This is initialized by the CIMOM when the provider is loaded + */ +static const CMPIBroker* _broker; + +/*****************************************************************************/ +static CMPIObjectPath* +get_service_ref( + const CMPIContext* context, + const char* ns) +{ + CMPIStatus lstatus = {CMPI_RC_OK, NULL}; + CMPIObjectPath* objectpath; + CMPIEnumeration *en; + CMPIData data; + + objectpath = CMNewObjectPath(_broker, ns, "XEN_VMBuilderService", &lstatus); + en = CBEnumInstanceNames(_broker, context, objectpath, &lstatus); + if (en == NULL) { + return NULL; + } + + /* Should only be 1 instance name of service */ + if (CMHasNext(en, &lstatus)) { + data = CMGetNext(en, &lstatus); + return data.value.ref; + } + + return NULL; +} + +/****************************************************************************** + CMPI INSTANCE PROVIDER FUNCTIONS +******************************************************************************/ + + + +/****************************************************************************** +EnumInstanceNames() + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char **properties: [in] propertylist filter, null=all +******************************************************************************/ +static CMPIStatus +EnumInstanceNames( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + CMPIStatus lstatus = {CMPI_RC_OK, NULL}; + CMPIObjectPath *objectpath, *serviceref, *jobref; + char *ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); + char *className; + CMPIEnumeration *en; + CMPIData data; + + DEBUGOUT("EnumInstanceNames() called\n"); + + className = (char*) CMGetCharPtr(CMGetClassName(cop, NULL)); + if (strcasecmp(className, "XEN_VMBuilderOwningJobElement") == 0) { + objectpath = CMNewObjectPath(_broker, ns, "XEN_VMBuilderOwningJobElement", &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { + DEBUGOUT("EnumInstanceNames(): CMNewObjectPath() failed - %s\n", + CMGetCharPtr(status.msg)); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + "Failed creating new object path"); + return status; + } + + serviceref = get_service_ref(context, ns); + if (!serviceref) { + return status; + } + + CMAddKey(objectpath, "OwningElement", (CMPIValue*)&serviceref, + CMPI_ref); + + /* Get the instance names for all jobs */ + jobref = CMNewObjectPath(_broker, ns, "XEN_VMBuilderJob", &lstatus); + en = CBEnumInstanceNames(_broker, context, jobref, &lstatus); + if (en == NULL) { + /* No jobs, so no references */ + return status; + } + + while(CMHasNext(en, &lstatus)) { + data = CMGetNext(en, &lstatus); + if (data.value.ref == NULL) { + DEBUGOUT("EnumInstanceNames: CMGetNext returned NULL " + "reference\n"); + } else { + CMAddKey(objectpath, "OwnedElement", + (CMPIValue*)&data.value.ref, CMPI_ref); + CMReturnObjectPath(results, objectpath); + } + } + CMReturnDone(results); + } + DEBUGOUT("Leaving EnumInstanceNames(): %s\n", + (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + return status; +} + +/****************************************************************************** +EnumInstances() + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char **properties: [in] propertylist filter, null=all +******************************************************************************/ +static CMPIStatus +EnumInstances( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + CMPIStatus lstatus = {CMPI_RC_OK, NULL}; + char * ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); + CMPIInstance* instance; + char *className; + CMPIEnumeration *en; + CMPIData data; + + DEBUGOUT("EnumInstances() called\n"); + + className = (char*) CMGetCharPtr(CMGetClassName(cop, NULL)); + if (strcasecmp(className, "XEN_VMBuilderOwningJobElement") == 0) { + CMPIObjectPath *jobref, *serviceref; + instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderOwningJobElement", + owning_job_class_keys, properties, &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { + DEBUGOUT("EnumInstances(): failed to create new instance: %s\n", + CMGetCharPtr(status.msg)); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, + "Failed to create new instance"); + return status; + } + serviceref = get_service_ref(context, ns); + if (!serviceref) { + return status; + } + + CMSetProperty(instance, "OwningElement", + (CMPIValue*)&serviceref, CMPI_ref); + + /* Get the instance names for all jobs */ + jobref = CMNewObjectPath(_broker, ns, "XEN_VMBuilderJob", &lstatus); + en = CBEnumInstanceNames(_broker, context, jobref, &lstatus); + if (en == NULL) { + /* No jobs, so no references */ + return status; + } + + while(CMHasNext(en, &lstatus)) { + data = CMGetNext(en, &lstatus); + if (data.value.ref == NULL) { + DEBUGOUT("EnumInstances: CMGetNext returned NULL " + "reference\n"); + } else { + CMSetProperty(instance, "OwnedElement", + (CMPIValue*)&data.value.ref, CMPI_ref); + CMReturnInstance(results, instance); + } + } + CMReturnDone(results); + } + DEBUGOUT("Leaving EnumInstances(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + return status; +} + + +/****************************************************************************** +GetInstance() + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char **properties: [in] propertylist filter, null=all +******************************************************************************/ +static CMPIStatus +GetInstance( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char** properties) +{ + CMPIInstance *instance, *ci; + CMPIStatus status = {CMPI_RC_OK, NULL}; + CMPIStatus lstatus = {CMPI_RC_OK, NULL}; + char *ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); + const char *className; + + DEBUGOUT("GetInstance() called\n"); + + className = CMGetCharPtr(CMGetClassName(cop, NULL)); + if (strcasecmp(className, "XEN_VMBuilderOwningJobElement") == 0) { + CMPIData job, service; + service = CMGetKey(cop, "OwningElement", &status); + if (status.rc != CMPI_RC_OK || CMIsNullValue(service)) { + DEBUGOUT("GetInstance(): CMGetKey(\"OwningElement\") " + "failed - %s\n", CMGetCharPtr(status.msg)); + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_NO_SUCH_PROPERTY, + "OwningElement missing"); + return status; + } + if (service.type != CMPI_ref) { + DEBUGOUT("GetInstance(): Invalid 'OwningElement' key " + "property type\n"); + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, + "OwningElement key invalid"); + return status; + } + + ci = CBGetInstance(_broker, context, service.value.ref, NULL, &lstatus); + if (ci == NULL) { + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + "Instance does not exists"); + return status; + } + + job = CMGetKey(cop, "OwnedElement", &status); + if (status.rc != CMPI_RC_OK || CMIsNullValue(job)) { + DEBUGOUT("GetInstance(): CMGetKey(\"OwnedElement\") " + "failed - %s\n", CMGetCharPtr(status.msg)); + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_NO_SUCH_PROPERTY, + "OwnedElement missing"); + return status; + } + if (job.type != CMPI_ref) { + DEBUGOUT("GetInstance(): Invalid 'OwnedElement' key " + "property type\n"); + CMSetStatusWithChars(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, + "OwnedElement key invalid"); + return status; + } + + ci = CBGetInstance(_broker, context, job.value.ref, NULL, &lstatus); + if (ci == NULL) { + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + "Instance does not exists"); + return status; + } + + instance = omccmpiNewInstance(_broker, ns, + "XEN_VMBuilderOwningJobElement", + owning_job_class_keys, properties, &status); + CMSetProperty(instance, "OwningElement", + (CMPIValue*)&service.value.ref, CMPI_ref); + CMSetProperty(instance, "OwnedElement", + (CMPIValue*)&job.value.ref, CMPI_ref); + CMReturnInstance(results, instance); + } + DEBUGOUT("Leaving GetInstance(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + return status; +} + +/****************************************************************************** +ModifyInstance() - modify instance + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and objectpath + CMPIInstance* newInst: [in] new (modified) instance data +******************************************************************************/ +static CMPIStatus +ModifyInstance( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const CMPIInstance* newinstance, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + return status; +} + + +/****************************************************************************** +CreateInstance() + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and objectpath + CMPIInstance* newInst: [in] new instance data +******************************************************************************/ +static CMPIStatus +CreateInstance( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const CMPIInstance* newinstance) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + return status; +} + + +/****************************************************************************** +DeleteInstance() + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname +******************************************************************************/ +static CMPIStatus +DeleteInstance( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + return status; +} + +/****************************************************************************** +ExecQuery() - like getInstance, but that match query + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname + char *language: [in] query language, ie "WQL" + char *query: [in] text of query, in <query language> +******************************************************************************/ +static CMPIStatus +ExecQuery( + CMPIInstanceMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char* language, + const char* query) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + return status; +} + +/****************************************************************************** + Init() + params: CMPIInstanceMI* self: [in] Handle to this provider +******************************************************************************/ +static void +Init( + CMPIInstanceMI* self) +{ + DEBUGOUT("Initialize() called\n"); + + DEBUGOUT("Leaving Initialize()\n"); +} + +/****************************************************************************** +Cleanup() - pre unload + params: CMPIInstanceMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIBoolean terminating +******************************************************************************/ +static CMPIStatus +Cleanup( + CMPIInstanceMI* self, + const CMPIContext* context, + CMPIBoolean terminating) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("Cleanup() called\n"); + + DEBUGOUT("Leaving Cleanup(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + return status; +} + +/****************************************************************************** +CMPI ASSOCIATION PROVIDER FUNCTIONS +******************************************************************************/ + +/****************************************************************************** +AssocInit() - init + params: CMPIAssociationMI* self: [in] Handle to this provider +******************************************************************************/ +static void +AssocInit( + CMPIAssociationMI* self) +{ + DEBUGOUT("AssocInit() called"); + + DEBUGOUT("Leaving AssocInit()\n"); +} + +/****************************************************************************** +AssociationCleanup() - pre unload + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIBoolean terminating +******************************************************************************/ +static CMPIStatus +AssociationCleanup( + CMPIAssociationMI* self, + const CMPIContext* context, + CMPIBoolean terminating) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("AssociationCleanup() called"); + + DEBUGOUT("Leaving AssociationCleanup(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + return status; +} + +/*****************************************************************************/ +static CMPIStatus +doReferences( + omccmpiSimpleAssocCtx ctx, + CMPIAssociationMI *self, + const CMPIBroker *broker, + const CMPIContext *context, + const CMPIResult *results, + const CMPIObjectPath *cop, + const char *assocClass, + const char *resultClass, + const char *role, + const char *resultRole, + const char **properties) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + CMPIStatus lstatus = {CMPI_RC_OK, NULL}; + char * ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); + CMPIObjectPath *objectpath; + CMPIInstance *instance, *jobci, *serviceci; + CMPIEnumeration *en; + CMPIData data; + + DEBUGOUT("doReferences called\n"); + + char *objsClassName = (char*) CMGetCharPtr(CMGetClassName(cop, NULL)); + + /* Is target an VM Builder Service object? */ + if(strcasecmp(objsClassName, "XEN_VMBuilderService") == 0) { + if (role && *role && strcasecmp(role, "OwningElement") != 0) { + /* Unknown role */ + return status; + } + if (resultRole && *resultRole && strcasecmp(resultRole, + "OwnedElement") != 0) { + /* Unknown resultRole */ + return status; + } + if (resultClass && *resultClass) { + if (!omccmpiClassIsDerivedFrom("XEN_VMBuilderJob", + resultClass, _broker, ns, &status)) { + return status; + } + } + + /* Get the service instance to verify existence */ + serviceci = CBGetInstance(_broker, context, cop, NULL, &lstatus); + if (serviceci == NULL) { + /* No hit on service. No references */ + return status; + } + + instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderOwningJobElement", + owning_job_class_keys, properties, &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { + DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + CMGetCharPtr(status.msg)); + return status; + } + CMSetProperty(instance, "OwningElement", (CMPIValue*)&cop, CMPI_ref); + + /* Get the instance names for all jobs */ + objectpath = CMNewObjectPath(_broker, ns, "XEN_VMBuilderJob", &lstatus); + en = CBEnumInstanceNames(_broker, context, objectpath, &lstatus); + if (en == NULL) { + /* No jobs, so no references */ + return status; + } + + while(CMHasNext(en, &lstatus)) { + data = CMGetNext(en, &lstatus); + if (data.value.ref == NULL) { + DEBUGOUT("CMGetNext returned NULL reference\n"); + } else { + CMSetProperty(instance, "OwnedElement", + (CMPIValue*)&data.value.ref, CMPI_ref); + omccmpiSimpleAssocResults(ctx, instance, &status); + } + } + } else if(strcasecmp(objsClassName, "XEN_VMBuilderJob") == 0) { + if (role && *role && strcasecmp(role, "OwnedElement") != 0) { + /* Unknown role */ + return status; + } + if (resultRole && *resultRole && strcasecmp(resultRole, + "OwingElement") != 0) { + /* Unknown resultRole */ + return status; + } + if (resultClass && *resultClass) { + if (!omccmpiClassIsDerivedFrom("XEN_VMBuilderService", + resultClass, _broker, ns, &status)) { + return status; + } + } + + /* Get the job instance to verify existence */ + jobci = CBGetInstance(_broker, context, cop, NULL, &lstatus); + if (jobci == NULL) { + /* No hit on job. No references */ + return status; + } + + instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderOwningJobElement", + owning_job_class_keys, properties, &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { + DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + CMGetCharPtr(status.msg)); + return status; + } + + CMSetProperty(instance, "OwnedElement", (CMPIValue*)&cop, CMPI_ref); + objectpath = get_service_ref(context, ns); + if (objectpath) { + CMSetProperty(instance, "OwningElement", + (CMPIValue*)&data.value.ref, CMPI_ref); + omccmpiSimpleAssocResults(ctx, instance, &status); + } + } else { + DEBUGOUT("!!! Object type unknown: %s\n", objsClassName); + return status; + } + + DEBUGOUT("Leaving doReferences\n"); + return status; +} + +/****************************************************************************** +Associators() + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char *assocClass + char *resultClass + char *role + char *resultRole + char **properties +******************************************************************************/ +static CMPIStatus +Associators( + CMPIAssociationMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char *assocClass, + const char *resultClass, + const char *role, + const char *resultRole, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("Associators() called"); + + status = omccmpiSimpleAssociators(doReferences, self, + _broker, context, results, cop, assocClass, + resultClass, role, resultRole, properties); + + DEBUGOUT("Leaving Associatiors(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); + return status; +} + + +/****************************************************************************** +AssociatorNames() + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char *assocClass + char *resultClass + char *role + char *resultRole +******************************************************************************/ +static CMPIStatus +AssociatorNames( + CMPIAssociationMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char *assocClass, + const char *resultClass, + const char *role, + const char *resultRole) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("AssociatorNames() called"); + + status = omccmpiSimpleAssociatorNames(doReferences, self, _broker, + context, results, cop, assocClass, resultClass, role, + resultRole); + + DEBUGOUT("Leaving AssociatiorNames(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); + return status; +} + +/****************************************************************************** +References() + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char *resultClass + char *role + char **properties +******************************************************************************/ +static CMPIStatus References( + CMPIAssociationMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char* resultClass, + const char* role, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("References() called"); + + status = omccmpiSimpleReferences( doReferences, self, _broker, context, + results, cop, resultClass, role, properties); + + DEBUGOUT("Leaving References(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); + return status; +} + + +/****************************************************************************** +ReferenceNames() + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char *resultClass + char *role +******************************************************************************/ +static CMPIStatus +ReferenceNames( + CMPIAssociationMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char* resultClass, + const char* role) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("ReferenceNames() called"); + + status = omccmpiSimpleReferenceNames( doReferences, self, _broker, + context, results, cop, resultClass, role); + + DEBUGOUT("Leaving ReferenceNames(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); + return status; +} + +/***************************************************************************** + SETUP CMPI INSTANCE PROVIDER FUNCTION TABLE +******************************************************************************/ + +/* Macros to create entry points, function tables, etc. + Params: + 1: _optional_ prefix for function names. + 2: the name of the provider (within the cimom - must be unique among all + providers. Recommended: <OMC_FooClass>_Provider + This is the same name that must be used to register the provider + with the cimom + 3: local static variable for CMPIBroker (cimom handle) + Initialized by cimom when the provider is loaded. + 4: provider's additional init function, called right after provider load. + If no additional init is required, specify "CMNoHook" +*/ +CMInstanceMIStub( , omc_xenowningjob, _broker, Init(&mi)); +CMAssociationMIStub( , omc_xenowningjob, _broker, AssocInit(&mi)); + + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-23 22:42:42
|
Revision: 619 http://omc.svn.sourceforge.net/omc/?rev=619&view=rev Author: jcarey Date: 2008-05-23 15:42:32 -0700 (Fri, 23 May 2008) Log Message: ----------- implemented process of job assoc Modified Paths: -------------- contrib/xen-vm-builder/trunk/mof/builder-job-peg.reg contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c Modified: contrib/xen-vm-builder/trunk/mof/builder-job-peg.reg =================================================================== --- contrib/xen-vm-builder/trunk/mof/builder-job-peg.reg 2008-05-23 19:30:11 UTC (rev 618) +++ contrib/xen-vm-builder/trunk/mof/builder-job-peg.reg 2008-05-23 22:42:32 UTC (rev 619) @@ -26,4 +26,16 @@ SupportedMethods = NULL; // All methods }; +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "OMC_XENVMBuilderJob_Module"; + ProviderName = "omc_xenvmbuilderjob"; + CapabilityID = "OMC_XENVMBuilderJob0002"; + ClassName = "XEN_VMBuilderProcessOfJob"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 3 }; // Instance, Associator + SupportedProperties = NULL; // All properties + SupportedMethods = NULL; // All methods +}; + Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-23 19:30:11 UTC (rev 618) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-23 22:42:32 UTC (rev 619) @@ -59,6 +59,13 @@ NULL }; +static const char* proc_of_job_class_keys[] = +{ + "GroupComponent", + "PartComponent", + NULL +}; + static const char* job_states[] = { "SETTINGS", "PREP_INSTALL", @@ -108,10 +115,35 @@ */ static const CMPIBroker* _broker; -/****************************************************************************** - CMPI INSTANCE PROVIDER FUNCTIONS -******************************************************************************/ +/*****************************************************************************/ +CMPIObjectPath* +get_proc_ref(const char* ns, int pid, CMPIStatus* pstatus) +{ + CMPIObjectPath *ref; + char wkbfr[128]; + char hname[256]; + ref = CMNewObjectPath(_broker, ns, "OMC_UnixProcess", + pstatus); + if (pstatus->rc != CMPI_RC_OK || CMIsNullObject(ref)) { + OMC_SETSTATUS(_broker, pstatus, CMPI_RC_ERROR_SYSTEM, + "Failed creating new object path for process"); + return NULL; + } + if (!omcGetComputerSystemName(hname, sizeof(hname))) { + omcStrNCpy(hname, "localhost", sizeof(hname)); + } + CMAddKey(ref, "CSCreationClassName", (CMPIValue*)omcGetComputerSystemClassName(), CMPI_chars); + CMAddKey(ref, "CSName", (CMPIValue*)hname, CMPI_chars); + CMAddKey(ref, "OSCreationClassName", (CMPIValue*)omcGetOperatingSystemClassName(), CMPI_chars); + CMAddKey(ref, "OSName", (CMPIValue*)"Linux", CMPI_chars); + CMAddKey(ref, "CreationClassName", (CMPIValue*)"OMC_UnixProcess", CMPI_chars); + snprintf(wkbfr, sizeof(wkbfr), "%d", pid); + CMAddKey(ref, "Handle", (CMPIValue*)wkbfr, CMPI_chars); + return ref; +} + +/*****************************************************************************/ static int get_job_info(const char* id, VMInstallInfo* pinfo) { @@ -292,6 +324,9 @@ return instance; } +/****************************************************************************** + CMPI INSTANCE PROVIDER FUNCTIONS +******************************************************************************/ /****************************************************************************** EnumInstanceNames() @@ -747,25 +782,313 @@ return status; } -/***************************************************************************** - SETUP CMPI INSTANCE PROVIDER FUNCTION TABLE +/****************************************************************************** +AssocInit() - init + params: CMPIAssociationMI* self: [in] Handle to this provider ******************************************************************************/ +static void +AssocInit( + CMPIAssociationMI* self) +{ + DEBUGOUT("AssocInit() called"); -/* Macros to create entry points, function tables, etc. - Params: - 1: _optional_ prefix for function names. - 2: the name of the provider (within the cimom - must be unique among all - providers. Recommended: <OMC_FooClass>_Provider - This is the same name that must be used to register the provider - with the cimom - 3: local static variable for CMPIBroker (cimom handle) - Initialized by cimom when the provider is loaded. - 4: provider's additional init function, called right after provider load. - If no additional init is required, specify "CMNoHook" -*/ + DEBUGOUT("Leaving AssocInit()\n"); +} + +/****************************************************************************** +AssociationCleanup() - pre unload + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIBoolean terminating +******************************************************************************/ +static CMPIStatus +AssociationCleanup( + CMPIAssociationMI* self, + const CMPIContext* context, + CMPIBoolean terminating) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("AssociationCleanup() called"); + + DEBUGOUT("Leaving AssociationCleanup(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); + return status; +} + +/*****************************************************************************/ +static CMPIStatus +doReferences( + omccmpiSimpleAssocCtx ctx, + CMPIAssociationMI *self, + const CMPIBroker *broker, + const CMPIContext *context, + const CMPIResult *results, + const CMPIObjectPath *cop, + const char *assocClass, + const char *resultClass, + const char *role, + const char *resultRole, + const char **properties) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + CMPIStatus okstatus = {CMPI_RC_OK, NULL}; + char *endptr, *ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); + char** names = NULL; + CMPIObjectPath *procref, *jobref; + CMPIInstance *instance; + const char *object_class_name, *p; + CMPIData key; + int pid; + VMInstallInfo info; + + DEBUGOUT("doReferences called\n"); + + object_class_name = CMGetCharPtr(CMGetClassName(cop, NULL)); + if(strcasecmp(object_class_name, "OMC_UnixProcess") == 0) { + if (role && *role && strcasecmp(role, "PartComponent") != 0) { + /* Unknown role */ + return okstatus; + } + if (resultRole && *resultRole && strcasecmp(resultRole, + "GroupComponent") != 0) { + /* Unknown resultRole */ + return okstatus; + } + if (resultClass && *resultClass) { + if (!omccmpiClassIsDerivedFrom("XEN_VMBuilderJob", + resultClass, _broker, ns, &status)) { + return okstatus; + } + } + key = CMGetKey(cop, "Handle", &status); + if (status.rc != CMPI_RC_OK || CMIsNullValue(key)) { + return okstatus; + } + p = CMGetCharPtr(key.value.string); + pid = (int)strtol(p, &endptr, 10); + if (endptr == p || *endptr) { + return okstatus; + } + + jobref = NULL; + names = get_job_names(); + if (names) { + int i; + for(i = 0; names[i]; i++) { + if(get_job_info(names[i], &info) == 0) { + if (info.pid == pid) { + jobref = CMNewObjectPath(_broker, ns, + "XEN_VMBUilderJob", &status); + if (status.rc != CMPI_RC_OK || CMIsNullObject(jobref)) { + DEBUGOUT("doReferences(): CMNewObjectPath() " + "failed - %d\n", status.rc); + OMC_SETSTATUS(_broker, &status, + CMPI_RC_ERROR_SYSTEM, + "Failed creating object path"); + jobref = NULL; + } else { + CMAddKey(jobref, "Name", (CMPIValue*)names[i], CMPI_chars); + } + break; + } + } + } + free(names); + } + if (jobref) { + instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderProcessOfJob", + proc_of_job_class_keys, properties, &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { + DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + CMGetCharPtr(status.msg)); + return status; + } + + CMSetProperty(instance, "GroupComponent", (CMPIValue*)&jobref, CMPI_ref); + CMSetProperty(instance, "PartComponent", (CMPIValue*)&cop, CMPI_ref); + omccmpiSimpleAssocResults(ctx, instance, &status); + } + } else if(strcasecmp(object_class_name, "XEN_VMBuilderJob") == 0) { + if (role && *role && strcasecmp(role, "GroupComponent") != 0) { + /* Unknown role */ + return okstatus; + } + if (resultRole && *resultRole && strcasecmp(resultRole, + "PartComponent") != 0) { + /* Unknown resultRole */ + return okstatus; + } + if (resultClass && *resultClass) { + if (!omccmpiClassIsDerivedFrom("OMC_UnixProcess", + resultClass, _broker, ns, &status)) { + return okstatus; + } + } + + key = CMGetKey(cop, "Name", &status); + if (status.rc != CMPI_RC_OK || CMIsNullValue(key)) { + return okstatus; + } + p = CMGetCharPtr(key.value.string); + if (!p || strlen(p) == 0) { + return okstatus; + } + if(get_job_info(p, &info) != 0 || info.pid == 0) { + return okstatus; + } + procref = get_proc_ref(ns, info.pid, &status); + if (!procref) { + return status; + } + instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderProcessOfJob", + proc_of_job_class_keys, properties, &status); + if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { + DEBUGOUT("doReferences(): omccmpiNewInstance() failed - %s\n", + CMGetCharPtr(status.msg)); + return status; + } + CMSetProperty(instance, "GroupComponent", (CMPIValue*)&cop, CMPI_ref); + CMSetProperty(instance, "PartComponent", (CMPIValue*)&procref, CMPI_ref); + omccmpiSimpleAssocResults(ctx, instance, &status); + } + DEBUGOUT("Leaving doReferences\n"); + return okstatus; +} + +/****************************************************************************** +Associators() + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char *assocClass + char *resultClass + char *role + char *resultRole + char **properties +******************************************************************************/ +static CMPIStatus +Associators( + CMPIAssociationMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char *assocClass, + const char *resultClass, + const char *role, + const char *resultRole, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("Associators() called"); + + status = omccmpiSimpleAssociators(doReferences, self, + _broker, context, results, cop, assocClass, + resultClass, role, resultRole, properties); + + DEBUGOUT("Leaving Associatiors(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); + return status; +} + + +/****************************************************************************** +AssociatorNames() + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char *assocClass + char *resultClass + char *role + char *resultRole +******************************************************************************/ +static CMPIStatus +AssociatorNames( + CMPIAssociationMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char *assocClass, + const char *resultClass, + const char *role, + const char *resultRole) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("AssociatorNames() called"); + + status = omccmpiSimpleAssociatorNames(doReferences, self, _broker, + context, results, cop, assocClass, resultClass, role, + resultRole); + + DEBUGOUT("Leaving AssociatiorNames(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); + return status; +} + +/****************************************************************************** +References() + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char *resultClass + char *role + char **properties +******************************************************************************/ +static CMPIStatus References( + CMPIAssociationMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char* resultClass, + const char* role, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("References() called"); + + status = omccmpiSimpleReferences( doReferences, self, _broker, context, + results, cop, resultClass, role, properties); + + DEBUGOUT("Leaving References(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); + return status; +} + + +/****************************************************************************** +ReferenceNames() + params: CMPIAssociationMI* self: [in] Handle to this provider + CMPIContext* context: [in] any additional context info + CMPIResult* results: [out] Results + CMPIObjectPath* cop: [in] target namespace and classname, and desired objectpath + char *resultClass + char *role +******************************************************************************/ +static CMPIStatus +ReferenceNames( + CMPIAssociationMI* self, + const CMPIContext* context, + const CMPIResult* results, + const CMPIObjectPath* cop, + const char* resultClass, + const char* role) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; + + DEBUGOUT("ReferenceNames() called"); + + status = omccmpiSimpleReferenceNames( doReferences, self, _broker, + context, results, cop, resultClass, role); + + DEBUGOUT("Leaving ReferenceNames(): %s", (status.rc == CMPI_RC_OK)?"succeeded":"failed"); + return status; +} + CMInstanceMIStub( , omc_xenvmbuilderjob, _broker, Init(&mi)); CMMethodMIStub( , omc_xenvmbuilderjob, _broker, MethodInit(&mi)); +CMAssociationMIStub( , omc_xenvmbuilderjob, _broker, AssocInit(&mi)); - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-23 19:30:04
|
Revision: 618 http://omc.svn.sourceforge.net/omc/?rev=618&view=rev Author: jcarey Date: 2008-05-23 12:30:11 -0700 (Fri, 23 May 2008) Log Message: ----------- implemented delete instance Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-23 15:14:21 UTC (rev 617) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-23 19:30:11 UTC (rev 618) @@ -59,8 +59,7 @@ NULL }; -static const char* job_states[] = -{ +static const char* job_states[] = { "SETTINGS", "PREP_INSTALL", "INSTALL", @@ -72,6 +71,18 @@ "CANCELED" }; +enum JobState { + JOBSTATE_SETTINGS, + JOBSTATE_PREP_INSTALL, + JOBSTATE_INSTALL, + JOBSTATE_POST_INSTALL, + JOBSTATE_RUNTIME_CONF, + JOBSTATE_RUNTIME, + JOBSTATE_FINISHED, + JOBSTATE_FAILED, + JOBSTATE_CANCELED +}; + typedef struct { char vnc[8]; char uuid[40]; @@ -80,6 +91,7 @@ char id[32]; char log[256]; int state; + int pid; char inotify[256]; } VMInstallInfo; @@ -144,6 +156,8 @@ omcStrTrim(pinfo->log); } else if (omcStrStartsWith(lines[i], "state ")) { pinfo->state = atoi(lines[i]+6); + } else if (omcStrStartsWith(lines[i], "pid ")) { + pinfo->pid = atoi(lines[i]+4); } else if (omcStrStartsWith(lines[i], "inotify ")) { omcStrNCpy(pinfo->inotify, lines[i]+8, sizeof(pinfo->inotify)); omcStrTrim(pinfo->inotify); @@ -480,7 +494,58 @@ const CMPIResult* results, const CMPIObjectPath* cop) { - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + CMPIStatus status = {CMPI_RC_OK, NULL}; + CMPIString *class = NULL; + const char* job_name_key; + CMPIData key; + VMInstallInfo info; + + DEBUGOUT("DeleteInstance() called...\n"); + + class = CMGetClassName(cop, &status); + if (strcasecmp(CMGetCharPtr(class), "XEN_VMBuilderJob") != 0) + { + DEBUGOUT("DeleteInstance() INVALID class name %s\n", CMGetCharPtr(class)); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_CLASS, + CMGetCharPtr(class)); + return status; + } + + key = CMGetKey(cop, "Name", &status); + if (status.rc != CMPI_RC_OK || CMIsNullValue(key)) { + DEBUGOUT("DeleteInstance(): CMGetKey(\"Name\") failed - %d\n", status.rc); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + "Cannot get 'Name' property from specified object name"); + return status; + } + + job_name_key = CMGetCharPtr(key.value.string); + if (!job_name_key || !strlen(job_name_key)) { + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Empty Name property"); + return status; + } + + if(get_job_info(job_name_key, &info) != 0) { + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + "Unable to get job information"); + return status; + } + + if (info.state != JOBSTATE_FINISHED + && info.state != JOBSTATE_FAILED + && info.state != JOBSTATE_CANCELED) { + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_SUPPORTED, + "Job must be in the FINISHED, FAILED or CANCELED states " + "to be deleted"); + return status; + } + + if (delete_job(job_name_key) != 0) { + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_FAILED, + "Unabled to delete job"); + return status; + } + return status; } @@ -603,7 +668,6 @@ int cc; DEBUGOUT("InvokeMethod() called. methodName: %s\n", methodName); -printf("InvokeMethod() called. methodName: %s\n", methodName); rv.uint32 = 1; // Default to 'Not supported' class = CMGetClassName(cop, &status); @@ -627,19 +691,15 @@ return status; } -printf("*** getting job_name_key\n"); job_name_key = CMGetCharPtr(key.value.string); if (!job_name_key || !strlen(job_name_key)) { -printf("*** FAILED getting job_name_key\n"); OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Empty Name property"); CMReturnData(results, &rv, CMPI_uint32); CMReturnDone(results); return status; } -printf("*** getting job info\n"); if(get_job_info(job_name_key, &info) != 0) { -printf("*** Unable to get job information\n"); OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Unable to get job information"); CMReturnData(results, &rv, CMPI_uint32); @@ -650,22 +710,16 @@ if (strcasecmp("Cancel", methodName) == 0) { DEBUGOUT("InvokeMethod(): Cancel called for job %s\n", job_name_key); -printf("Cancel 1\n"); cc = cancel_job(job_name_key); -printf("Cancel 2\n"); if (cc != 0) { -printf("Cancel 3\n"); rv.uint32 = 4; } else { -printf("Cancel 4\n"); rv.uint32 = 0; -printf("Cancel 5\n"); delete_job(job_name_key); -printf("Cancel 6\n"); } } else if (strcasecmp("Detach", methodName) == 0) { DEBUGOUT("InvokeMethod(): Detach called for job %s\n", job_name_key); - if (info.state != 6) { + if (info.state != JOBSTATE_FINISHED) { /* Not in FINISHED state. */ rv.uint32 = 4097; // Invalid state change } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-23 15:14:13
|
Revision: 617 http://omc.svn.sourceforge.net/omc/?rev=617&view=rev Author: jcarey Date: 2008-05-23 08:14:21 -0700 (Fri, 23 May 2008) Log Message: ----------- debugging... Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-23 15:11:36 UTC (rev 616) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-23 15:14:21 UTC (rev 617) @@ -162,6 +162,49 @@ return cc; } +/*****************************************************************************/ +static int +cancel_job(const char* id) +{ + const char* cmd[] = { + "/usr/bin/vm-install-jobs", + "--cancel", + id, + NULL + }; + + return omcSafeSystem((char* const*)cmd, NULL); +} + +/*****************************************************************************/ +static int +delete_job(const char* id) +{ + const char* cmd[] = { + "/usr/bin/vm-install-jobs", + "--delete", + id, + NULL + }; + + return omcSafeSystem((char* const*)cmd, NULL); +} + +/*****************************************************************************/ +static int +detach_job(const char* id) +{ + const char* cmd[] = { + "/usr/bin/vm-install-jobs", + "--detach", + id, + NULL + }; + + return omcSafeSystem((char* const*)cmd, NULL); +} + +/*****************************************************************************/ static char** get_job_names() { @@ -191,6 +234,51 @@ return names; } +/*****************************************************************************/ +static CMPIInstance* +_getJobInstance(const char* job_name_key, const char* ns, + const char** properties, CMPIStatus* pstatus) +{ + VMInstallInfo info; + CMPIInstance *instance = NULL; + if(get_job_info(job_name_key, &info) == 0) { + instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderJob", + job_class_keys, properties, pstatus); + if (pstatus->rc != CMPI_RC_OK || CMIsNullObject(instance)) { + DEBUGOUT("_getJobInstance(): CMNewInstance() failed - %d\n", + pstatus->rc); + } else { + const char* p; + CMSetProperty(instance, "Name", (CMPIValue*)job_name_key, + CMPI_chars); + CMSetProperty(instance, "Caption", (CMPIValue*)"VM Install Job", + CMPI_chars); + CMSetProperty(instance, "Description", + (CMPIValue*)"VM Installation Job", CMPI_chars); + CMSetProperty(instance, "VMName", (CMPIValue*)info.name, + CMPI_chars); + CMSetProperty(instance, "VncURL", (CMPIValue*)info.vnc, + CMPI_chars); + CMSetProperty(instance, "VM_UUID", (CMPIValue*)info.uuid, + CMPI_chars); + CMSetProperty(instance, "ExitCode", + (CMPIValue*)&info.exit_code, CMPI_uint32); + CMSetProperty(instance, "InstallLogFileLocation", + (CMPIValue*)info.log, CMPI_chars); + p = (info.state > 8) ? "UNKNOWN" : job_states[info.state]; + CMSetProperty(instance, "JobStatus", (CMPIValue*)p, + CMPI_chars); + CMSetProperty(instance, "StatusFileName", (CMPIValue*)info.inotify, + CMPI_chars); + } + } else { + OMC_SETSTATUS(_broker, pstatus, CMPI_RC_ERR_NOT_FOUND, + "Unable to get job info for job"); + } + return instance; +} + + /****************************************************************************** EnumInstanceNames() params: CMPIInstanceMI* self: [in] Handle to this provider @@ -267,35 +355,10 @@ char** names = NULL; names = get_job_names(); if (names) { - const char* p; - VMInstallInfo info; int i; for(i = 0; names[i]; i++) { - if(get_job_info(names[i], &info) == 0) { - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderJob", - job_class_keys, properties, &status); - if (status.rc != CMPI_RC_OK || CMIsNullObject(instance)) { - DEBUGOUT("EnumInstances(): CMNewInstance() failed - %s\n", - CMGetCharPtr(status.msg)); - return status; - } - CMSetProperty(instance, "Name", (CMPIValue*)names[i], - CMPI_chars); - CMSetProperty(instance, "VMName", (CMPIValue*)info.name, - CMPI_chars); - CMSetProperty(instance, "VncURL", (CMPIValue*)info.vnc, - CMPI_chars); - CMSetProperty(instance, "VM_UUID", (CMPIValue*)info.uuid, - CMPI_chars); - CMSetProperty(instance, "ExitCode", - (CMPIValue*)&info.exit_code, CMPI_uint32); - CMSetProperty(instance, "InstallLogFileLocation", - (CMPIValue*)info.log, CMPI_chars); - p = (info.state > 8) ? "UNKNOWN" : job_states[info.state]; - CMSetProperty(instance, "JobStatus", (CMPIValue*)p, - CMPI_chars); - CMSetProperty(instance, "StatusFileName", (CMPIValue*)info.inotify, - CMPI_chars); + instance = _getJobInstance(names[i], ns, properties, &status); + if (instance) { CMReturnInstance(results, instance); } } @@ -308,7 +371,6 @@ return status; } - /****************************************************************************** GetInstance() params: CMPIInstanceMI* self: [in] Handle to this provider @@ -331,8 +393,6 @@ char *ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); const char *className; CMPIData key; - int found = 0; - char** names = NULL; DEBUGOUT("GetInstance() called\n"); @@ -354,55 +414,10 @@ return status; } - names = get_job_names(); - if (names) { - VMInstallInfo info; - const char* p; - int i; - for(i = 0; names[i]; i++) { - if (!strcasecmp(names[i], job_name_key)) { - if(get_job_info(names[i], &info) == 0) { - instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderJob", - job_class_keys, properties, &status); - if (status.rc != CMPI_RC_OK || CMIsNullObject(instance)) { - DEBUGOUT("EnumInstances(): CMNewInstance() failed - %d\n", - status.rc); - free(names); - return status; - } - CMSetProperty(instance, "Name", (CMPIValue*)names[i], - CMPI_chars); - CMSetProperty(instance, "VMName", (CMPIValue*)info.name, - CMPI_chars); - CMSetProperty(instance, "VncURL", (CMPIValue*)info.vnc, - CMPI_chars); - CMSetProperty(instance, "VM_UUID", (CMPIValue*)info.uuid, - CMPI_chars); - CMSetProperty(instance, "ExitCode", - (CMPIValue*)&info.exit_code, CMPI_uint32); - CMSetProperty(instance, "InstallLogFileLocation", - (CMPIValue*)info.log, CMPI_chars); - p = (info.state > 8) ? "UNKNOWN" : job_states[info.state]; - CMSetProperty(instance, "JobStatus", (CMPIValue*)p, - CMPI_chars); - CMSetProperty(instance, "StatusFileName", (CMPIValue*)info.inotify, - CMPI_chars); - CMReturnInstance(results, instance); - found = 1; - break; - } else { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, - "Unable to get job info for job"); - free(names); - return status; - } - } - } - free(names); + instance = _getJobInstance(job_name_key, ns, properties, &status); + if (instance) { + CMReturnInstance(results, instance); } - if (!found) { - CMSetStatus(&status, CMPI_RC_ERR_NOT_FOUND); - } } DEBUGOUT("Leaving GetInstance(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; @@ -582,46 +597,98 @@ CMPIStatus status = {CMPI_RC_OK, NULL}; CMPIString *class = NULL; CMPIValue rv; - /* char *ns = CMGetCharPtr(CMGetNameSpace(cop, NULL)); */ + const char* job_name_key; + CMPIData key; + VMInstallInfo info; + int cc; DEBUGOUT("InvokeMethod() called. methodName: %s\n", methodName); +printf("InvokeMethod() called. methodName: %s\n", methodName); + rv.uint32 = 1; // Default to 'Not supported' class = CMGetClassName(cop, &status); if (strcasecmp(CMGetCharPtr(class), "XEN_VMBuilderJob") != 0) { DEBUGOUT("InvokeMethod() INVALID class name %s\n", CMGetCharPtr(class)); OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_CLASS, CMGetCharPtr(class)); + CMReturnData(results, &rv, CMPI_uint32); + CMReturnDone(results); return status; } - if (strcasecmp("Cancel", methodName) == 0) - { - OMC_SETSTATUS(_broker, &status, - CMPI_RC_ERR_NOT_SUPPORTED, - "Not implemented yet"); - rv.uint32 = 1; // Not supported + key = CMGetKey(cop, "Name", &status); + if (status.rc != CMPI_RC_OK || CMIsNullValue(key)) { + DEBUGOUT("InvokeMethod(): CMGetKey(\"Name\") failed - %d\n", status.rc); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + "Cannot get 'Name' property from specified object name"); CMReturnData(results, &rv, CMPI_uint32); CMReturnDone(results); - } else if (strcasecmp("Detach", methodName) == 0) { - CMLogMessage(_broker, 1, "VMBuilderService provider", - "RequestStateChange called, but not supported", NULL); - rv.uint32 = 1; // Not supported + return status; + } + +printf("*** getting job_name_key\n"); + job_name_key = CMGetCharPtr(key.value.string); + if (!job_name_key || !strlen(job_name_key)) { +printf("*** FAILED getting job_name_key\n"); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Empty Name property"); CMReturnData(results, &rv, CMPI_uint32); CMReturnDone(results); + return status; + } + +printf("*** getting job info\n"); + if(get_job_info(job_name_key, &info) != 0) { +printf("*** Unable to get job information\n"); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + "Unable to get job information"); + CMReturnData(results, &rv, CMPI_uint32); + CMReturnDone(results); + return status; + } + + if (strcasecmp("Cancel", methodName) == 0) + { + DEBUGOUT("InvokeMethod(): Cancel called for job %s\n", job_name_key); +printf("Cancel 1\n"); + cc = cancel_job(job_name_key); +printf("Cancel 2\n"); + if (cc != 0) { +printf("Cancel 3\n"); + rv.uint32 = 4; + } else { +printf("Cancel 4\n"); + rv.uint32 = 0; +printf("Cancel 5\n"); + delete_job(job_name_key); +printf("Cancel 6\n"); + } + } else if (strcasecmp("Detach", methodName) == 0) { + DEBUGOUT("InvokeMethod(): Detach called for job %s\n", job_name_key); + if (info.state != 6) { + /* Not in FINISHED state. */ + rv.uint32 = 4097; // Invalid state change + } else { + cc = detach_job(job_name_key); + if (cc != 0) { + rv.uint32 = 4; /* Failed */ + } else { + rv.uint32 = 0; + } + } } else if (strcasecmp("KillJob", methodName) == 0) { - CMLogMessage(_broker, 1, "VMBuilderService provider", - "StartService called, but not supported", NULL); - rv.uint32 = 1; // Not supported OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_SUPPORTED, - "Cannot start VMBuilder Service. Always running"); + "KillJob called, but not supported - Deprecated"); + CMLogMessage(_broker, 1, "VMBuilderService provider", + "KillJob called, but not supported - Deprecated", NULL); rv.uint32 = 1; // Not supported - CMReturnData(results, &rv, CMPI_uint32); - CMReturnDone(results); } else { OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, methodName); + rv.uint32 = 1; // Not supported } + CMReturnData(results, &rv, CMPI_uint32); + CMReturnDone(results); DEBUGOUT("Leaving InvokeMethod(): %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-23 15:11:30
|
Revision: 616 http://omc.svn.sourceforge.net/omc/?rev=616&view=rev Author: jcarey Date: 2008-05-23 08:11:36 -0700 (Fri, 23 May 2008) Log Message: ----------- Changed capability IDs Modified Paths: -------------- contrib/xen-vm-builder/trunk/mof/XEN_VMBuilderJob.mof contrib/xen-vm-builder/trunk/mof/builder-job-peg.reg contrib/xen-vm-builder/trunk/mof/builder-service-peg.reg Modified: contrib/xen-vm-builder/trunk/mof/XEN_VMBuilderJob.mof =================================================================== --- contrib/xen-vm-builder/trunk/mof/XEN_VMBuilderJob.mof 2008-05-22 16:19:58 UTC (rev 615) +++ contrib/xen-vm-builder/trunk/mof/XEN_VMBuilderJob.mof 2008-05-23 15:11:36 UTC (rev 616) @@ -140,7 +140,7 @@ "0", "1", "2", - "4", + "4", "4097"}, Values { "Completed with No Error", Modified: contrib/xen-vm-builder/trunk/mof/builder-job-peg.reg =================================================================== --- contrib/xen-vm-builder/trunk/mof/builder-job-peg.reg 2008-05-22 16:19:58 UTC (rev 615) +++ contrib/xen-vm-builder/trunk/mof/builder-job-peg.reg 2008-05-23 15:11:36 UTC (rev 616) @@ -18,7 +18,7 @@ { ProviderModuleName = "OMC_XENVMBuilderJob_Module"; ProviderName = "omc_xenvmbuilderjob"; - CapabilityID = "1"; + CapabilityID = "OMC_XENVMBuilderJob0001"; ClassName = "XEN_VMBuilderJob"; Namespaces = {"root/cimv2"}; ProviderType = { 2, 5 }; // Instance, Method Modified: contrib/xen-vm-builder/trunk/mof/builder-service-peg.reg =================================================================== --- contrib/xen-vm-builder/trunk/mof/builder-service-peg.reg 2008-05-22 16:19:58 UTC (rev 615) +++ contrib/xen-vm-builder/trunk/mof/builder-service-peg.reg 2008-05-23 15:11:36 UTC (rev 616) @@ -18,7 +18,7 @@ { ProviderModuleName = "OMC_XENVMBuilder_Module"; ProviderName = "omc_xenvmbuilder"; - CapabilityID = "1"; + CapabilityID = "OMC_XENVMBuilder_Module0001"; ClassName = "XEN_VMBuilderService"; Namespaces = {"root/cimv2"}; ProviderType = { 2, 5 }; // Instance, Method @@ -30,7 +30,7 @@ { ProviderModuleName = "OMC_XENVMBuilder_Module"; ProviderName = "omc_xenvmbuilder"; - CapabilityID = "2"; + CapabilityID = "OMC_XENVMBuilder_Module0002"; ClassName = "XEN_VMBuilderHostedService"; Namespaces = {"root/cimv2"}; ProviderType = { 2, 3 }; // Instance, Associator This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-22 16:20:31
|
Revision: 615 http://omc.svn.sourceforge.net/omc/?rev=615&view=rev Author: jcarey Date: 2008-05-22 09:19:58 -0700 (Thu, 22 May 2008) Log Message: ----------- fixed bug associated with having a string array property with 1 empty string Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.c 2008-05-20 17:40:27 UTC (rev 614) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmbuilder-util.c 2008-05-22 16:19:58 UTC (rev 615) @@ -76,11 +76,11 @@ int strcnt, slen, i; omcStrArray* pstra; - if (strlen(str) < 9) { + if (strlen(str) < 8) { // Just return a string array with 1 element CMPIString *pstr = CMNewString(broker, str, NULL); pra = CMNewArray(broker, 1, CMPI_string, NULL); - CMSetArrayElementAt(pra, 1, (CMPIValue*)&pstr, CMPI_string); + CMSetArrayElementAt(pra, 0, (CMPIValue*)&pstr, CMPI_string); } else { omcStrBuf* pbuf = omcStrBuf_create(); if (!pbuf) { @@ -98,9 +98,13 @@ strncpy(smbuf, str, 4); smbuf[4] = 0; slen = atoi(smbuf); - omcStrBuf_set(pbuf, str+4, slen); - omcStrArray_append(pstra, pbuf->bfr); - str += slen; + if (!slen) { + omcStrArray_append(pstra, ""); + } else { + omcStrBuf_set(pbuf, str+4, slen); + omcStrArray_append(pstra, pbuf->bfr); + str += slen; + } } if (omcStrArray_size(pstra) > 0) { int sz = omcStrArray_size(pstra); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-05-20 17:40:24
|
Revision: 614 http://omc.svn.sourceforge.net/omc/?rev=614&view=rev Author: npaxton Date: 2008-05-20 10:40:27 -0700 (Tue, 20 May 2008) Log Message: ----------- change to tar-ustar to allow long filenames in tarball Modified Paths: -------------- sblim-cmpi-base-plus/trunk/Makefile.am sblim-cmpi-base-plus/trunk/configure.ac Modified: sblim-cmpi-base-plus/trunk/Makefile.am =================================================================== --- sblim-cmpi-base-plus/trunk/Makefile.am 2008-05-20 17:16:23 UTC (rev 613) +++ sblim-cmpi-base-plus/trunk/Makefile.am 2008-05-20 17:40:27 UTC (rev 614) @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -AUTOMAKE_OPTIONS = gnu +#AUTOMAKE_OPTIONS = tar-ustar SUBDIRS = \ . \ Modified: sblim-cmpi-base-plus/trunk/configure.ac =================================================================== --- sblim-cmpi-base-plus/trunk/configure.ac 2008-05-20 17:16:23 UTC (rev 613) +++ sblim-cmpi-base-plus/trunk/configure.ac 2008-05-20 17:40:27 UTC (rev 614) @@ -3,7 +3,7 @@ AC_PREREQ(2.57) AC_INIT(sblim-cmpi-base-plus, 1.0.0) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE(tar-ustar) AC_CONFIG_SRCDIR([src]) AC_CONFIG_HEADER([config.h]) AC_PROG_LIBTOOL @@ -198,8 +198,8 @@ src/providers/Makefile src/providers/operating-system/Makefile src/providers/time-service/Makefile - mof/Makefile src/providers/logical-file/Makefile src/providers/logical-file/schema/Makefile + mof/Makefile ]) AC_OUTPUT This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <np...@us...> - 2008-05-20 17:16:17
|
Revision: 613 http://omc.svn.sourceforge.net/omc/?rev=613&view=rev Author: npaxton Date: 2008-05-20 10:16:23 -0700 (Tue, 20 May 2008) Log Message: ----------- Initial checkin of sblim extensions - cmpiutil lib and provider set to extend sblim cmpi base providers Added Paths: ----------- sblim-cmpi-base-plus/ sblim-cmpi-base-plus/branches/ sblim-cmpi-base-plus/tags/ sblim-cmpi-base-plus/trunk/ sblim-cmpi-base-plus/trunk/AUTHORS sblim-cmpi-base-plus/trunk/COPYING sblim-cmpi-base-plus/trunk/ChangeLog sblim-cmpi-base-plus/trunk/INSTALL sblim-cmpi-base-plus/trunk/LICENSE sblim-cmpi-base-plus/trunk/Makefile.am sblim-cmpi-base-plus/trunk/Makefile.incl.am sblim-cmpi-base-plus/trunk/NEWS sblim-cmpi-base-plus/trunk/README sblim-cmpi-base-plus/trunk/bootstrap.sh sblim-cmpi-base-plus/trunk/config.h.in sblim-cmpi-base-plus/trunk/configure.ac sblim-cmpi-base-plus/trunk/install-sh sblim-cmpi-base-plus/trunk/mof/ sblim-cmpi-base-plus/trunk/mof/Linux_BasePlus.registration sblim-cmpi-base-plus/trunk/mof/Makefile.am sblim-cmpi-base-plus/trunk/mof/linux-file-system-elements.mof sblim-cmpi-base-plus/trunk/mof/linux-initd.mof sblim-cmpi-base-plus/trunk/mof/linux-installed-os.mof sblim-cmpi-base-plus/trunk/mof/linux-logical-file.mof sblim-cmpi-base-plus/trunk/mof/linux-time-service.mof sblim-cmpi-base-plus/trunk/sblim-cmpi-base-plus.spec sblim-cmpi-base-plus/trunk/src/ sblim-cmpi-base-plus/trunk/src/Makefile.am sblim-cmpi-base-plus/trunk/src/providers/ sblim-cmpi-base-plus/trunk/src/providers/Makefile.am sblim-cmpi-base-plus/trunk/src/providers/logical-file/ sblim-cmpi-base-plus/trunk/src/providers/logical-file/CIM_LogicalFile_Provider.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/CIM_LogicalFile_Provider.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/CIM_LogicalFile_Provider_module.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/FilesCommon.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/FilesCommon.hpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/Linux_LinuxDirectoryContainsFile_Provider.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/Linux_LinuxDirectoryContainsFile_Provider.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/Linux_LinuxDirectoryContainsFile_Provider_module.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/Linux_LinuxFileIdentity_Provider.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/Linux_LinuxFileIdentity_Provider.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/Linux_LinuxFileIdentity_Provider_module.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/Linux_LinuxFile_Provider.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/Linux_LinuxFile_Provider.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/Linux_LinuxFile_Provider_module.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/Makefile.am sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/ sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_Component.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_Component.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_DataFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_DataFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_DeviceFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_DeviceFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_Directory.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_Directory.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_DirectoryContainsFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_DirectoryContainsFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_FIFOPipeFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_FIFOPipeFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_FileIdentity.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_FileIdentity.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_LogicalElement.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_LogicalElement.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_LogicalFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_LogicalFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_LogicalIdentity.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_LogicalIdentity.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_ManagedElement.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_ManagedElement.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_ManagedSystemElement.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_ManagedSystemElement.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_SymbolicLink.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_SymbolicLink.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_UnixDeviceFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_UnixDeviceFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_UnixDirectory.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_UnixDirectory.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_UnixFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/CIM_UnixFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_DataFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_DataFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_DirectoryContainsFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_DirectoryContainsFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_FIFOPipeFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_FIFOPipeFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_FileIdentity.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_FileIdentity.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxDataFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxDataFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxDeviceFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxDeviceFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxDirectory.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxDirectory.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxDirectoryContainsFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxDirectoryContainsFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxFIFOPipeFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxFIFOPipeFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxFileIdentity.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxFileIdentity.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxSymbolicLink.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_LinuxSymbolicLink.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_SymbolicLink.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_SymbolicLink.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_UnixDeviceFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_UnixDeviceFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_UnixDirectory.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_UnixDirectory.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_UnixFile.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Linux_UnixFile.h sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/Makefile.am sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/repository.cpp sblim-cmpi-base-plus/trunk/src/providers/logical-file/schema/repository.h sblim-cmpi-base-plus/trunk/src/providers/operating-system/ sblim-cmpi-base-plus/trunk/src/providers/operating-system/LinuxInstalledOS.c sblim-cmpi-base-plus/trunk/src/providers/operating-system/Makefile.am sblim-cmpi-base-plus/trunk/src/providers/time-service/ sblim-cmpi-base-plus/trunk/src/providers/time-service/Makefile.am sblim-cmpi-base-plus/trunk/src/providers/time-service/hostedTimeService.c sblim-cmpi-base-plus/trunk/src/providers/time-service/remoteTimeServicePort.c sblim-cmpi-base-plus/trunk/src/providers/time-service/systemTimeService.c sblim-cmpi-base-plus/trunk/src/providers/time-service/timeServiceAccessBySAP.c sblim-cmpi-base-plus/trunk/src/providers/time-service/timeServiceAvailableToElement.c sblim-cmpi-base-plus/trunk/src/providers/time-service/timeServiceTimeZoneSettingData.c sblim-cmpi-base-plus/trunk/src/providers/time-service/timeZoneSettingData.c sblim-cmpiutil/ sblim-cmpiutil/branches/ sblim-cmpiutil/tags/ sblim-cmpiutil/trunk/ sblim-cmpiutil/trunk/AUTHORS sblim-cmpiutil/trunk/COPYING sblim-cmpiutil/trunk/ChangeLog sblim-cmpiutil/trunk/LICENSE sblim-cmpiutil/trunk/Makefile.am sblim-cmpiutil/trunk/NEWS sblim-cmpiutil/trunk/README sblim-cmpiutil/trunk/bootstrap.sh sblim-cmpiutil/trunk/config.h.in sblim-cmpiutil/trunk/configure.ac sblim-cmpiutil/trunk/sblim-cmpiutil.spec sblim-cmpiutil/trunk/src/ sblim-cmpiutil/trunk/src/Makefile.am sblim-cmpiutil/trunk/src/include/ sblim-cmpiutil/trunk/src/include/Makefile.am sblim-cmpiutil/trunk/src/include/cmpiutil/ sblim-cmpiutil/trunk/src/include/cmpiutil/Makefile.am sblim-cmpiutil/trunk/src/include/cmpiutil/base.h sblim-cmpiutil/trunk/src/include/cmpiutil/cmpiSimpleAssoc.h sblim-cmpiutil/trunk/src/include/cmpiutil/cmpiTimeServiceUtils.h sblim-cmpiutil/trunk/src/include/cmpiutil/cmpiUtils.h sblim-cmpiutil/trunk/src/include/cmpiutil/exec.h sblim-cmpiutil/trunk/src/include/cmpiutil/fileTools.h sblim-cmpiutil/trunk/src/include/cmpiutil/ioUtils.h sblim-cmpiutil/trunk/src/include/cmpiutil/linuxProcUtils.h sblim-cmpiutil/trunk/src/include/cmpiutil/modifyFile.h sblim-cmpiutil/trunk/src/include/cmpiutil/ntpServer.h sblim-cmpiutil/trunk/src/include/cmpiutil/string.h sblim-cmpiutil/trunk/src/lib/ sblim-cmpiutil/trunk/src/lib/Makefile.am sblim-cmpiutil/trunk/src/lib/cmpiutil/ sblim-cmpiutil/trunk/src/lib/cmpiutil/Makefile.am sblim-cmpiutil/trunk/src/lib/cmpiutil/base.c sblim-cmpiutil/trunk/src/lib/cmpiutil/cmpiSimpleAssoc.c sblim-cmpiutil/trunk/src/lib/cmpiutil/cmpiTimeServiceUtils.c sblim-cmpiutil/trunk/src/lib/cmpiutil/cmpiUtils.c sblim-cmpiutil/trunk/src/lib/cmpiutil/exec.c sblim-cmpiutil/trunk/src/lib/cmpiutil/fileTools.c sblim-cmpiutil/trunk/src/lib/cmpiutil/ioUtils.c sblim-cmpiutil/trunk/src/lib/cmpiutil/linuxProcUtils.c sblim-cmpiutil/trunk/src/lib/cmpiutil/modifyFile.c sblim-cmpiutil/trunk/src/lib/cmpiutil/ntpServer.c sblim-cmpiutil/trunk/src/lib/cmpiutil/string.c Added: sblim-cmpi-base-plus/trunk/AUTHORS =================================================================== Added: sblim-cmpi-base-plus/trunk/COPYING =================================================================== Added: sblim-cmpi-base-plus/trunk/ChangeLog =================================================================== --- sblim-cmpi-base-plus/trunk/ChangeLog (rev 0) +++ sblim-cmpi-base-plus/trunk/ChangeLog 2008-05-20 17:16:23 UTC (rev 613) @@ -0,0 +1 @@ +Initial. Added: sblim-cmpi-base-plus/trunk/INSTALL =================================================================== --- sblim-cmpi-base-plus/trunk/INSTALL (rev 0) +++ sblim-cmpi-base-plus/trunk/INSTALL 2008-05-20 17:16:23 UTC (rev 613) @@ -0,0 +1,229 @@ +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the `--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + Added: sblim-cmpi-base-plus/trunk/LICENSE =================================================================== Added: sblim-cmpi-base-plus/trunk/Makefile.am =================================================================== --- sblim-cmpi-base-plus/trunk/Makefile.am (rev 0) +++ sblim-cmpi-base-plus/trunk/Makefile.am 2008-05-20 17:16:23 UTC (rev 613) @@ -0,0 +1,9 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = gnu + +SUBDIRS = \ + . \ + src \ + mof + Added: sblim-cmpi-base-plus/trunk/Makefile.incl.am =================================================================== --- sblim-cmpi-base-plus/trunk/Makefile.incl.am (rev 0) +++ sblim-cmpi-base-plus/trunk/Makefile.incl.am 2008-05-20 17:16:23 UTC (rev 613) @@ -0,0 +1,10 @@ +# *********************************************************************** +# MACROS and VARIABLES +# *********************************************************************** + +providerdir = $(libdir)/cmpi + +# *********************************************************************** +# TARGETS +# *********************************************************************** + Added: sblim-cmpi-base-plus/trunk/NEWS =================================================================== Added: sblim-cmpi-base-plus/trunk/README =================================================================== Added: sblim-cmpi-base-plus/trunk/bootstrap.sh =================================================================== --- sblim-cmpi-base-plus/trunk/bootstrap.sh (rev 0) +++ sblim-cmpi-base-plus/trunk/bootstrap.sh 2008-05-20 17:16:23 UTC (rev 613) @@ -0,0 +1,9 @@ +#!/bin/sh + +rm -rf config.cache config.guess config.sub depcomp missing mkinstalldirs autom4te.cache + +aclocal \ +&& autoconf \ +&& autoheader \ +&& libtoolize --force --copy \ +&& automake --add-missing Property changes on: sblim-cmpi-base-plus/trunk/bootstrap.sh ___________________________________________________________________ Name: svn:executable + * Added: sblim-cmpi-base-plus/trunk/config.h.in =================================================================== --- sblim-cmpi-base-plus/trunk/config.h.in (rev 0) +++ sblim-cmpi-base-plus/trunk/config.h.in 2008-05-20 17:16:23 UTC (rev 613) @@ -0,0 +1,286 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if the `closedir' function returns void instead of `int'. */ +#undef CLOSEDIR_VOID + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the `btowc' function. */ +#undef HAVE_BTOWC + +/* Define to 1 if your system has a working `chown' function. */ +#undef HAVE_CHOWN + +/* Define to 1 if you have the <cimple/cimple.h> header file. */ +#undef HAVE_CIMPLE_CIMPLE_H + +/* Define to 1 if you have the <cimple/OpenWBEM_Adapter.h> header file. */ +#undef HAVE_CIMPLE_OPENWBEM_ADAPTER_H + +/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. + */ +#undef HAVE_DECL_GETENV + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR_R + +/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if `lstat' has the bug that it succeeds when given the + zero-length file name argument. */ +#undef HAVE_LSTAT_EMPTY_STRING_BUG + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the `mbsrtowcs' function. */ +#undef HAVE_MBSRTOWCS + +/* Define to 1 if <wchar.h> declares mbstate_t. */ +#undef HAVE_MBSTATE_T + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mempcpy' function. */ +#undef HAVE_MEMPCPY + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#undef HAVE_REALLOC + +/* Define to 1 if you have the `regcomp' function. */ +#undef HAVE_REGCOMP + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +#undef HAVE_STAT_EMPTY_STRING_BUG + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the `strerror_r' function. */ +#undef HAVE_STRERROR_R + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strstr' function. */ +#undef HAVE_STRSTR + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if you have the `strtoul' function. */ +#undef HAVE_STRTOUL + +/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <sys/vfs.h> header file. */ +#undef HAVE_SYS_VFS_H + +/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the `uname' function. */ +#undef HAVE_UNAME + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the <vfork.h> header file. */ +#undef HAVE_VFORK_H + +/* Define to 1 if you have the <wchar.h> header file. */ +#undef HAVE_WCHAR_H + +/* Define to 1 if you have the <wctype.h> header file. */ +#undef HAVE_WCTYPE_H + +/* Define to 1 if you have the `wmempcpy' function. */ +#undef HAVE_WMEMPCPY + +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* "The namespace for INTEROP specific data" */ +#undef INTEROP_NAMESPACE + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#undef LSTAT_FOLLOWS_SLASHED_SYMLINK + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if the C compiler supports function prototypes. */ +#undef PROTOTYPES + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define to 1 if the `setvbuf' function takes the buffering type as its + second argument and the buffer pointer as the third, as on System V before + release 3. */ +#undef SETVBUF_REVERSED + +/* "Debugging flag." */ +#undef SMASH_DEBUG + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if strerror_r returns char *. */ +#undef STRERROR_R_CHAR_P + +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER + +/* Define like PROTOTYPES; this can be used by system headers. */ +#undef __PROTOTYPES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to rpl_fnmatch if the replacement function should be used. */ +#undef fnmatch + +/* Define to `int' if <sys/types.h> doesn't define. */ +#undef gid_t + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to a type if <wchar.h> does not define. */ +#undef mbstate_t + +/* Define to `int' if <sys/types.h> does not define. */ +#undef mode_t + +/* Define to `int' if <sys/types.h> does not define. */ +#undef pid_t + +/* Define to rpl_realloc if the replacement function should be used. */ +#undef realloc + +/* Define to `unsigned' if <sys/types.h> does not define. */ +#undef size_t + +/* Define to `int' if <sys/types.h> doesn't define. */ +#undef uid_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork Added: sblim-cmpi-base-plus/trunk/configure.ac =================================================================== --- sblim-cmpi-base-plus/trunk/configure.ac (rev 0) +++ sblim-cmpi-base-plus/trunk/configure.ac 2008-05-20 17:16:23 UTC (rev 613) @@ -0,0 +1,205 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.57) +AC_INIT(sblim-cmpi-base-plus, 1.0.0) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([src]) +AC_CONFIG_HEADER([config.h]) +AC_PROG_LIBTOOL + +AC_PREFIX_DEFAULT(/usr) + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_PROG_LEX +AC_PROG_YACC + +AC_PATH_PROG(RM, rm, rm) +AC_PATH_PROG(MV, mv, mv) +AC_PATH_PROG(CP, cp, cp) + +DEBUG_FLAGS="-DDEBUG -g" # Additional debugging flags. +FULL_DEBUG_FLAGS="-D_GLIBCXX_DEBUG" # Additional debugging flags. +OPT_FLAGS=" -DNDEBUG -O2" # Additional optimization flags. + + +##NOTE: whereever CXXFLAGS is used, we need to also use CPPFLAGS, for the AC_CHECK_HEADERS - +## It now uses compile (primarily) but still uses pre-processor for interim transition / backward compatibility +## pre-processor needs the CPPFLAGS + + +####################################################################### +# Process additional search dirs if specified +AC_ARG_WITH(search-dir, + [ --with-search-dir=PATH Specify an additional directory to look for include/ and lib/ sub dirs ], + [ + if test "x$withval" != "xno" ; then + CXXFLAGS="$CXXFLAGS -I$withval/include" + CPPFLAGS="$CPPFLAGS -I$withval/include" + CFLAGS="$CFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib" + fi + ] +) + +####################################################################### +# Process additional search dirs if specified +cmpiIncDir="" +AC_ARG_WITH(cmpi-include-dir, + [ --with-cmpi-include-dir=PATH Specify locaction of the CMPI header files ], + [ + if test "x$withval" != "xno" ; then + CXXFLAGS="$CXXFLAGS -I$withval" + CPPFLAGS="$CPPFLAGS -I$withval" + CFLAGS="$CFLAGS -I$withval" + cmpiIncDir="$withval" + fi + ] +) + +if test "x$cmpiIncDir" == "x"; then + cmpiIncDir="/usr/include/cmpi" + CXXFLAGS="$CXXFLAGS -I$cmpiIncDir" + CPPFLAGS="$CPPFLAGS -I$cmpiIncDir" + CFLAGS="$CFLAGS -I$cmpiIncDir" + AC_MSG_WARN("You didn't specify the location of the cmpi include files. Using default of /usr/include/cmpi") +fi + + +####################################################################### +interop_namespace="root/interop" +AC_ARG_WITH(interop-namespace, + [ --with-interop-namespace=NS Specifiy the namespace for INTEROP specific data. default = root/interop ], + [ + if test "x$withval" != "xno" ; then + interop_namespace="$withval" + fi + ] +) + +AC_DEFINE_UNQUOTED(INTEROP_NAMESPACE, "${interop_namespace}", "The namespace for INTEROP specific data") + +debuglevel="0" +####################################################################### +# Set the debug flag if specified +AC_ARG_ENABLE(debug-mode, + [--enable-debug-mode Enable debugging mode], + [ + debuglevel="1" + ] +) + +AC_ARG_WITH(debug-level, + [ --with-debug-level=LEVEL Specify a debug level valid values: 0=none 1=partial debug 2=full debug ], + [ + case "x$withval" in + x0|xno) + debuglevel="0";; + x1) + debuglevel="1";; + x2) + debuglevel="2";; + *) + AC_MSG_WARN("Invalid debug level specified. Valid values are 0, 1 or 2") + exit 1;; + esac + ] +) + +case $debuglevel in +1) + AC_DEFINE(SMASH_DEBUG, 1, "Debugging flag.") + CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS -Wall" + CPPFLAGS="$CPPFLAGS $DEBUG_FLAGS -Wall" + CFLAGS=" $CFLAGS $DEBUG_FLAGS -Wall" + LDFLAGS=" $LDFLAGS $DEBUG_FLAGS";; +2) + AC_DEFINE(SMASH_DEBUG, 2, "Debugging flag.") + CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS $FULL_DEBUG_FLAGS -Wall" + CPPFLAGS="$CPPFLAGS $DEBUG_FLAGS $FULL_DEBUG_FLAGS -Wall" + CFLAGS=" $CFLAGS $DEBUG_FLAGS $FULL_DEBUG_FLAGS -Wall" + LDFLAGS=" $LDFLAGS $DEBUG_FLAGS $FULL_DEBUG_FLAGS";; +*) + CXXFLAGS="$CXXFLAGS $OPT_FLAGS -Wall" + CPPFLAGS="$CPPFLAGS $OPT_FLAGS -Wall" + CFLAGS=" $CFLAGS $OPT_FLAGS -Wall" + LDFLAGS=" $LDFLAGS $OPT_FLAGS";; +esac + +##################################################### + +# Checks for libraries. +#AC_CHECK_LIB([owclient], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([owcppprovifc], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([owdb], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([owhttpclient], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([owhttpcommon], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([owhttpxmllistener], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([owprovider], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([owrepositoryhdb], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([owserver], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([owservicehttp], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([owwql], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([owwqlcommon], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([owxml], [main],[LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([pthread], [main], [LIBS="$LIBS"],[AC_MSG_ERROR(Must have openwbem-devel or build will fail)]) +#AC_CHECK_LIB([crypto], [main], [LIBS="$LIBS"], [AC_MSG_ERROR(Must have libcrypto \(openssl-devel\) or build will fail)]) + +# Checks for two basic and common openwbem libraries + +# Checks for header files. +AC_HEADER_DIRENT +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h sys/time.h sys/param.h sys/vfs.h],,[AC_MSG_ERROR(Missing headers: likely won't compile)]) + +AC_LANG_CPLUSPLUS +AC_CHECK_HEADERS([cimple/cimple.h],[HAVE_CIMPLE="1"],[HAVE_CIMPLE="0"]) +AM_CONDITIONAL(DO_CIMPLE_PROVIDERS, test "$HAVE_CIMPLE" = 1) + +AC_CHECK_HEADERS([cimple/OpenWBEM_Adapter.h],[HAVE_CIMPLE_OW_ADAPTER="1"],[HAVE_CIMPLE_OW_ADAPTER="0"]) +AM_CONDITIONAL(USE_CIMPLE_OW_ADAPTER, test "$HAVE_CIMPLE_OW_ADAPTER" = 1) +AC_LANG_C + + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_TYPE_PID_T +AC_TYPE_UID_T +AC_HEADER_TIME +AC_TYPE_MODE_T +AC_TYPE_SIGNAL +AC_TYPE_SIZE_T + +# Checks for library functions. +AC_FUNC_CLOSEDIR_VOID +AC_REPLACE_FNMATCH +AC_FUNC_FORK +AC_FUNC_LSTAT +AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +AC_FUNC_MALLOC +AC_FUNC_REALLOC +AC_FUNC_CHOWN +AC_FUNC_SETVBUF_REVERSED +AC_FUNC_STAT +AC_FUNC_STRERROR_R + +AC_CHECK_FUNCS([gettimeofday memset regcomp strchr strdup strerror strstr strtol strtoul uname]) + +AC_CONFIG_FILES([Makefile + src/Makefile + src/providers/Makefile + src/providers/operating-system/Makefile + src/providers/time-service/Makefile + mof/Makefile + src/providers/logical-file/Makefile + src/providers/logical-file/schema/Makefile + ]) +AC_OUTPUT Added: sblim-cmpi-base-plus/trunk/install-sh =================================================================== --- sblim-cmpi-base-plus/trunk/install-sh (rev 0) +++ sblim-cmpi-base-plus/trunk/install-sh 2008-05-20 17:16:23 UTC (rev 613) @@ -0,0 +1,294 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd=$cpprog + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "$0: no input file specified" >&2 + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d "$dst" ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" ] || [ -d "$src" ] + then + : + else + echo "$0: $src does not exist" >&2 + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "$0: no destination specified" >&2 + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d "$dst" ] + then + dst=$dst/`basename "$src"` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-$defaultIFS}" + +oIFS=$IFS +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS=$oIFS + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp=$pathcomp$1 + shift + + if [ ! -d "$pathcomp" ] ; + then + $mkdirprog "$pathcomp" + else + : + fi + + pathcomp=$pathcomp/ +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd "$dst" && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename "$dst"` + else + : + fi + +# Make a couple of temp file names in the proper directory. + + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + +# Trap to clean up temp files at exit. + + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 + +# Move or copy the file name to the temp name + + $doit $instcmd "$src" "$dsttmp" && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && + +# Now remove or move aside any old file at destination location. We try this +# two ways since rm can't unlink itself on some systems and the destination +# file might be busy for other reasons. In this case, the final cleanup +# might fail but the new file should still install successfully. + +{ + if [ -f "$dstdir/$dstfile" ] + then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || + $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || + { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi +} && + +# Now rename the file to the real destination. + + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + +fi && + +# The final little trick to "correctly" pass the exit status to the exit trap. + +{ + (exit 0); exit +} Added: sblim-cmpi-base-plus/trunk/mof/Linux_BasePlus.registration =================================================================== --- sblim-cmpi-base-plus/trunk/mof/Linux_BasePlus.registration (rev 0) +++ sblim-cmpi-base-plus/trunk/mof/Linux_BasePlus.registration 2008-05-20 17:16:23 UTC (rev 613) @@ -0,0 +1,9 @@ +# Classname Namespace ProviderName ProviderModule ProviderTypes ... +Linux_InstalledOS root/cimv2 Linux_InstalledLinuxOS cmpi_InstalledLinuxOS instance association +Linux_RemoteTimeServicePort root/cimv2 Linux_RemoteTimeServicePort_Provider cmpi_remoteTimeServicePort instance +Linux_TimeServiceAccessBySAP root/cimv2 Linux_TimeServiceAccessBySAP_Provider cmpi_timeServiceAccessBySAP instance association +Linux_TimeZoneSettingData root/cimv2 Linux_TimeZoneSettingData_Provider cmpi_timeZoneSettingData instance +Linux_TimeServiceTimeZoneSettingData root/cimv2 Linux_TimeServiceTimeZoneSettingData_Provider cmpi_timeServiceTimeZoneSettingData instance association +Linux_SystemTimeService root/cimv2 Linux_SystemTimeService_Provider cmpi_systemTimeService instance +Linux_HostedTimeService root/cimv2 Linux_HostedTimeService_Provider cmpi_hostedTimeService instance association +Linux_TimeServiceAvailableToElement root/cimv2 Linux_TimeServiceAvailableToElement_Provider cmpi_timeServiceAvailableToElement instance association Added: sblim-cmpi-base-plus/trunk/mof/Makefile.am =================================================================== --- sblim-cmpi-base-plus/trunk/mof/Makefile.am (rev 0) +++ sblim-cmpi-base-plus/trunk/mof/Makefile.am 2008-05-20 17:16:23 UTC (rev 613) @@ -0,0 +1,7 @@ +EXTRA_DIST = \ + Linux_BasePlus.registration \ + linux-file-system-elements.mof \ + linux-initd.mof \ + linux-installed-os.mof \ + linux-logical-file.mof \ + linux-time-service.mof Added: sblim-cmpi-base-plus/trunk/mof/linux-file-system-elements.mof =================================================================== --- sblim-cmpi-base-plus/trunk/mof/linux-file-system-elements.mof (rev 0) +++ sblim-cmpi-base-plus/trunk/mof/linux-file-system-elements.mof 2008-05-20 17:16:23 UTC (rev 613) @@ -0,0 +1,114 @@ +#pragma locale ("en_US") + +[ + Abstract, + Description ("Base class for Linux local filesystem instrumentation") +] +class Linux_UnixLocalFileSystem : CIM_UnixLocalFileSystem +{ + uint8 PercentageSpaceUse; +}; + + +[ + Description ("The Linux local filesystem of type ext2.") +] +class Linux_LinuxExt2FileSystem : Linux_UnixLocalFileSystem +{ +}; + + +[ + Description ("The Linux local filesystem of type ext3.") +] +class Linux_LinuxExt3FileSystem : Linux_UnixLocalFileSystem +{ +}; + + +[ + Description ("The Linux local filesystem of type reiser.") +] +class Linux_LinuxReiserFileSystem : Linux_UnixLocalFileSystem +{ + sint32 extend([IN(true), OUT(false)] uint64 size); + sint32 reduce([IN(true), OUT(false)] uint64 size); +}; + + +[ + Abstract, + Description ("Base class for Linux NFS filesystems") +] +class Linux_NFS : CIM_NFS +{ + uint8 PercentageSpaceUse; +}; + +[ + Description ("The Linux nfs mounted filesystem(s).") +] +class Linux_LinuxNFS : Linux_NFS +{ +}; + + +[ Association, Abstract, Description ( + "An association between a FileSystem and a Directory " + "which indicates that the Directory is being attached to " + "the FileSystem. The semantics of this relationship require " + "that the mounted Directory be contained by a FileSystem " + "(via the FileStorage association) that is different from " + "the FileSystem referenced as the Dependent. The " + "Directory's containing FileSystem could be either " + "local or remote. For example, a LocalFileSystem on a Solaris " + "ComputerSystem can mount a Directory from the FileSystem " + "accessed via the machine's CDROM drive, i.e., another LocalFile" + "System. On the other hand, in a 'remote' case, the Directory " + "is first exported by its FileSystem, which is hosted on another " + "ComputerSystem acting (for example) as a file server. In order " + "to distinguish these two types of Mount, it is recommended that " + "a CIM_Export association always be defined for the remotely " + "accessed/mounted Directories.") ] +class Linux_Mount : CIM_Mount { + + [Override ("Antecedent"), Max (1), + Description ("The Directory mounted.") ] + Linux_UnixDirectory REF Antecedent; + + [Override ("Dependent"), + Description ("The FileSystem the Directory is mounted on.") ] + CIM_FileSystem REF Dependent; +}; + + +[Association, + Description( + "An association between a FileSystem and a Directory " + "which indicates that the Directory is being attached to " + "the FileSystem. The semantics of this relationship require " + "that the mounted Directory be contained by a FileSystem " + "(via the FileStorage association) that is different from " + "the FileSystem referenced as the Dependent. The " + "Directory's containing FileSystem could be either " + "local or remote. For example, a LocalFileSystem on a Solaris " + "ComputerSystem can mount a Directory from the FileSystem " + "accessed via the machine's CDROM drive, i.e., another LocalFile" + "System. On the other hand, in a 'remote' case, the Directory " + "is first exported by its FileSystem, which is hosted on another " + "ComputerSystem acting (for example) as a file server. In order " + "to distinguish these two types of Mount, it is recommended that " + "a CIM_Export association always be defined for the remotely " + "accessed/mounted Directories.") ] +class Linux_LinuxMount : Linux_Mount { + + [Override ("Antecedent"), Max (1), + Description ("The Directory mounted.") ] + Linux_LinuxDirectory REF Antecedent; + + [Override ("Dependent"), + Description ("The FileSystem the Directory is mounted on.") ] + CIM_FileSystem REF Dependent; +}; + + Added: sblim-cmpi-base-plus/trunk/mof/linux-initd.mof =================================================================== --- sblim-cmpi-base-plus/trunk/mof/linux-initd.mof (rev 0) +++ sblim-cmpi-base-plus/trunk/mof/linux-initd.mof 2008-05-20 17:16:23 UTC (rev 613) @@ -0,0 +1,190 @@ +#pragma locale ("en_US") + +[ Description ( +"Linux_InitdService represents the function of a system init script " +"found in the /etc/init.d directory. The Name field in this class will " +"be the name of the script. The provider of this class knows nothing " +"about the details of the service itself. The methods of this class " +"all correspond to actions that can be taken on init.d scripts conforming " +"to the LSB spec on system initialization. See " +"http://refspecs.freestandards.org/LSB_2.0.1/LSB-Core/LSB-Core/sysinit.html " +"for more information.") ] +class Linux_InitdService : CIM_EnabledLogicalElement +{ + [Key, Propagated ( "Linux_ComputerSystem.CreationClassName" ), + Description ("The CreationClassName of the scoping System.")] + string SystemCreationClassName; + + [Key, Propagated ( "Linux_ComputerSystem.Name" ), + Description ("The Name of the scoping System.")] + string SystemName; + + [Key, Override ( "Name" ), + Description("This is the name of the script found in the init.d dir")] + string Name; + + [ Description ("This method starts the service. " + "Return values are what is returned by the service script, and should follow the LSB spec. " + "See ValueMap."), + Override("StartService"), + ValueMap {"0", "1", "2", "3", "4", "5", "6", "7"}, + Values {"Success", "Generic Error", "Invalid Arguments", "Unimplemented Feature", "Insufficient Privilege", "Program Not Installed", "Program Not Configured", "Program Not Running"}] + uint32 StartService (); + + [ Description ("This method stops the service. " + "Return values are what is returned by the service script, and should follow the LSB spec. " + "See ValueMap."), + Override("StopService"), + ValueMap {"0", "1", "2", "3", "4", "5", "6", "7"}, + Values {"Success", "Generic Error", "Invalid Arguments", "Unimplemented Feature", "Insufficient Privilege", "Program Not Installed", "Program Not Configured", "Program Not Running"}] + uint32 StopService (); + + + [ Description ("This method causes the configuration of the service to be reloaded without actually " + "stopping and restarting the service. This is an optional method in init scripts per LSB spec. " + "Return values are what is returned by the service script, and should follow the LSB spec. " + "See ValueMap."), + Override("ReloadService"), + ValueMap {"0", "1", "2", "3", "4", "5", "6", "7"}, + Values {"Success", "Generic Error", "Invalid Arguments", "Unimplemented Feature", "Insufficient Privilege", "Program Not Installed", "Program Not Configured", "Program Not Running"}] + uint32 ReloadService (); + + [ Description ("This method stops and restarts the service if the service is already running, " + "otherwise starts the service. " + "Return values are what is returned by the service script, and should follow the LSB spec. " + "See ValueMap."), + ValueMap {"0", "1", "2", "3", "4", "5", "6", "7"}, + Values {"Success", "Generic Error", "Invalid Arguments", "Unimplemented Feature", "Insufficient Privilege", "Program Not Installed", "Program Not Configured", "Program Not Running"}] + uint32 RestartService (); + + [ Description ("This method causes the configuration to be reloaded if the service supports this, " + "otherwise restart the service if it is running" + "Return values are what is returned by the service script, and should follow the LSB spec. " + "See ValueMap."), + ValueMap {"0", "1", "2", "3", "4", "5", "6", "7"}, + Values {"Success", "Generic Error", "Invalid Arguments", "Unimplemented Feature", "Insufficient Privilege", "Program Not Installed", "Program Not Configured", "Program Not Running"}] + uint32 ForceReloadService (); + + [ Description ("This method restarts the service if the service is already running. " + "This is an optional method in init scripts per LSB spec. " + "Return values are what is returned by the service script, and should follow the LSB spec. " + "See ValueMap."), + ValueMap {"0", "1", "2", "3", "4", "5", "6", "7"}, + Values {"Success", "Generic Error", "Invalid Arguments", "Unimplemented Feature", "Insufficient Privilege", "Program Not Installed", "Program Not Configured", "Program Not Running"}] + uint32 TryRestartService (); + + [ Description ("This method returns the status of the service. The integer returned is what the script " + "returns as its exit value. See LSB spec on init scripts. " + "Also see ValueMap."), + ValueMap {"0", "1", "2", "3", "4"}, + Values {"Service Running", "Service Dead - pid file exists", "Service Dead - lock file exists", "Service Not Running", "Unknown"}] + uint32 ServiceStatus (); + + [ Description ("This method configures the service's script to be installed or enabled in the system's " + "boot (init) script process. The service must already exist on the system and the " + "service's script must already exist on the system (usually in the init.d dir). " + "This method adds the service to the runlevels the script is assigned to. See LSB " + "spec on installing init scripts. "), + ValueMap {"0", "1"}, + Values {"Success", "Failure"}] + uint32 EnableService (); + + [ Description ("This method configures the service's script to be removed or disabled in the system's " + "boot (init) script process. The service's script is not removed from the system (init.d dir), " + "nor is the service removed from the system. This method removes the service from all runlevels " + "it is currently assigned to. See LSB spec on installing/removing init scripts. "), + ValueMap {"0", "1"}, + Values {"Success", "Failure"}] + uint32 DisableService (); + +}; + + +[ Description("Linux_Runlevel represents a runlevel on a system, which is a collection of " + "init scripts, in this case, a collection of Linux_InitdService objects")] +class Linux_Runlevel : CIM_CollectionOfMSEs +{ + [ Key, Propagated("Linux_ComputerSystem.CreationClassName") ] + string SystemCreationClassName; + + [ Key, Propagated("Linux_ComputerSystem.Name") ] + string SystemName; + + [ Description("The runlevel of this instance. This is typically a one-character identifier such as " + "... [truncated message content] |
From: <jc...@us...> - 2008-05-15 00:08:32
|
Revision: 612 http://omc.svn.sourceforge.net/omc/?rev=612&view=rev Author: jcarey Date: 2008-05-14 17:08:38 -0700 (Wed, 14 May 2008) Log Message: ----------- removed some unnecessary Nic command line Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-15 00:05:21 UTC (rev 611) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-15 00:08:38 UTC (rev 612) @@ -766,11 +766,7 @@ const char* pd = (char*) CMGetCharPtr(ndata.value.string); if (pd) { omcStrArray_append(pstra, "--nic"); - if (strcasecmp(pd, "default")) { - omcStrArray_append(pstra, pd); - } else { - omcStrArray_append(pstra, "''"); - } + omcStrArray_append(pstra, pd); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-15 00:05:15
|
Revision: 611 http://omc.svn.sourceforge.net/omc/?rev=611&view=rev Author: jcarey Date: 2008-05-14 17:05:21 -0700 (Wed, 14 May 2008) Log Message: ----------- Some cleanup/bug fix. more trace Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-14 21:27:14 UTC (rev 610) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-15 00:05:21 UTC (rev 611) @@ -37,9 +37,10 @@ #include <stdlib.h> #include <limits.h> #include <errno.h> +#include <sys/types.h> +#include <sys/wait.h> //#include <pwd.h> -//#include <sys/types.h> //#include <time.h> //#include <signal.h> #include <cmpidt.h> @@ -633,7 +634,7 @@ char wkbfr[256]; char rspbfr[PATH_MAX]; char *response_file = NULL; - int cc; + int cc, i; size_t output_size; char* output; CMPIObjectPath *jobref = NULL; @@ -763,9 +764,13 @@ CMPIData ndata = CMGetArrayElementAt(data.value.array, i, pstatus); if (!CMIsNullValue(ndata)) { const char* pd = (char*) CMGetCharPtr(ndata.value.string); - if (pd && strlen(pd)) { + if (pd) { omcStrArray_append(pstra, "--nic"); - omcStrArray_append(pstra, pd); + if (strcasecmp(pd, "default")) { + omcStrArray_append(pstra, pd); + } else { + omcStrArray_append(pstra, "''"); + } } } } @@ -821,21 +826,39 @@ } /* Execute vm-install with the constructed command line */ +#ifdef XEN_VMBUILDER_DEBUG + printf("Executing:\n"); + for(i = 0; pstra->strs[i]; i++) { + printf("%s ", pstra->strs[i]); + } + printf("\n"); +#endif + output = NULL; + DEBUGOUT("Calling vm-install...\n"); if (omcExecuteProcessAndGatherOutputAndError((char* const*) pstra->strs, NULL, &output, &output_size, -1, NULL, NULL, -1, NULL, &cc, -1) == 0) { + DEBUGOUT("vm-install returned 0\n"); if (cc == 0 && output) { + DEBUGOUT("vm-install status is 0\n"); jobref = CMNewObjectPath(_broker, ns, "XEN_VMBUilderJob", pstatus); CMAddKey(jobref, "Name", (CMPIValue*)output, CMPI_chars); prv->uint32 = 0; } else { - prv->uint32 = (CMPIUint32)cc; + prv->uint32 = (CMPIUint32)WEXITSTATUS(cc); + DEBUGOUT("vm-install failed status: %u\n", prv->uint32); +#ifdef XEN_VMBUILDER_DEBUG + if(output) { + printf("vm-install output: %s\n", output); + } +#endif } } else { strerror_r(errno, wkbfr, sizeof(wkbfr)); snprintf(rspbfr, sizeof(rspbfr), "Failed to execute vm-install: %s\n", wkbfr); + DEBUGOUT("%s\n", rspbfr); prv->uint32 = 1; OMC_SETSTATUS(_broker, pstatus, CMPI_RC_ERR_FAILED, rspbfr); } @@ -844,8 +867,11 @@ free(output); } omcStrArray_destroy(pstra); + DEBUGOUT("checking for existence response file\n"); if (response_file) { + DEBUGOUT("Should have response file %s\n", response_file); if (jobref) { + DEBUGOUT("There is a job reference, so waiting for right state\n"); /* * Wait until Job state reaches the 'INSTALL' and then delete * the response file. @@ -853,28 +879,36 @@ CMPIInstance *jobci; CMPIStatus lstatus; int fail_count = 0; - while(fail_count < 5) { + DEBUGOUT("Entering GetInstance loop for Job instance...\n"); + while(fail_count < 10) { omcMilliSleep(500); - sleep(1); jobci = CBGetInstance(_broker, context, jobref, NULL, &lstatus); if (jobci == NULL) { + DEBUGOUT("GetInstance for Job returned NULL. " + "Inc fail count\n"); fail_count++; continue; } data = CMGetProperty(jobci, "JobStatus", NULL); if (!CMIsNullValue(data)) { const char *p = CMGetCharPtr(data.value.string); - if (strcasecmp(p, "SETTINGS") == 0 - || strcasecmp(p, "PREP_INSTALL")) { + if (strcasecmp(p, "SETTINGS") + && strcasecmp(p, "PREP_INSTALL")) { + DEBUGOUT("Still to soon to delete Response file\n"); continue; } + DEBUGOUT("Install state allows for response file " + "delete\n"); break; } else { + DEBUGOUT("Job instance has NULL JobStatus property. " + "Inc Fail count\n"); fail_count++; } } } + DEBUGOUT("Deleting response file: %s\n", response_file); unlink(response_file); } DEBUGOUT("start_create_vm() returning\n"); @@ -959,13 +993,14 @@ jobref = start_create_vm(context, vmname, cdci, uuid, ns, &rv, &status); - if (!jobref) { - DEBUGOUT("start_create_vm returned a NULL ref. status: %d\n", status.rc); - return status; + if (jobref) { + DEBUGOUT("start_create_vm returned a valid ref. " + "rv.uint32: %u status: %d\n", rv.uint32, status.rc); + CMAddArg(out, "VMBuilderJob", (CMPIValue*)&jobref, CMPI_ref); + } else { + DEBUGOUT("start_create_vm returned a NULL ref. " + "rv.uint32: %u status: %d\n", rv.uint32, status.rc); } - DEBUGOUT("start_create_vm returned a valid ref. " - "rv.uint32: %u status: %d\n", rv.uint32, status.rc); - CMAddArg(out, "VMBuilderJob", (CMPIValue*)&jobref, CMPI_ref); CMReturnData(results, &rv, CMPI_uint32); CMReturnDone(results); } else if (strcasecmp("RequestStateChange", methodName) == 0) { Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c 2008-05-14 21:27:14 UTC (rev 610) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/vmcreation-data.c 2008-05-15 00:05:21 UTC (rev 611) @@ -1099,11 +1099,11 @@ omcStrBuf_destroy(pstrbuf); return status; } + add_u32_prop_to_query(pstrbuf, newinstance, "GraphicsViewerType", &data); if (valid_graphics_viewer_type(&data, &status) != CMPI_RC_OK) { omcStrBuf_destroy(pstrbuf); return status; } - add_u32_prop_to_query(pstrbuf, newinstance, "GraphicsViewerType", &data); add_str_prop_to_query(pstrbuf, newinstance, "LogDataRoot", 0); add_u32_prop_to_query(pstrbuf, newinstance, "MaxMemory", NULL); add_u32_prop_to_query(pstrbuf, newinstance, "Memory", NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-14 21:27:10
|
Revision: 610 http://omc.svn.sourceforge.net/omc/?rev=610&view=rev Author: jcarey Date: 2008-05-14 14:27:14 -0700 (Wed, 14 May 2008) Log Message: ----------- Got CreateVM working Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-14 16:12:20 UTC (rev 609) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-05-14 21:27:14 UTC (rev 610) @@ -325,19 +325,84 @@ const CMPIObjectPath* cop, const char** properties) { - //CMPIInstance* instance; + CMPIInstance* instance; //CMPIObjectPath *objectpath; CMPIStatus status = {CMPI_RC_OK, NULL}; - //char *ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); + char *ns = (char*) CMGetCharPtr(CMGetNameSpace(cop, NULL)); const char *className; + CMPIData key; + int found = 0; + char** names = NULL; DEBUGOUT("GetInstance() called\n"); className = CMGetCharPtr(CMGetClassName(cop, NULL)); if (strcasecmp(className, "XEN_VMBuilderJob") == 0) { - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, - "Instance does not exists"); + const char* job_name_key; + key = CMGetKey(cop, "Name", &status); + if (status.rc != CMPI_RC_OK || CMIsNullValue(key)) { + DEBUGOUT("GetInstance(): CMGetKey(\"Name\") failed - %d\n", status.rc); + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + "Cannot get 'Name' property"); + return status; + } + + job_name_key = CMGetCharPtr(key.value.string); + if (!job_name_key || !strlen(job_name_key)) { + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, "Empty Name property"); + return status; + } + + names = get_job_names(); + if (names) { + VMInstallInfo info; + const char* p; + int i; + for(i = 0; names[i]; i++) { + if (!strcasecmp(names[i], job_name_key)) { + if(get_job_info(names[i], &info) == 0) { + instance = omccmpiNewInstance(_broker, ns, "XEN_VMBuilderJob", + job_class_keys, properties, &status); + if (status.rc != CMPI_RC_OK || CMIsNullObject(instance)) { + DEBUGOUT("EnumInstances(): CMNewInstance() failed - %d\n", + status.rc); + free(names); + return status; + } + CMSetProperty(instance, "Name", (CMPIValue*)names[i], + CMPI_chars); + CMSetProperty(instance, "VMName", (CMPIValue*)info.name, + CMPI_chars); + CMSetProperty(instance, "VncURL", (CMPIValue*)info.vnc, + CMPI_chars); + CMSetProperty(instance, "VM_UUID", (CMPIValue*)info.uuid, + CMPI_chars); + CMSetProperty(instance, "ExitCode", + (CMPIValue*)&info.exit_code, CMPI_uint32); + CMSetProperty(instance, "InstallLogFileLocation", + (CMPIValue*)info.log, CMPI_chars); + p = (info.state > 8) ? "UNKNOWN" : job_states[info.state]; + CMSetProperty(instance, "JobStatus", (CMPIValue*)p, + CMPI_chars); + CMSetProperty(instance, "StatusFileName", (CMPIValue*)info.inotify, + CMPI_chars); + CMReturnInstance(results, instance); + found = 1; + break; + } else { + OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_NOT_FOUND, + "Unable to get job info for job"); + free(names); + return status; + } + } + } + free(names); + } + if (!found) { + CMSetStatus(&status, CMPI_RC_ERR_NOT_FOUND); + } } DEBUGOUT("Leaving GetInstance(): %s\n", (status.rc == CMPI_RC_OK)? "succeeded":"failed"); return status; Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-14 16:12:20 UTC (rev 609) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-14 21:27:14 UTC (rev 610) @@ -617,8 +617,13 @@ /*****************************************************************************/ static CMPIObjectPath* -start_create_vm(const char* vmname, const CMPIInstance* cdci, - const char* uuid, const char* ns, CMPIValue *prv, +start_create_vm( + const CMPIContext* context, + const char* vmname, + const CMPIInstance* cdci, + const char* uuid, + const char* ns, + CMPIValue *prv, CMPIStatus *pstatus) { CMPIData data; @@ -840,9 +845,38 @@ } omcStrArray_destroy(pstra); if (response_file) { + if (jobref) { + /* + * Wait until Job state reaches the 'INSTALL' and then delete + * the response file. + */ + CMPIInstance *jobci; + CMPIStatus lstatus; + int fail_count = 0; + while(fail_count < 5) { + omcMilliSleep(500); + sleep(1); + jobci = CBGetInstance(_broker, context, jobref, NULL, + &lstatus); + if (jobci == NULL) { + fail_count++; + continue; + } + data = CMGetProperty(jobci, "JobStatus", NULL); + if (!CMIsNullValue(data)) { + const char *p = CMGetCharPtr(data.value.string); + if (strcasecmp(p, "SETTINGS") == 0 + || strcasecmp(p, "PREP_INSTALL")) { + continue; + } + break; + } else { + fail_count++; + } + } + } unlink(response_file); } - DEBUGOUT("start_create_vm() returning\n"); return jobref; } @@ -923,7 +957,8 @@ DEBUGOUT("InvokeMethod(): UUID specified: %s\n", uuid); } - jobref = start_create_vm(vmname, cdci, uuid, ns, &rv, &status); + jobref = start_create_vm(context, vmname, cdci, uuid, ns, &rv, + &status); if (!jobref) { DEBUGOUT("start_create_vm returned a NULL ref. status: %d\n", status.rc); return status; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-14 16:13:10
|
Revision: 609 http://omc.svn.sourceforge.net/omc/?rev=609&view=rev Author: jcarey Date: 2008-05-14 09:12:20 -0700 (Wed, 14 May 2008) Log Message: ----------- Implemented CreateVM Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-13 23:52:28 UTC (rev 608) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-14 16:12:20 UTC (rev 609) @@ -35,12 +35,12 @@ #include <unistd.h> #include <stdio.h> #include <stdlib.h> +#include <limits.h> +#include <errno.h> //#include <pwd.h> //#include <sys/types.h> //#include <time.h> -#include <limits.h> -//#include <errno.h> //#include <signal.h> #include <cmpidt.h> #include <cmpift.h> @@ -623,16 +623,17 @@ { CMPIData data; omcStrArray *pstra; - const char* iid = NULL; + const char *iid = NULL; const char *os_type; char wkbfr[256]; char rspbfr[PATH_MAX]; char *response_file = NULL; - + int cc; + size_t output_size; + char* output; CMPIObjectPath *jobref = NULL; DEBUGOUT("start_create_vm() called...\n"); - data = CMGetProperty(cdci, "InstanceID", NULL); if (!CMIsNullValue(data)) { iid = CMGetCharPtr(data.value.string); @@ -642,7 +643,6 @@ "'InstanceID' is not set on instance"); return NULL; } - /**** OSType ****/ data = CMGetProperty(cdci, "OSType", NULL); if (!CMIsNullValue(data)) { @@ -655,7 +655,6 @@ } else { os_type = "other"; } - pstra = omcStrArray_create(); if (!pstra) { OMC_SETSTATUS(_broker, pstatus, CMPI_RC_ERROR_SYSTEM, @@ -672,7 +671,6 @@ omcStrArray_append(pstra, "--uuid"); omcStrArray_append(pstra, uuid); } - /**** NumVCPUs ****/ data = CMGetProperty(cdci, "NumVCPUs", NULL); if (!CMIsNullValue(data)) { @@ -688,9 +686,9 @@ size_t i, size = CMGetArrayCount(data.value.array, pstatus); if (size) { for (i = 0; i < size; i++) { - data = CMGetArrayElementAt(data.value.array, i, pstatus); - if (!CMIsNullValue(data)) { - const char* pd = (char*) CMGetCharPtr(data.value.string); + CMPIData ddata = CMGetArrayElementAt(data.value.array, i, pstatus); + if (!CMIsNullValue(ddata)) { + const char* pd = (char*) CMGetCharPtr(ddata.value.string); if (pd && strlen(pd)) { omcStrArray_append(pstra, "-d"); omcStrArray_append(pstra, pd); @@ -751,16 +749,15 @@ omcStrArray_append(pstra, wkbfr); } } - /**** Nics ****/ data = CMGetProperty(cdci, "Nics", NULL); if (!CMIsNullValue(data)) { size_t i, size = CMGetArrayCount(data.value.array, pstatus); if (size) { for (i = 0; i < size; i++) { - data = CMGetArrayElementAt(data.value.array, i, pstatus); - if (!CMIsNullValue(data)) { - const char* pd = (char*) CMGetCharPtr(data.value.string); + CMPIData ndata = CMGetArrayElementAt(data.value.array, i, pstatus); + if (!CMIsNullValue(ndata)) { + const char* pd = (char*) CMGetCharPtr(ndata.value.string); if (pd && strlen(pd)) { omcStrArray_append(pstra, "--nic"); omcStrArray_append(pstra, pd); @@ -803,7 +800,6 @@ omcStrArray_append(pstra, xa); } } - /**** ResponseFile ****/ data = CMGetProperty(cdci, "ResponseFile", NULL); if (!CMIsNullValue(data)) { @@ -819,19 +815,34 @@ } } - // TODO Execute process and gather output - + /* Execute vm-install with the constructed command line */ + output = NULL; + if (omcExecuteProcessAndGatherOutputAndError((char* const*) pstra->strs, + NULL, &output, &output_size, -1, NULL, NULL, -1, + NULL, &cc, -1) == 0) { + if (cc == 0 && output) { + jobref = CMNewObjectPath(_broker, ns, "XEN_VMBUilderJob", pstatus); + CMAddKey(jobref, "Name", (CMPIValue*)output, CMPI_chars); + prv->uint32 = 0; + } else { + prv->uint32 = (CMPIUint32)cc; + } + } else { + strerror_r(errno, wkbfr, sizeof(wkbfr)); + snprintf(rspbfr, sizeof(rspbfr), + "Failed to execute vm-install: %s\n", wkbfr); + prv->uint32 = 1; + OMC_SETSTATUS(_broker, pstatus, CMPI_RC_ERR_FAILED, rspbfr); + } + + if (output) { + free(output); + } omcStrArray_destroy(pstra); if (response_file) { unlink(response_file); } - // TEST - jobref = CMNewObjectPath(_broker, ns, - "XEN_VMBUilderJob", pstatus); - CMAddKey(jobref, "Name", (CMPIValue*)"Bogus", CMPI_chars); - prv->uint32 = 0; - DEBUGOUT("start_create_vm() returning\n"); return jobref; } @@ -865,22 +876,16 @@ DEBUGOUT("InvokeMethod() called. methodName: %s\n", methodName); class = CMGetClassName(cop, &status); -printf("class name: %s\n", CMGetCharPtr(class)); if (strcasecmp(CMGetCharPtr(class), "XEN_VMBuilderService") == 0) { -printf("class name is XEN_VMBuilderService\n"); if (strcasecmp("CreateVM", methodName) == 0) { CMPIObjectPath *jobref; CMPIInstance* cdci; const char *vmname = NULL; const char *uuid = NULL; -printf("In CreateVM method block\n"); -printf("Getting VMName arg\n"); - param = CMGetArg(in, "VMName", &status); if (!CMIsNullValue(param)) { vmname = CMGetCharPtr(param.value.string); -printf("VMName arg: %s\n", vmname); } if (!vmname || !strlen(vmname)) { rv.uint32 = 80; // Param is invalid/missing @@ -889,7 +894,6 @@ "'VMName' is a required parameter"); return status; } -printf("Getting NewSystemCreationData arg\n"); param = CMGetArg(in, "NewSystemCreationData", &status); if (CMIsNullValue(param)) { rv.uint32 = 80; // Param is invalid/missing @@ -898,9 +902,7 @@ "'NewSystemCreationData' is a required parameter"); return status; } -printf("Got NewSystemCreationData ref arg\n"); -printf("Getting CreationData instance...\n"); cdci = CBGetInstance(_broker, context, param.value.ref, NULL, &status); if (cdci == NULL) { if (status.rc == CMPI_RC_ERR_NOT_FOUND) { @@ -915,45 +917,6 @@ return status; } -/* -printf("Getting InstanceID from NewSystemCreationData\n"); - key = CMGetKey(param.value.ref, "InstanceID", &status); - if (status.rc != CMPI_RC_OK || CMIsNullValue(key)) { - DEBUGOUT("InvokeMethod(): CMGetKey(\"InstanceID\") failed - %d " - "for NewSystemCreationData param\n", status.rc); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, - "'NewSystemCreationData' does not refer to a valid object"); - return status; - } - - iid = CMGetCharPtr(key.value.string); - if (!iid || !strlen(iid)) { - DEBUGOUT("InvokeMethod(): Empty InstanceID on CreationData\n"); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, - "'NewSystemCreationData' does not refer to a valid object"); - return status; - } - DEBUGOUT("InvokeMethod(): CreationData InstanceID: %s\n", iid); - query = db_create_formatted_sql("SELECT InstanceID from CreationData " - "where InstanceID=%Q", iid); - cc = db_create_select_results(&dbctx, query, err_msg, sizeof(err_msg)); - db_destroy_formatted_sql(query); - if (cc != 0) { - DEBUGOUT("InvokeMethod(): Failed to connect to database: %s", - err_msg); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERROR_SYSTEM, err_msg); - return status; - } - cc = db_results_have_more_rows(dbctx); - db_destroy_select_results(dbctx); - if (!cc) { - DEBUGOUT("InvokeMethod(): Failed to find instanceid %s in " - "database\n", iid); - OMC_SETSTATUS(_broker, &status, CMPI_RC_ERR_INVALID_PARAMETER, - "'NewSystemCreationData' does not refer to a valid object"); - return status; - } -*/ param = CMGetArg(in, "UUID", &status); if (!CMIsNullValue(param)) { uuid = CMGetCharPtr(param.value.string); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-05-13 23:52:22
|
Revision: 608 http://omc.svn.sourceforge.net/omc/?rev=608&view=rev Author: jcarey Date: 2008-05-13 16:52:28 -0700 (Tue, 13 May 2008) Log Message: ----------- dev chk pnt Modified Paths: -------------- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-13 23:32:49 UTC (rev 607) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-service.c 2008-05-13 23:52:28 UTC (rev 608) @@ -598,7 +598,7 @@ } /*****************************************************************************/ -omcStrBuf* +char* create_response_file(const char* rf, char *filename, size_t filename_length, CMPIStatus* pstatus) { @@ -626,6 +626,9 @@ const char* iid = NULL; const char *os_type; char wkbfr[256]; + char rspbfr[PATH_MAX]; + char *response_file = NULL; + CMPIObjectPath *jobref = NULL; DEBUGOUT("start_create_vm() called...\n"); @@ -804,26 +807,24 @@ /**** ResponseFile ****/ data = CMGetProperty(cdci, "ResponseFile", NULL); if (!CMIsNullValue(data)) { - char wkbfr[PATH_MAX]; const char *rf = CMGetCharPtr(data.value.string); if (rf && strlen(rf)) { - char *rrsp = create_response_file(rf, wkbfr, sizeof(wkbfr), pstatus); - if (!rrsp) { + response_file = create_response_file(rf, rspbfr, sizeof(rspbfr), pstatus); + if (!response_file) { omcStrArray_destroy(pstra); return NULL; } - omsStrArray_append(pstra, "--os-settings"); - omsStrArray_append(pstra, rrsp); + omcStrArray_append(pstra, "--os-settings"); + omcStrArray_append(pstra, response_file); } } // TODO Execute process and gather output - - - - omcStrArray_destroy(pstra); + if (response_file) { + unlink(response_file); + } // TEST jobref = CMNewObjectPath(_broker, ns, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |