Hello community,
here is the log from the commit of package sblim-cmpi-xenvm-builder
checked in at Fri Nov 28 16:02:47 CET 2008.
--------
--- sblim-cmpi-xenvm-builder/sblim-cmpi-xenvm-builder.changes 2008-08-26 16:52:01.000000000 +0200
+++ sblim-cmpi-xenvm-builder/sblim-cmpi-xenvm-builder.changes 2008-11-26 00:29:43.000000000 +0100
@@ -1,0 +2,24 @@
+Fri Nov 7 07:45:00 MST 2008 - jcarey@novell.com
+
+- Fixed Bug where an invalid AutomaticRecoveryAction property was
+ being return when the property was not specified.
+
+-------------------------------------------------------------------
+Mon Nov 3 16:21:47 MST 2008 - jcarey@novell.com
+
+- Changed to log the vm-install command line to syslog if the
+ VM_BUILDER_DEBUG environment variable is set.
+
+-------------------------------------------------------------------
+Sun Oct 19 14:37:33 MDT 2008 - jcarey@novell.com
+
+- Changed so debug trace messages would be printed out if the
+ VM_BUILDER_DEBUG environment variable is set. Even if the
+ package had not been built with debug enabled.
+
+-------------------------------------------------------------------
+Tue Sep 8 13:50:33 MDT 2008 - jcarey@novell.com
+
+- Added support for on_reboot, on_poweroff and on_crash
+
+-------------------------------------------------------------------
@@ -12,0 +37,4 @@
+
+-------------------------------------------------------------------
+Mon Aug 22 15:33:00 MDT 2008 - jcarey@novell.com
+
@@ -25 +52,0 @@
-
calling whatdependson for head-i586
Old:
----
sblim-cmpi-xenvm-builder-1.0.1.tar.gz
New:
----
sblim-cmpi-xenvm-builder-1.0.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ sblim-cmpi-xenvm-builder.spec ++++++
--- /var/tmp/diff_new_pack.A15485/_old 2008-11-28 16:00:54.000000000 +0100
+++ /var/tmp/diff_new_pack.A15485/_new 2008-11-28 16:00:54.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package sblim-cmpi-xenvm-builder (Version 1.0.1)
+# spec file for package sblim-cmpi-xenvm-builder (Version 1.0.3)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -23,8 +23,8 @@
%define tarname sblim-cmpi-xenvm-builder
Url: http://www.omc-project.org
# Increment the version every time the source code changes.
-Version: 1.0.1
-Release: 2
+Version: 1.0.3
+Release: 1
Group: System/Management
Summary: Linux CIM providers for CMPI instrumentation of virtual machine creation
PreReq: coreutils
@@ -112,6 +112,18 @@
%{_datadir}/mof/%{name}/*
%changelog
+* Fri Nov 07 2008 jcarey@novell.com
+- Fixed Bug where an invalid AutomaticRecoveryAction property was
+ being return when the property was not specified.
+* Mon Nov 03 2008 jcarey@novell.com
+- Changed to log the vm-install command line to syslog if the
+ VM_BUILDER_DEBUG environment variable is set.
+* Sun Oct 19 2008 jcarey@novell.com
+- Changed so debug trace messages would be printed out if the
+ VM_BUILDER_DEBUG environment variable is set. Even if the
+ package had not been built with debug enabled.
+* Mon Sep 08 2008 jcarey@novell.com
+- Added support for on_reboot, on_poweroff and on_crash
* Tue Aug 26 2008 npaxton@novell.com
- Include the provider .reg file in tarball
* Mon Aug 25 2008 npaxton@novell.com
@@ -119,6 +131,7 @@
- Changed registration to use sblim-specific tools, as
provider-register.sh, and other previous attempts to abstract,
have introduced problems.
+* Fri Aug 22 2008 jcarey@novell.com
- Added VNC password to install
* Thu Jul 10 2008 npaxton@novell.com
- Added BuildRequires on sblim-sfcb for specific cimom,
++++++ sblim-cmpi-xenvm-builder-1.0.1.tar.gz -> sblim-cmpi-xenvm-builder-1.0.3.tar.gz ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sblim-cmpi-xenvm-builder-1.0.1/configure new/sblim-cmpi-xenvm-builder-1.0.3/configure
--- old/sblim-cmpi-xenvm-builder-1.0.1/configure 2008-08-26 16:48:27.000000000 +0200
+++ new/sblim-cmpi-xenvm-builder-1.0.3/configure 2008-10-19 22:33:41.000000000 +0200
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for sblim-cmpi-xenvm-builder 1.0.1.
+# Generated by GNU Autoconf 2.59 for sblim-cmpi-xenvm-builder 1.0.3.
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
@@ -421,8 +421,8 @@
# Identity of this package.
PACKAGE_NAME='sblim-cmpi-xenvm-builder'
PACKAGE_TARNAME='sblim-cmpi-xenvm-builder'
-PACKAGE_VERSION='1.0.1'
-PACKAGE_STRING='sblim-cmpi-xenvm-builder 1.0.1'
+PACKAGE_VERSION='1.0.3'
+PACKAGE_STRING='sblim-cmpi-xenvm-builder 1.0.3'
PACKAGE_BUGREPORT=''
ac_unique_file="src"
@@ -953,7 +953,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures sblim-cmpi-xenvm-builder 1.0.1 to adapt to many kinds of systems.
+\`configure' configures sblim-cmpi-xenvm-builder 1.0.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1019,7 +1019,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of sblim-cmpi-xenvm-builder 1.0.1:";;
+ short | recursive ) echo "Configuration of sblim-cmpi-xenvm-builder 1.0.3:";;
esac
cat <<\_ACEOF
@@ -1161,7 +1161,7 @@
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-sblim-cmpi-xenvm-builder configure 1.0.1
+sblim-cmpi-xenvm-builder configure 1.0.3
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1175,7 +1175,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by sblim-cmpi-xenvm-builder $as_me 1.0.1, which was
+It was created by sblim-cmpi-xenvm-builder $as_me 1.0.3, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1818,7 +1818,7 @@
# Define the identity of the package.
PACKAGE='sblim-cmpi-xenvm-builder'
- VERSION='1.0.1'
+ VERSION='1.0.3'
cat >>confdefs.h <<_ACEOF
@@ -25445,7 +25445,7 @@
} >&5
cat >&5 <<_CSEOF
-This file was extended by sblim-cmpi-xenvm-builder $as_me 1.0.1, which was
+This file was extended by sblim-cmpi-xenvm-builder $as_me 1.0.3, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -25511,7 +25511,7 @@
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-sblim-cmpi-xenvm-builder config.status 1.0.1
+sblim-cmpi-xenvm-builder config.status 1.0.3
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sblim-cmpi-xenvm-builder-1.0.1/configure.ac new/sblim-cmpi-xenvm-builder-1.0.3/configure.ac
--- old/sblim-cmpi-xenvm-builder-1.0.1/configure.ac 2008-08-26 16:47:19.000000000 +0200
+++ new/sblim-cmpi-xenvm-builder-1.0.3/configure.ac 2008-10-19 22:33:19.000000000 +0200
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
-AC_INIT(sblim-cmpi-xenvm-builder, 1.0.1)
+AC_INIT(sblim-cmpi-xenvm-builder, 1.0.3)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src])
AC_CONFIG_HEADER([config.h])
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sblim-cmpi-xenvm-builder-1.0.1/mof/XEN_VMBuilderVirtualSystemCreationData.mof new/sblim-cmpi-xenvm-builder-1.0.3/mof/XEN_VMBuilderVirtualSystemCreationData.mof
--- old/sblim-cmpi-xenvm-builder-1.0.1/mof/XEN_VMBuilderVirtualSystemCreationData.mof 2008-07-18 18:44:08.000000000 +0200
+++ new/sblim-cmpi-xenvm-builder-1.0.3/mof/XEN_VMBuilderVirtualSystemCreationData.mof 2008-09-09 22:41:39.000000000 +0200
@@ -87,7 +87,9 @@
"key:value pairs within each element of the array, if the user so desires.")]
String ExtraConfigInfo[];
- [Description("Extra arguments used for the VM Install. May not need.")]
+ [Description("Additional arguments to pass to the paravirtualized OS. "
+ "Note that the tool will automatically generate the necessary "
+ "OS-specific arguments to bootstrap the installation.")]
string ExtraInstallArgs;
[Description("A string containing the URL where the install source "
@@ -116,5 +118,44 @@
"windowsvistax64", "opensuse", "winserver2008",
"winserver2008x64" }]
uint32 OSType;
+
+ [Description("Behaviour of a domain when it is powered off. "
+ "Possible values: "
+ "Destroy: Domain is cleaned up as normal"
+ "Restart: Domain is started in place of the old one"
+ "Preserve: No clean-up s done until the domain is manually destroyed"
+ "Rename-Restart: Old domain is not cleaned up, but is renamed and "
+ "a new domain started in its place. "
+ "Default is 'Destroy'."),
+ ValueMap{"0", "1", "2", "3"},
+ Values{"Destroy", "Restart", "Preserve", "Rename-Restart"}]
+ uint16 OnPowerOff;
+
+ [Description("Behaviour of a domain when it is rebooted. "
+ "Possible values: "
+ "Destroy: Domain is cleaned up as normal"
+ "Restart: Domain is started in place of the old one"
+ "Preserve: No clean-up s done until the domain is manually destroyed"
+ "Rename-Restart: Old domain is not cleaned up, but is renamed and "
+ "a new domain started in its place. "
+ "Default is 'Restart'."),
+ ValueMap{"0", "1", "2", "3"},
+ Values{"Destroy", "Restart", "Preserve", "Rename-Restart"}]
+ uint16 OnReboot;
+
+ [Description("Behaviour of a domain when it crashes. "
+ "Possible values: "
+ "Destroy: Domain is cleaned up as normal"
+ "Restart: Domain is started in place of the old one"
+ "Preserve: No clean-up s done until the domain is manually destroyed"
+ "Rename-Restart: Old domain is not cleaned up, but is renamed and "
+ "a new domain started in its place. "
+ "Coredump-Destroy: Dump the crashed domain's core and then destroy. "
+ "Coredump-Restart: Dump the crashed domain's core and the restart. "
+ "Default is 'Restart'."),
+ ValueMap{"0", "1", "2", "3", "4", "5"},
+ Values{"Destroy", "Restart", "Preserve", "Rename-Restart",
+ "Coredump-Destroy", "Coredump-Restart"}]
+ uint16 OnCrash;
};
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/builder-job.c new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/builder-job.c
--- old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/builder-job.c 2008-06-19 23:06:45.000000000 +0200
+++ new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/builder-job.c 2008-10-19 22:29:44.000000000 +0200
@@ -157,7 +157,7 @@
memset(pinfo, 0, sizeof(*pinfo));
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);
+ DEBUGOUT("vm-install-jobs -s returned %d - %s\n", status, output);
unsigned int num_elements;
lines = cmpiutilStrTokenize(output, "\r\n", &num_elements);
if (lines) {
@@ -739,11 +739,10 @@
Init(
CMPIInstanceMI* self)
{
+ set_debug_for_env();
DEBUGOUT("Initialize() called\n");
-
DEBUGOUT("Deleting job xref recs that no longer exist\n");
db_delete_dead_job_recs(NULL);
-
DEBUGOUT("Leaving Initialize()\n");
}
@@ -775,6 +774,7 @@
MethodInit(
CMPIMethodMI * self)
{
+ set_debug_for_env();
DEBUGOUT("MethodInitialize() called\n");
// do work here if necessary
@@ -916,6 +916,7 @@
AssocInit(
CMPIAssociationMI* self)
{
+ set_debug_for_env();
DEBUGOUT("AssocInit() called");
DEBUGOUT("Leaving AssocInit()\n");
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/builder-service.c new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/builder-service.c
--- old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/builder-service.c 2008-07-18 18:44:08.000000000 +0200
+++ new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/builder-service.c 2008-11-04 00:19:30.000000000 +0100
@@ -527,6 +527,7 @@
Init(
CMPIInstanceMI* self)
{
+ set_debug_for_env();
DEBUGOUT("Initialize() called\n");
DEBUGOUT("Leaving Initialize()\n");
@@ -560,6 +561,7 @@
MethodInit(
CMPIMethodMI * self)
{
+ set_debug_for_env();
DEBUGOUT("MethodInitialize() called\n");
// do work here if necessary
@@ -593,15 +595,71 @@
CMPIStatus* pstatus)
{
FILE* fd = cmpiutilCreateTempFile(filename, filename_length);
+ if (!fd) {
+ CMPIUTIL_SETSTATUS(_broker, pstatus, CMPI_RC_ERROR_SYSTEM,
+ "Failed to create temp file for response file");
+ return NULL;
+ }
+
size_t rflen = strlen(rf);
if (fwrite(rf, sizeof(char), rflen, fd) != rflen) {
fclose(fd);
unlink(filename);
CMPIUTIL_SETSTATUS(_broker, pstatus, CMPI_RC_ERROR_SYSTEM,
- "Failed to create temp file for response file");
+ "Failed writing contents of response file");
+ return NULL;
+ }
+ fclose(fd);
+ return filename;
+}
+
+/*****************************************************************************/
+char*
+create_settings_file(cmpiutilStrArray* lines, char *filename,
+ size_t filename_length, CMPIStatus* pstatus)
+{
+ int i, sz, len;
+ const char* iserr = NULL;
+ const char* line;
+ const char* hdr = "<domain type='xen'>";
+ const char* trlr = "</domain>";
+ FILE* fd = cmpiutilCreateTempFile(filename, filename_length);
+ if (!fd) {
+ CMPIUTIL_SETSTATUS(_broker, pstatus, CMPI_RC_ERROR_SYSTEM,
+ "Failed to create temp file for VM settings");
return NULL;
}
+
+ for(;;) {
+ len = strlen(hdr);
+ if (fwrite(hdr, sizeof(char), len, fd) != len) {
+ iserr = "Failed to write XML to vm-settings file";
+ break;
+ }
+ sz = cmpiutilStrArray_size(lines);
+ for(i = 0; i < sz; i++) {
+ line = cmpiutilStrArray_get_element(lines, i);
+ len = strlen(line);
+ if (fwrite(line, sizeof(char), len, fd) != len) {
+ iserr = "Failed to write XML to vm-settings file";
+ break;
+ }
+ }
+ if (!iserr) {
+ len = strlen(trlr);
+ if (fwrite(trlr, sizeof(char), len, fd) != len)
+ iserr = "Failed to write XML to vm-settings file";
+ }
+ break;
+ }
+
fclose(fd);
+ if (iserr) {
+ unlink(filename);
+ CMPIUTIL_SETSTATUS(_broker, pstatus, CMPI_RC_ERROR_SYSTEM, iserr);
+ return NULL;
+ }
+
return filename;
}
@@ -617,16 +675,22 @@
CMPIStatus *pstatus)
{
CMPIData data;
- cmpiutilStrArray *pstra;
+ cmpiutilStrArray *pstra, *vm_settings = NULL;
const char *iid = NULL;
const char *os_type;
char wkbfr[256];
char rspbfr[PATH_MAX];
+ char settingsbfr[PATH_MAX];
char *response_file = NULL;
+ char *settings_file = NULL;
int cc, i;
size_t output_size;
char* output;
CMPIObjectPath *jobref = NULL;
+ static const char* on_actions[] = {
+ "destroy", "restart", "preserve", "rename-restart",
+ "coredump-destroy", "coredump-restart"
+ };
DEBUGOUT("start_create_vm() called...\n");
data = CMGetProperty(cdci, "InstanceID", NULL);
@@ -819,14 +883,68 @@
}
}
+ vm_settings = cmpiutilStrArray_create();
+ if (!vm_settings) {
+ if (response_file) {
+ unlink(response_file);
+ }
+ cmpiutilStrArray_destroy(pstra);
+ CMPIUTIL_SETSTATUS(_broker, pstatus, CMPI_RC_ERROR_SYSTEM,
+ "Failed to create string array for vm settings");
+ return NULL;
+ }
+
+ /**** OnPowerOff ****/
+ data = CMGetProperty(cdci, "OnPowerOff", NULL);
+ if (!CMIsNullValue(data)) {
+ snprintf(wkbfr, sizeof(wkbfr), "%s", on_actions[data.value.uint16]);
+ cmpiutilStrArray_append(vm_settings, wkbfr);
+ }
+
+ /**** OnReboot ****/
+ data = CMGetProperty(cdci, "OnReboot", NULL);
+ if (!CMIsNullValue(data)) {
+ snprintf(wkbfr, sizeof(wkbfr), "%s", on_actions[data.value.uint16]);
+ cmpiutilStrArray_append(vm_settings, wkbfr);
+ }
+
+ /**** OnCrash ****/
+ data = CMGetProperty(cdci, "OnCrash", NULL);
+ if (!CMIsNullValue(data)) {
+ snprintf(wkbfr, sizeof(wkbfr), "%s", on_actions[data.value.uint16]);
+ cmpiutilStrArray_append(vm_settings, wkbfr);
+ }
+
+ /* If OnPowerOff/OnReboot/OnCrash specified then create a vm-settings file */
+ if (cmpiutilStrArray_size(vm_settings) > 0)
+ {
+ settings_file = create_settings_file(vm_settings, settingsbfr,
+ sizeof(settingsbfr), pstatus);
+ if (!settings_file) {
+ if (response_file) {
+ unlink(response_file);
+ }
+ cmpiutilStrArray_destroy(vm_settings);
+ cmpiutilStrArray_destroy(pstra);
+ return NULL;
+ }
+ cmpiutilStrArray_append(pstra, "--vm-settings");
+ cmpiutilStrArray_append(pstra, settings_file);
+ }
+ cmpiutilStrArray_destroy(vm_settings);
+
/* 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]);
+ if (is_debug()) {
+ cmpiutilStrBuf* cmdBuf = cmpiutilStrBuf_create();
+ cmpiutilStrBuf_set(cmdBuf, "VM Builder Executing: ", 0);
+ for(i = 0; pstra->strs[i]; i++) {
+ cmpiutilStrBuf_cat(cmdBuf, pstra->strs[i], 0);
+ cmpiutilStrBuf_cat(cmdBuf, " ", 0);
+ }
+ DEBUGOUT("%s\n", cmdBuf->bfr);
+ CMLogMessage(_broker, 1, "VMBuilder Provider", cmdBuf->bfr, NULL);
+ cmpiutilStrBuf_destroy(cmdBuf);
}
- printf("\n");
-#endif
output = NULL;
DEBUGOUT("Calling vm-install...\n");
@@ -845,11 +963,9 @@
} else {
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);
+ DEBUGOUT("vm-install output: %s\n", output);
}
-#endif
}
} else {
strerror_r(errno, wkbfr, sizeof(wkbfr));
@@ -864,49 +980,60 @@
free(output);
}
cmpiutilStrArray_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.
- */
- CMPIInstance *jobci;
- CMPIStatus lstatus;
- int fail_count = 0;
- DEBUGOUT("Entering GetInstance loop for Job instance...\n");
- while(fail_count < 10) {
- cmpiutilMilliSleep(1000);
- jobci = CBGetInstance(_broker, context, jobref, NULL,
- &lstatus);
- if (jobci == NULL) {
- DEBUGOUT("GetInstance for Job returned NULL. "
- "Inc fail count\n");
- fail_count++;
+
+ /* If a jobref was returned, wait for it to get beyond
+ * the 'SETTINGS' state before any clean up.
+ */
+ if (jobref) {
+ DEBUGOUT("There is a job reference, so waiting for right state\n");
+ /*
+ * Wait until Job state goes beyond the 'SETTINGS' state.
+ */
+ CMPIInstance *jobci;
+ CMPIStatus lstatus;
+ int fail_count = 0;
+ DEBUGOUT("Entering GetInstance loop for Job instance...\n");
+ while(fail_count < 10) {
+ cmpiutilMilliSleep(1000);
+ 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) {
+ DEBUGOUT("Still to soon to delete Response file\n");
continue;
}
- data = CMGetProperty(jobci, "JobStatus", NULL);
- if (!CMIsNullValue(data)) {
- const char *p = CMGetCharPtr(data.value.string);
- if (strcasecmp(p, "SETTINGS") == 0) {
- 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("Install state allows for response file "
+ "delete\n");
+ break;
+ } else {
+ DEBUGOUT("Job instance has NULL JobStatus property. "
+ "Inc Fail count\n");
+ fail_count++;
}
}
+ }
+
+ DEBUGOUT("checking for existence response file\n");
+ if (response_file) {
+ DEBUGOUT("Should have response file %s\n", response_file);
DEBUGOUT("Deleting response file: %s\n", response_file);
unlink(response_file);
}
+
+ DEBUGOUT("checking for existence of settings file\n");
+ if (settings_file) {
+ DEBUGOUT("Should have settings file %s\n", settings_file);
+ DEBUGOUT("Deleting settings file: %s\n", settings_file);
+ unlink(settings_file);
+ }
DEBUGOUT("start_create_vm() returning\n");
return jobref;
}
@@ -1045,6 +1172,7 @@
AssocInit(
CMPIAssociationMI* self)
{
+ set_debug_for_env();
DEBUGOUT("AssocInit() called");
DEBUGOUT("Leaving AssocInit()\n");
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/owning-job.c new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/owning-job.c
--- old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/owning-job.c 2008-06-19 23:06:45.000000000 +0200
+++ new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/owning-job.c 2008-10-19 22:30:46.000000000 +0200
@@ -414,6 +414,7 @@
Init(
CMPIInstanceMI* self)
{
+ set_debug_for_env();
DEBUGOUT("Initialize() called\n");
db_delete_dead_job_recs(NULL);
@@ -453,6 +454,7 @@
AssocInit(
CMPIAssociationMI* self)
{
+ set_debug_for_env();
DEBUGOUT("AssocInit() called");
DEBUGOUT("Leaving AssocInit()\n");
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/setting-define-build.c new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/setting-define-build.c
--- old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/setting-define-build.c 2008-06-19 23:06:45.000000000 +0200
+++ new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/setting-define-build.c 2008-10-19 22:31:05.000000000 +0200
@@ -436,6 +436,7 @@
Init(
CMPIInstanceMI* self)
{
+ set_debug_for_env();
DEBUGOUT("Initialize() called\n");
db_delete_dead_job_recs(NULL);
@@ -475,6 +476,7 @@
AssocInit(
CMPIAssociationMI* self)
{
+ set_debug_for_env();
DEBUGOUT("AssocInit() called");
DEBUGOUT("Leaving AssocInit()\n");
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/vmbuilder-db.c new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/vmbuilder-db.c
--- old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/vmbuilder-db.c 2008-08-18 21:39:18.000000000 +0200
+++ new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/vmbuilder-db.c 2008-09-04 22:29:59.000000000 +0200
@@ -86,6 +86,23 @@
"VirtType INTEGER,"
"VirtualSystemIdentifier TEXT,"
"VirtualSystemType TEXT,"
+ //-- 0: Destroy
+ //-- 1: Restart
+ //-- 2: Preserve
+ //-- 3: Rename-Restart
+ "OnPowerOff INTEGER,"
+ //-- 0: Destroy
+ //-- 1: Restart
+ //-- 2: Preserve
+ //-- 3: Rename-Restart
+ "OnReboot INTEGER,"
+ //-- 0: Destroy
+ //-- 1: Restart
+ //-- 2: Preserve
+ //-- 3: Rename-Restart
+ //-- 4: Coredump-Destroy
+ //-- 5: Coredump-Restart
+ "OnCrash INTEGER,"
"PRIMARY KEY(InstanceID COLLATE NOCASE));"
"CREATE TABLE Job("
"JobName TEXT NOT NULL,"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/vmbuilder-util.c new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/vmbuilder-util.c
--- old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/vmbuilder-util.c 2008-06-19 23:06:45.000000000 +0200
+++ new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/vmbuilder-util.c 2008-10-20 18:18:14.000000000 +0200
@@ -1,6 +1,9 @@
#include "vmbuilder-util.h"
#include
+#include
+#include
+
#include
#include
#include
@@ -8,6 +11,54 @@
#include
#include
+
+#ifdef XEN_VMBUILDER_DEBUG
+static int _is_debug = 1;
+#else
+static int _is_debug = 0;
+#endif
+
+/******************************************************************************/
+int
+is_debug()
+{
+ return _is_debug;
+}
+
+/******************************************************************************/
+void
+set_debug_for_env()
+{
+ const char* penv = getenv("VM_BUILDER_DEBUG");
+ if (NULL != penv)
+ {
+ if (strncmp(penv, "0", 1)
+ && strncasecmp(penv, "false", 5))
+ _is_debug = 1;
+ else
+ _is_debug = 0;
+ }
+#ifndef XEN_VMBUILDER_DEBUG
+ else
+ {
+ _is_debug = 0;
+ }
+#endif
+}
+
+/******************************************************************************/
+void
+vmbuilder_debug_out(const char* fmt, ...)
+{
+ if (_is_debug)
+ {
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stdout, fmt, ap);
+ va_end(ap);
+ }
+}
+
/******************************************************************************/
CMPIArray*
str2UInt16Array(const CMPIBroker* broker, const char* str)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/vmbuilder-util.h new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/vmbuilder-util.h
--- old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/vmbuilder-util.h 2008-06-19 23:06:45.000000000 +0200
+++ new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/vmbuilder-util.h 2008-10-20 18:18:36.000000000 +0200
@@ -24,12 +24,10 @@
void set_dt_prop(const CMPIBroker* broker, VMBDBCtx dbctx, int col_ndx,
CMPIInstance* instance, const char* prop_name, CMPIBoolean isInterval);
char** get_job_names();
+int is_debug();
+void set_debug_for_env();
+void vmbuilder_debug_out(const char* fmt, ...);
-/* If built for debug, enable tracing */
-#ifdef XEN_VMBUILDER_DEBUG
-#define DEBUGOUT(fmt, args...) printf(fmt,## args)
-#else
-#define DEBUGOUT(fmt, args...)
-#endif
+#define DEBUGOUT(fmt, args...) vmbuilder_debug_out(fmt,## args)
#endif /* VMBUILDER_UTIL_H_GUARD */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/vmcreation-data.c new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/vmcreation-data.c
--- old/sblim-cmpi-xenvm-builder-1.0.1/src/providers/vm-builder/vmcreation-data.c 2008-08-18 21:39:18.000000000 +0200
+++ new/sblim-cmpi-xenvm-builder-1.0.3/src/providers/vm-builder/vmcreation-data.c 2008-11-07 15:49:45.000000000 +0100
@@ -99,7 +99,10 @@
"VNCPassword," \
"VirtType," \
"VirtualSystemIdentifier," \
- "VirtualSystemType"
+ "VirtualSystemType," \
+ "OnPowerOff," \
+ "OnReboot," \
+ "OnCrash"
const char* all_cd_fields_query_with_where = "SELECT "CSV_FIELDS" FROM CreationData "
"WHERE InstanceID=%Q;";
@@ -145,7 +148,10 @@
CDF_VNCPassword,
CDF_VirtType,
CDF_VirtualSystemIdentifier,
- CDF_VirtualSystemType
+ CDF_VirtualSystemType,
+ CDF_OnPowerOff,
+ CDF_OnReboot,
+ CDF_OnCrash
};
/*
@@ -231,6 +237,51 @@
/*****************************************************************************/
static CMPIrc
+valid_on_power_off(const CMPIData *pdata, CMPIStatus* pstatus)
+{
+ CMSetStatus(pstatus, CMPI_RC_OK);
+ if (!CMIsNullValue((*pdata))) {
+ if (pdata->value.uint16 > 3) {
+ CMSetStatusWithChars(_broker, pstatus,
+ CMPI_RC_ERR_INVALID_PARAMETER,
+ "Invalid 'OnPowerOff' property");
+ }
+ }
+ return pstatus->rc;
+}
+
+/*****************************************************************************/
+static CMPIrc
+valid_on_reboot(const CMPIData *pdata, CMPIStatus* pstatus)
+{
+ CMSetStatus(pstatus, CMPI_RC_OK);
+ if (!CMIsNullValue((*pdata))) {
+ if (pdata->value.uint16 > 3) {
+ CMSetStatusWithChars(_broker, pstatus,
+ CMPI_RC_ERR_INVALID_PARAMETER,
+ "Invalid 'OnReboot' property");
+ }
+ }
+ return pstatus->rc;
+}
+
+/*****************************************************************************/
+static CMPIrc
+valid_on_crash(const CMPIData *pdata, CMPIStatus* pstatus)
+{
+ CMSetStatus(pstatus, CMPI_RC_OK);
+ if (!CMIsNullValue((*pdata))) {
+ if (pdata->value.uint16 > 5) {
+ CMSetStatusWithChars(_broker, pstatus,
+ CMPI_RC_ERR_INVALID_PARAMETER,
+ "Invalid 'OnCrash' property");
+ }
+ }
+ return pstatus->rc;
+}
+
+/*****************************************************************************/
+static CMPIrc
valid_automatic_recovery_action(const CMPIData *pdata, CMPIStatus* pstatus)
{
CMSetStatus(pstatus, CMPI_RC_OK);
@@ -275,44 +326,61 @@
}
/*****************************************************************************/
-static void
+static int
add_u8_prop_to_query(cmpiutilStrBuf* pstrbuf, const CMPIInstance* instance,
const char* prop_name)
{
+ int cc = 0;
CMPIData data = CMGetProperty(instance, prop_name, NULL);
if (!CMIsNullValue(data)) {
char wkbfr[32];
snprintf(wkbfr, sizeof(wkbfr), "%u,", data.value.uint8);
cmpiutilStrBuf_cat(pstrbuf, wkbfr, 0);
+ cc = 1;
} else {
cmpiutilStrBuf_cat(pstrbuf, "NULL,", 0);
}
+ return cc;
}
/*****************************************************************************/
-static void
+static int
add_u16_prop_to_query(cmpiutilStrBuf* pstrbuf, const CMPIInstance* instance,
- const char* prop_name, CMPIData *pdata)
+ const char* prop_name, CMPIData *pdata, int endstmt)
{
+ int cc = 0;
CMPIData data;
+ const char* pnnfmt;
+ const char* pnullfmt;
if (!pdata) {
pdata = &data;
}
+
+ if (endstmt) {
+ pnnfmt = "%d";
+ pnullfmt = "NULL";
+ } else {
+ pnnfmt = "%d,";
+ pnullfmt = "NULL,";
+ }
*pdata = CMGetProperty(instance, prop_name, NULL);
if (!CMIsNullValue((*pdata))) {
char wkbfr[32];
- snprintf(wkbfr, sizeof(wkbfr), "%u,", pdata->value.uint16);
+ snprintf(wkbfr, sizeof(wkbfr), pnnfmt, pdata->value.uint16);
cmpiutilStrBuf_cat(pstrbuf, wkbfr, 0);
+ cc = 1;
} else {
- cmpiutilStrBuf_cat(pstrbuf, "NULL,", 0);
+ cmpiutilStrBuf_cat(pstrbuf, pnullfmt, 0);
}
+ return cc;
}
/*****************************************************************************/
-static void
+static int
add_u32_prop_to_query(cmpiutilStrBuf* pstrbuf, const CMPIInstance* instance,
const char* prop_name, CMPIData* pdata)
{
+ int cc = 0;
CMPIData data;
if (!pdata) {
pdata = &data;
@@ -323,16 +391,19 @@
char wkbfr[32];
snprintf(wkbfr, sizeof(wkbfr), "%u,", pdata->value.uint32);
cmpiutilStrBuf_cat(pstrbuf, wkbfr, 0);
+ cc = 1;
} else {
cmpiutilStrBuf_cat(pstrbuf, "NULL,", 0);
}
+ return cc;
}
/*****************************************************************************/
-static void
+static int
add_str_prop_to_query(cmpiutilStrBuf* pstrbuf, const CMPIInstance* instance,
const char* prop_name, int endstmt)
{
+ int cc = 0;
CMPIData data;
const char* pnnfmt;
const char* pnullfmt;
@@ -347,16 +418,19 @@
if (!CMIsNullValue(data)) {
char *p = (char*) CMGetCharPtr(data.value.string);
db_sql_insert(pstrbuf, pnnfmt, p);
+ cc = 1;
} else {
cmpiutilStrBuf_cat(pstrbuf, pnullfmt, 0);
}
+ return cc;
}
/*****************************************************************************/
-static void
+static int
add_stra_prop_to_query(cmpiutilStrBuf* pstrbuf, const CMPIInstance* instance,
const char* prop_name)
{
+ int cc = 0;
CMPIData data = CMGetProperty(instance, prop_name, NULL);
if (!CMIsNullValue(data)) {
cmpiutilStrBuf* lstrbuf = stringArray2Str(_broker, data.value.array);
@@ -366,9 +440,11 @@
} else {
cmpiutilStrBuf_cat(pstrbuf, "NULL,", 0);
}
+ cc = 1;
} else {
cmpiutilStrBuf_cat(pstrbuf, "NULL,", 0);
}
+ return cc;
}
@@ -444,6 +520,9 @@
set_u32_prop(dbctx, CDF_VirtType, instance, "VirtType");
set_str_prop(dbctx, CDF_VirtualSystemIdentifier, instance, "VirtualSystemIdentifier");
set_str_prop(dbctx, CDF_VirtualSystemType, instance, "VirtualSystemType");
+ set_u16_prop(dbctx, CDF_OnPowerOff, instance, "OnPowerOff");
+ set_u16_prop(dbctx, CDF_OnReboot, instance, "OnReboot");
+ set_u16_prop(dbctx, CDF_OnCrash, instance, "OnCrash");
}
/******************************************************************************
@@ -644,7 +723,7 @@
/*****************************************************************************/
-void
+int
mod_add_u16_prop(cmpiutilStrArray* pstra, const CMPIInstance* modified_instance,
const char* prop_name, const char** properties, CMPIData* pdata)
{
@@ -655,7 +734,7 @@
pdata = &data;
}
if (!get_mod_property(modified_instance, prop_name, properties, pdata)) {
- return;
+ return 0;
}
if (!CMIsNullValue((*pdata))) {
snprintf(wkbfr, sizeof(wkbfr), "%s=%u", prop_name, pdata->value.uint16);
@@ -663,17 +742,18 @@
snprintf(wkbfr, sizeof(wkbfr), "%s=NULL", prop_name);
}
cmpiutilStrArray_append(pstra, wkbfr);
+ return 1;
}
/*****************************************************************************/
-void
+int
mod_add_u8_prop(cmpiutilStrArray* pstra, const CMPIInstance* modified_instance,
const char* prop_name, const char** properties)
{
char wkbfr[256];
CMPIData data;
if (!get_mod_property(modified_instance, prop_name, properties, &data)) {
- return;
+ return 0;
}
if (!CMIsNullValue(data)) {
snprintf(wkbfr, sizeof(wkbfr), "%s=%u", prop_name, data.value.uint8);
@@ -681,16 +761,17 @@
snprintf(wkbfr, sizeof(wkbfr), "%s=NULL", prop_name);
}
cmpiutilStrArray_append(pstra, wkbfr);
+ return 1;
}
/*****************************************************************************/
-void
+int
mod_add_str_prop(cmpiutilStrArray* pstra, const CMPIInstance* modified_instance,
const char* prop_name, const char** properties)
{
CMPIData data;
if (!get_mod_property(modified_instance, prop_name, properties, &data)) {
- return;
+ return 0;
}
if (!CMIsNullValue(data)) {
char *p = (char*) CMGetCharPtr(data.value.string);
@@ -702,16 +783,17 @@
snprintf(wkbfr, sizeof(wkbfr), "%s=NULL", prop_name);
cmpiutilStrArray_append(pstra, wkbfr);
}
+ return 1;
}
/*****************************************************************************/
-void
+int
mod_add_stra_prop(cmpiutilStrArray* pstra, const CMPIInstance* modified_instance,
const char* prop_name, const char** properties)
{
CMPIData data;
if (!get_mod_property(modified_instance, prop_name, properties, &data)) {
- return;
+ return 0;
}
if (!CMIsNullValue(data)) {
cmpiutilStrBuf* lstrbuf = stringArray2Str(_broker, data.value.array);
@@ -730,10 +812,11 @@
snprintf(wkbfr, sizeof(wkbfr), "%s=NULL", prop_name);
cmpiutilStrArray_append(pstra, wkbfr);
}
+ return 1;
}
/*****************************************************************************/
-void
+int
mod_add_u32_prop(cmpiutilStrArray* pstra, const CMPIInstance* modified_instance,
const char* prop_name, const char** properties, CMPIData* pdata)
{
@@ -744,7 +827,7 @@
pdata = &data;
}
if (!get_mod_property(modified_instance, prop_name, properties, pdata)) {
- return;
+ return 0;
}
if (!CMIsNullValue((*pdata))) {
snprintf(wkbfr, sizeof(wkbfr), "%s=%u", prop_name, pdata->value.uint32);
@@ -752,6 +835,7 @@
snprintf(wkbfr, sizeof(wkbfr), "%s=NULL", prop_name);
}
cmpiutilStrArray_append(pstra, wkbfr);
+ return 1;
}
/******************************************************************************
@@ -833,20 +917,23 @@
return status;
}
- mod_add_u16_prop(pstra, modified_instance, "AutoMaticRecoveryAction", properties, &data);
- if (valid_automatic_recovery_action(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrArray_destroy(pstra);
- return status;
+ if (mod_add_u16_prop(pstra, modified_instance, "AutoMaticRecoveryAction", properties, &data)) {
+ if (valid_automatic_recovery_action(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrArray_destroy(pstra);
+ return status;
+ }
}
- mod_add_u16_prop(pstra, modified_instance, "AutoMaticShutdownAction", properties, &data);
- if (valid_automatic_shutdown_action(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrArray_destroy(pstra);
- return status;
+ if (mod_add_u16_prop(pstra, modified_instance, "AutoMaticShutdownAction", properties, &data)) {
+ if (valid_automatic_shutdown_action(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrArray_destroy(pstra);
+ return status;
+ }
}
- mod_add_u16_prop(pstra, modified_instance, "AutoMaticStartupAction", properties, &data);
- if (valid_automatic_startup_action(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrArray_destroy(pstra);
- return status;
+ if (mod_add_u16_prop(pstra, modified_instance, "AutoMaticStartupAction", properties, &data)) {
+ if (valid_automatic_startup_action(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrArray_destroy(pstra);
+ return status;
+ }
}
if (get_mod_property(modified_instance, "AutoMaticStartupActionDelay", properties, &data)) {
if (!CMIsNullValue(data)) {
@@ -868,10 +955,11 @@
"AutomaticStartupActionSequenceNumber", properties, NULL);
mod_add_str_prop(pstra, modified_instance, "CPUArchitecture", properties);
mod_add_str_prop(pstra, modified_instance, "Caption", properties);
- mod_add_u16_prop(pstra, modified_instance, "ChangeableType", properties, &data);
- if (valid_changeable_type(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrArray_destroy(pstra);
- return status;
+ if (mod_add_u16_prop(pstra, modified_instance, "ChangeableType", properties, &data)) {
+ if (valid_changeable_type(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrArray_destroy(pstra);
+ return status;
+ }
}
mod_add_str_prop(pstra, modified_instance, "ConfigurationDataRoot", properties);
mod_add_str_prop(pstra, modified_instance, "ConfigurationFile", properties);
@@ -898,15 +986,17 @@
mod_add_str_prop(pstra, modified_instance, "ElementName", properties);
mod_add_stra_prop(pstra, modified_instance, "ExtraConfigInfo", properties);
mod_add_str_prop(pstra, modified_instance, "ExtraInstallArgs", properties);
- mod_add_u32_prop(pstra, modified_instance, "GraphicsType", properties, &data);
- if (valid_graphics_type(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrArray_destroy(pstra);
- return status;
+ if (mod_add_u32_prop(pstra, modified_instance, "GraphicsType", properties, &data)) {
+ if (valid_graphics_type(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrArray_destroy(pstra);
+ return status;
+ }
}
- mod_add_u32_prop(pstra, modified_instance, "GraphicsViewerType", properties, &data);
- if (valid_graphics_viewer_type(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrArray_destroy(pstra);
- return status;
+ if (mod_add_u32_prop(pstra, modified_instance, "GraphicsViewerType", properties, &data)) {
+ if (valid_graphics_viewer_type(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrArray_destroy(pstra);
+ return status;
+ }
}
mod_add_str_prop(pstra, modified_instance, "LogDataRoot", properties);
mod_add_u32_prop(pstra, modified_instance, "MaxMemory", properties, NULL);
@@ -914,10 +1004,11 @@
mod_add_stra_prop(pstra, modified_instance, "Nics", properties);
mod_add_stra_prop(pstra, modified_instance, "Notes", properties);
mod_add_u8_prop(pstra, modified_instance, "NumVCPUs", properties);
- mod_add_u32_prop(pstra, modified_instance, "OSType", properties, &data);
- if (valid_os_type(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrArray_destroy(pstra);
- return status;
+ if (mod_add_u32_prop(pstra, modified_instance, "OSType", properties, &data)) {
+ if (valid_os_type(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrArray_destroy(pstra);
+ return status;
+ }
}
mod_add_str_prop(pstra, modified_instance, "RecoveryFile", properties);
mod_add_str_prop(pstra, modified_instance, "ResponseFile", properties);
@@ -927,14 +1018,32 @@
mod_add_str_prop(pstra, modified_instance, "SwapFileDataRoot", properties);
mod_add_u32_prop(pstra, modified_instance, "VNCPort", properties, NULL);
mod_add_str_prop(pstra, modified_instance, "VNCPassword", properties);
- mod_add_u32_prop(pstra, modified_instance, "VirtType", properties, &data);
- if (valid_virt_type(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrArray_destroy(pstra);
- return status;
+ if (mod_add_u32_prop(pstra, modified_instance, "VirtType", properties, &data)) {
+ if (valid_virt_type(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrArray_destroy(pstra);
+ return status;
+ }
}
mod_add_str_prop(pstra, modified_instance, "VirtualSystemIdentifier", properties);
mod_add_str_prop(pstra, modified_instance, "VirtualSystemType", properties);
-
+ if (mod_add_u16_prop(pstra, modified_instance, "OnPowerOff", properties, &data)) {
+ if (valid_on_power_off(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrArray_destroy(pstra);
+ return status;
+ }
+ }
+ if (mod_add_u16_prop(pstra, modified_instance, "OnReboot", properties, &data)) {
+ if (valid_on_reboot(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrArray_destroy(pstra);
+ return status;
+ }
+ }
+ if (mod_add_u16_prop(pstra, modified_instance, "OnCrash", properties, &data)) {
+ if (valid_on_crash(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrArray_destroy(pstra);
+ return status;
+ }
+ }
pstrbuf = cmpiutilStrBuf_create();
if (!pstrbuf) {
CMSetStatusWithChars(_broker, &status, CMPI_RC_ERROR_SYSTEM,
@@ -1024,20 +1133,23 @@
cmpiutilStrBuf_cat(pstrbuf, ") VALUES (", 0);
db_sql_insert(pstrbuf, "%Q,", iid);
- add_u16_prop_to_query(pstrbuf, newinstance, "AutoMaticRecoveryAction", &data);
- if (valid_automatic_recovery_action(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrBuf_destroy(pstrbuf);
- return status;
+ if (add_u16_prop_to_query(pstrbuf, newinstance, "AutoMaticRecoveryAction", &data, 0)) {
+ if (valid_automatic_recovery_action(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrBuf_destroy(pstrbuf);
+ return status;
+ }
}
- add_u16_prop_to_query(pstrbuf, newinstance, "AutoMaticShutdownAction", &data);
- if (valid_automatic_shutdown_action(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrBuf_destroy(pstrbuf);
- return status;
+ if (add_u16_prop_to_query(pstrbuf, newinstance, "AutoMaticShutdownAction", &data, 0)) {
+ if (valid_automatic_shutdown_action(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrBuf_destroy(pstrbuf);
+ return status;
+ }
}
- add_u16_prop_to_query(pstrbuf, newinstance, "AutoMaticStartupAction", &data);
- if (valid_automatic_startup_action(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrBuf_destroy(pstrbuf);
- return status;
+ if (add_u16_prop_to_query(pstrbuf, newinstance, "AutoMaticStartupAction", &data, 0)) {
+ if (valid_automatic_startup_action(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrBuf_destroy(pstrbuf);
+ return status;
+ }
}
data = CMGetProperty(newinstance, "AutoMaticStartupActionDelay", NULL);
if (!CMIsNullValue(data)) {
@@ -1056,13 +1168,14 @@
cmpiutilStrBuf_cat(pstrbuf, "NULL,", 0);
}
- add_u16_prop_to_query(pstrbuf, newinstance, "AutoMaticStartupActionSequenceNumber", NULL);
+ add_u16_prop_to_query(pstrbuf, newinstance, "AutoMaticStartupActionSequenceNumber", NULL, 0);
add_str_prop_to_query(pstrbuf, newinstance, "CPUArchitecture", 0);
add_str_prop_to_query(pstrbuf, newinstance, "Caption", 0);
- add_u16_prop_to_query(pstrbuf, newinstance, "ChangeableType", &data);
- if (valid_changeable_type(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrBuf_destroy(pstrbuf);
- return status;
+ if (add_u16_prop_to_query(pstrbuf, newinstance, "ChangeableType", &data, 0)) {
+ if (valid_changeable_type(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrBuf_destroy(pstrbuf);
+ return status;
+ }
}
add_str_prop_to_query(pstrbuf, newinstance, "ConfigurationDataRoot", 0);
add_str_prop_to_query(pstrbuf, newinstance, "ConfigurationFile", 0);
@@ -1091,15 +1204,17 @@
add_str_prop_to_query(pstrbuf, newinstance, "ElementName", 0);
add_stra_prop_to_query(pstrbuf, newinstance, "ExtraConfigInfo");
add_str_prop_to_query(pstrbuf, newinstance, "ExtraInstallArgs", 0);
- add_u32_prop_to_query(pstrbuf, newinstance, "GraphicsType", &data);
- if (valid_graphics_type(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrBuf_destroy(pstrbuf);
- return status;
+ if (add_u32_prop_to_query(pstrbuf, newinstance, "GraphicsType", &data)) {
+ if (valid_graphics_type(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrBuf_destroy(pstrbuf);
+ return status;
+ }
}
- add_u32_prop_to_query(pstrbuf, newinstance, "GraphicsViewerType", &data);
- if (valid_graphics_viewer_type(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrBuf_destroy(pstrbuf);
- return status;
+ if (add_u32_prop_to_query(pstrbuf, newinstance, "GraphicsViewerType", &data)) {
+ if (valid_graphics_viewer_type(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrBuf_destroy(pstrbuf);
+ return status;
+ }
}
add_str_prop_to_query(pstrbuf, newinstance, "LogDataRoot", 0);
add_u32_prop_to_query(pstrbuf, newinstance, "MaxMemory", NULL);
@@ -1107,10 +1222,11 @@
add_stra_prop_to_query(pstrbuf, newinstance, "Nics");
add_stra_prop_to_query(pstrbuf, newinstance, "Notes");
add_u8_prop_to_query(pstrbuf, newinstance, "NumVCPUs");
- add_u32_prop_to_query(pstrbuf, newinstance, "OSType", &data);
- if (valid_os_type(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrBuf_destroy(pstrbuf);
- return status;
+ if (add_u32_prop_to_query(pstrbuf, newinstance, "OSType", &data)) {
+ if (valid_os_type(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrBuf_destroy(pstrbuf);
+ return status;
+ }
}
add_str_prop_to_query(pstrbuf, newinstance, "RecoveryFile", 0);
add_str_prop_to_query(pstrbuf, newinstance, "ResponseFile", 0);
@@ -1120,15 +1236,36 @@
add_str_prop_to_query(pstrbuf, newinstance, "SwapFileDataRoot", 0);
add_u32_prop_to_query(pstrbuf, newinstance, "VNCPort", NULL);
add_str_prop_to_query(pstrbuf, newinstance, "VNCPassword", 0);
- add_u32_prop_to_query(pstrbuf, newinstance, "VirtType", &data);
- if (valid_virt_type(&data, &status) != CMPI_RC_OK) {
- cmpiutilStrBuf_destroy(pstrbuf);
- return status;
+ if (add_u32_prop_to_query(pstrbuf, newinstance, "VirtType", &data)) {
+ if (valid_virt_type(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrBuf_destroy(pstrbuf);
+ return status;
+ }
}
add_str_prop_to_query(pstrbuf, newinstance, "VirtualSystemIdentifier", 0);
- add_str_prop_to_query(pstrbuf, newinstance, "VirtualSystemType", 1);
+ add_str_prop_to_query(pstrbuf, newinstance, "VirtualSystemType", 0);
+ if (add_u16_prop_to_query(pstrbuf, newinstance, "OnPowerOff", &data, 0)) {
+ if (valid_on_power_off(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrBuf_destroy(pstrbuf);
+ return status;
+ }
+ }
+ if (add_u16_prop_to_query(pstrbuf, newinstance, "OnReboot", &data, 0)) {
+ if (valid_on_reboot(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrBuf_destroy(pstrbuf);
+ return status;
+ }
+ }
+ if (add_u16_prop_to_query(pstrbuf, newinstance, "OnCrash", &data, 1)) {
+ if (valid_on_crash(&data, &status) != CMPI_RC_OK) {
+ cmpiutilStrBuf_destroy(pstrbuf);
+ return status;
+ }
+ }
cmpiutilStrBuf_cat(pstrbuf, ");", 0);
+ DEBUGOUT("SQL: %s\n", pstrbuf->bfr);
+
if (db_exec(pstrbuf->bfr, wkbfr, sizeof(wkbfr)) < 0LL) {
DEBUGOUT("CreateInstance(): failed inserting record into "
"database: %s", wkbfr);
@@ -1236,6 +1373,7 @@
Init(
CMPIInstanceMI* self)
{
+ set_debug_for_env();
DEBUGOUT("Initialize() called\n");
/* Delete jobs xref recs for jobs that no longer exist */
@@ -1272,6 +1410,7 @@
MethodInit(
CMPIMethodMI * self)
{
+ set_debug_for_env();
DEBUGOUT("MethodInitialize() called\n");
// do work here if necessary
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org