Esempio n. 1
0
// automatically generated. Do not modify
static void testHostMetricss(xen_session *session) {
	printf("\nGet all the  HostMetrics Records\n");

	xen_host_metrics_set *host_metrics_set;
	bool d = xen_host_metrics_get_all(session, &host_metrics_set);
	if (d) {
		size_t i = 0;
		for (; i < host_metrics_set->size; ++i) {
			xen_host_metrics_record *host_metrics_record;
			xen_host_metrics_get_record(session, &host_metrics_record,
					host_metrics_set->contents[i]);
			char *handle = (char*) host_metrics_record->handle;
			char *opaque = (char*) host_metrics_set->contents[i];
			if (strcmp(handle, opaque) == 0)
				printf("identical: %s\n", opaque);
			else
				printf("record->handle[%s] v.s. set->contents[%d][%s]\n",
						opaque, i, handle);
			xen_host_metrics_record_free(host_metrics_record);
		}
	} else {
		print_error(session);
	}
	xen_host_metrics_set_free(host_metrics_set);

	printf("\n==============================================\n\n");
}
Esempio n. 2
0
static CMPIrc memorypool_set_properties(
    provider_resource *resource,
    CMPIInstance *inst
    )
{
    local_host_resource *ctx = resource->ctx;
    char buf[MAX_INSTANCEID_LEN];
    int prop_val_32;
    xen_host_metrics_record *host_metrics_rec = NULL;

    if (ctx->host_rec->metrics->is_record)
        host_metrics_rec = ctx->host_rec->metrics->u.record;
    else
        xen_host_metrics_get_record(resource->session->xen, &host_metrics_rec, ctx->host_rec->metrics->u.handle);

    _CMPICreateNewDeviceInstanceID(buf, MAX_INSTANCEID_LEN, ctx->host_rec->uuid, "MemoryPool");
    CMSetProperty(inst, "InstanceID", (CMPIValue *)buf, CMPI_chars);
    CMSetProperty(inst, "PoolID", (CMPIValue *)ctx->host_rec->uuid, CMPI_chars);

    int type = DMTF_ResourceType_Memory;
    CMSetProperty(inst, "ResourceType", (CMPIValue *)&type, CMPI_uint16);
    CMSetProperty(inst, "ResourceSubType", (CMPIValue *) "Xen Memory", CMPI_chars);
    CMSetProperty(inst, "AllocationUnits", (CMPIValue *)"Bytes", CMPI_chars);

    CMSetProperty(inst, "Capacity",(CMPIValue *)&(host_metrics_rec->memory_total), CMPI_uint64);
    CMSetProperty(inst, "Caption", (CMPIValue *)"Xen Virtual Memory Pool", CMPI_chars);
    CMSetProperty(inst, "Description", (CMPIValue *)"Xen Virtual Memory Pool", CMPI_chars);
    CMSetProperty(inst, "ElementName", (CMPIValue *)ctx->host_rec->name_label, CMPI_chars);
    prop_val_32 = DMTF_HealthState_OK;
    CMSetProperty(inst, "HealthState", (CMPIValue *)&prop_val_32, CMPI_uint16);
    //CMSetProperty(inst, "InstallDate", (CMPIValue *)installDate, CMPI_dateTime);
    CMSetProperty(inst, "Name", (CMPIValue *)"Xen Virtual Memory Pool", CMPI_chars);
    prop_val_32 = DMTF_OperationalStatus_OK;
    CMPIArray *arr = CMNewArray(resource->broker, 1, CMPI_uint16, NULL);
    CMSetArrayElementAt(arr, 0, (CMPIValue *)&prop_val_32, CMPI_uint16);
    CMSetProperty(inst, "OperationalStatus", (CMPIValue *) &arr, CMPI_uint16A);
    //CMSetProperty(inst, "OtherResourceType", (CMPIValue *)other_resource_type, CMPI_String);

    prop_val_32 = 1;
    CMSetProperty(inst, "Primordial" , (CMPIValue *)&prop_val_32, CMPI_boolean);
    //CMSetProperty(inst, "Status", (CMPIValue *)status, CMPI_chars);
    // CMSetProperty(inst, "StatusDescriptions", (CMPIValue *)status_descs, CMPI_chars);

    int64_t reserved = host_metrics_rec->memory_total - host_metrics_rec->memory_free;
    CMSetProperty(inst, "Reserved", (CMPIValue *)&reserved, CMPI_uint64);
    // CMSetProperty(inst, "Unreservable", (CMPIValue *)unreservable, CMPI_uint16);

    if (!ctx->host_rec->metrics->is_record)
        xen_host_metrics_record_free(host_metrics_rec);

    return CMPI_RC_OK;
}
Esempio n. 3
0
static CMPIrc hostmemory_set_properties(
    provider_resource *resource,
    CMPIInstance *inst
    )
{
    char buf[MAX_INSTANCEID_LEN];
    local_host_resource *ctx = resource->ctx;
    _CMPICreateNewDeviceInstanceID(buf, sizeof(buf), ctx->host_rec->uuid, "Memory");
    CMSetProperty(inst, "DeviceID",(CMPIValue *)buf, CMPI_chars);
    CMSetProperty(inst, "CreationClassName",(CMPIValue *)"Xen_HostMemory", CMPI_chars);
    CMSetProperty(inst, "SystemCreationClassName",(CMPIValue *)"Xen_HostComputerSystem", CMPI_chars);
    CMSetProperty(inst, "SystemName",(CMPIValue *)ctx->host_rec->uuid, CMPI_chars);

    xen_host_metrics_record *metrics_rec = NULL;
    if (ctx->host_rec->metrics->is_record)
        metrics_rec = ctx->host_rec->metrics->u.record;
    else
        xen_host_metrics_get_record(resource->session->xen, &metrics_rec, ctx->host_rec->metrics->u.handle);

    /* Populate the instance's properties with the backend data */

    //CMSetProperty(inst, "Access",(CMPIValue *)&<value>, CMPI_uint16);
    //CMPIArray *arr = CMNewArray(_BROKER, 1, CMPI_uint16, NULL);
    //CMSetArrayElementAt(arr, 0, (CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "AdditionalAvailability",(CMPIValue *)&arr, CMPI_uint16A);
    //CMPIArray *arr = CMNewArray(_BROKER, 1, CMPI_uint8, NULL);
    //CMSetArrayElementAt(arr, 0, (CMPIValue *)&<value>, CMPI_uint8);
    //CMSetProperty(inst, "AdditionalErrorData",(CMPIValue *)&arr, CMPI_uint8A);
    //CMSetProperty(inst, "Availability",(CMPIValue *)&<value>, CMPI_uint16);
    uint64_t blockSize = 1;
    CMSetProperty(inst, "BlockSize",(CMPIValue *)&blockSize, CMPI_uint64);
    CMSetProperty(inst, "Caption",(CMPIValue *)"Xen Host Memory", CMPI_chars);
    CMSetProperty(inst, "ConsumableBlocks",(CMPIValue *)&metrics_rec->memory_free, CMPI_uint64);
    //CMSetProperty(inst, "CorrectableError",(CMPIValue *)&<value>, CMPI_boolean);
    //CMSetProperty(inst, "DataOrganization",(CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "DataRedundancy",(CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "DeltaReservation",(CMPIValue *)&<value>, CMPI_uint8);
    CMSetProperty(inst, "Description",(CMPIValue *)ctx->host_rec->name_description, CMPI_chars);
    CMSetProperty(inst, "ElementName",(CMPIValue *)ctx->host_rec->name_label, CMPI_chars);
    //CMSetProperty(inst, "EnabledDefault",(CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "EnabledState",(CMPIValue *)&<value>, CMPI_uint16);
    CMSetProperty(inst, "EndingAddress",(CMPIValue *)&metrics_rec->memory_total, CMPI_uint64);
    //CMSetProperty(inst, "ErrorAccess",(CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "ErrorAddress",(CMPIValue *)&<value>, CMPI_uint64);
    //CMSetProperty(inst, "ErrorCleared",(CMPIValue *)&<value>, CMPI_boolean);
    //CMPIArray *arr = CMNewArray(_BROKER, 1, CMPI_uint8, NULL);
    //CMSetArrayElementAt(arr, 0, (CMPIValue *)&<value>, CMPI_uint8);
    //CMSetProperty(inst, "ErrorData",(CMPIValue *)&arr, CMPI_uint8A);
    //CMSetProperty(inst, "ErrorDataOrder",(CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "ErrorDescription",(CMPIValue *)<value>, CMPI_chars);
    //CMSetProperty(inst, "ErrorInfo",(CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "ErrorMethodology",(CMPIValue *)<value>, CMPI_chars);
    //CMSetProperty(inst, "ErrorResolution",(CMPIValue *)&<value>, CMPI_uint64);
    //CMPIDateTime *date_time = xen_utils_time_t_to_CMPIDateTime(_BROKER, <time_value>);
    //CMSetProperty(inst, "ErrorTime",(CMPIValue *)&date_time, CMPI_dateTime);
    //CMSetProperty(inst, "ErrorTransferSize",(CMPIValue *)&<value>, CMPI_uint32);
    //CMPIArray *arr = CMNewArray(_BROKER, 1, CMPI_uint16, NULL);
    //CMSetArrayElementAt(arr, 0, (CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "ExtentStatus",(CMPIValue *)&arr, CMPI_uint16A);
    //CMSetProperty(inst, "HealthState",(CMPIValue *)&<value>, CMPI_uint16);
    //CMPIArray *arr = CMNewArray(_BROKER, 1, CMPI_chars, NULL);
    //CMSetArrayElementAt(arr, 0, (CMPIValue *)<value>, CMPI_chars);
    //CMSetProperty(inst, "IdentifyingDescriptions",(CMPIValue *)&arr, CMPI_charsA);
    //CMPIDateTime *date_time = xen_utils_time_t_to_CMPIDateTime(_BROKER, <time_value>);
    //CMSetProperty(inst, "InstallDate",(CMPIValue *)&date_time, CMPI_dateTime);
    //CMSetProperty(inst, "IsBasedOnUnderlyingRedundancy",(CMPIValue *)&<value>, CMPI_boolean);
    //CMSetProperty(inst, "LastErrorCode",(CMPIValue *)&<value>, CMPI_uint32);
    //CMSetProperty(inst, "MaxQuiesceTime",(CMPIValue *)&<value>, CMPI_uint64);
    //CMSetProperty(inst, "Name",(CMPIValue *)<value>, CMPI_chars);
    //CMSetProperty(inst, "NameFormat",(CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "NameNamespace",(CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "NoSinglePointOfFailure",(CMPIValue *)&<value>, CMPI_boolean);
    CMSetProperty(inst, "NumberOfBlocks",(CMPIValue *)&metrics_rec->memory_total, CMPI_uint64);
    //CMPIArray *arr = CMNewArray(_BROKER, 1, CMPI_uint16, NULL);
    //CMSetArrayElementAt(arr, 0, (CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "OperationalStatus",(CMPIValue *)&arr, CMPI_uint16A);
    //CMSetProperty(inst, "OtherEnabledState",(CMPIValue *)<value>, CMPI_chars);
    //CMSetProperty(inst, "OtherErrorDescription",(CMPIValue *)<value>, CMPI_chars);
    //CMPIArray *arr = CMNewArray(_BROKER, 1, CMPI_chars, NULL);
    //CMSetArrayElementAt(arr, 0, (CMPIValue *)<value>, CMPI_chars);
    //CMSetProperty(inst, "OtherIdentifyingInfo",(CMPIValue *)&arr, CMPI_charsA);
    //CMSetProperty(inst, "OtherNameFormat",(CMPIValue *)<value>, CMPI_chars);
    //CMSetProperty(inst, "OtherNameNamespace",(CMPIValue *)<value>, CMPI_chars);
    //CMSetProperty(inst, "PackageRedundancy",(CMPIValue *)&<value>, CMPI_uint16);
    //CMPIArray *arr = CMNewArray(_BROKER, 1, CMPI_uint16, NULL);
    //CMSetArrayElementAt(arr, 0, (CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "PowerManagementCapabilities",(CMPIValue *)&arr, CMPI_uint16A);
    //CMSetProperty(inst, "PowerManagementSupported",(CMPIValue *)&<value>, CMPI_boolean);
    //CMSetProperty(inst, "PowerOnHours",(CMPIValue *)&<value>, CMPI_uint64);
    bool primordial = true;
    CMSetProperty(inst, "Primordial",(CMPIValue *)&primordial, CMPI_boolean);
    //CMSetProperty(inst, "Purpose",(CMPIValue *)<value>, CMPI_chars);
    //CMSetProperty(inst, "RequestedState",(CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "SequentialAccess",(CMPIValue *)&<value>, CMPI_boolean);
    uint64_t startingAddress = 0;
    CMSetProperty(inst, "StartingAddress",(CMPIValue *)&startingAddress, CMPI_uint64);
    CMSetProperty(inst, "Status",(CMPIValue *)DMTF_Status_OK, CMPI_chars);
    //CMPIArray *arr = CMNewArray(_BROKER, 1, CMPI_chars, NULL);
    //CMSetArrayElementAt(arr, 0, (CMPIValue *)<value>, CMPI_chars);
    //CMSetProperty(inst, "StatusDescriptions",(CMPIValue *)&arr, CMPI_charsA);
    //CMSetProperty(inst, "StatusInfo",(CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "SystemLevelAddress",(CMPIValue *)&<value>, CMPI_boolean);
    //CMPIDateTime *date_time = xen_utils_time_t_to_CMPIDateTime(_BROKER, <time_value>);
    //CMSetProperty(inst, "TimeOfLastStateChange",(CMPIValue *)&date_time, CMPI_dateTime);
    //CMSetProperty(inst, "TotalPowerOnHours",(CMPIValue *)&<value>, CMPI_uint64);
    //CMSetProperty(inst, "Volatile",(CMPIValue *)&<value>, CMPI_boolean);

    if (!ctx->host_rec->metrics->is_record)
        xen_host_metrics_record_free(metrics_rec);

    return CMPI_RC_OK;
}
Esempio n. 4
0
static CMPIrc host_set_properties(
    provider_resource *resource, 
    CMPIInstance *inst
    )
{
    local_host_resource *ctx = (local_host_resource *)resource->ctx;

    /* Key properties to be filled in */
    CMSetProperty(inst, "Name",(CMPIValue *)ctx->host_rec->uuid, CMPI_chars);
    CMSetProperty(inst, "CreationClassName",(CMPIValue *)"Xen_HostComputerSystem", CMPI_chars);

    xen_host_metrics metrics = NULL;
    xen_host_get_metrics(resource->session->xen, &metrics, ctx->host);
    xen_host_metrics_record *metrics_rec = NULL;
    if (metrics) {
        xen_host_metrics_get_record(resource->session->xen, &metrics_rec, metrics);
        xen_host_metrics_free(metrics);
    }

    /* Populate the instance's properties with the backend data */
    _set_allowed_operations(resource->broker, ctx->host_rec, inst, "AvailableRequestedStates");

    /* Check other-config (as a cache) */
    char *CN = NULL;
    CN = xen_utils_get_from_string_string_map(ctx->host_rec->other_config, "host_cn");
    /* Did not find the CN in the cache, call out to plugin */
    if (CN) {
        _SBLIM_TRACE(_SBLIM_TRACE_LEVEL_DEBUG,("CN back from other_config = %s for host %s", CN, ctx->host));
        CMSetProperty(inst, "CN", (CMPIValue *)CN, CMPI_chars);
    } else {
        /* Get CN name by calling a plugin on the Host */
        //char *CN = NULL;
        xen_string_string_map *args = xen_string_string_map_alloc(0);
        xen_host_call_plugin(resource->session->xen, &CN, ctx->host, "xscim", "read_host_cn", args);
        xen_string_string_map_free(args);
        _SBLIM_TRACE(_SBLIM_TRACE_LEVEL_DEBUG,("CN name back from plugin = %s for host %s", CN, ctx->host));
        /* Update the other_config cache */
        xen_host_add_to_other_config(resource->session->xen, ctx->host, "host_cn", CN);
        CMSetProperty(inst, "CN", (CMPIValue *)CN, CMPI_chars);
	// Only need to free CN here because we have made the plugin call.
	// If we've taken the value from the cache it will be free'd when
	// ctx->host_rec is free'd.
        if (CN)
          free(CN);
    } 

    CMSetProperty(inst, "Caption",(CMPIValue *)"XenServer Host", CMPI_chars);
    DMTF_Dedicated dedicated = DMTF_Dedicated_Other;
    CMPIArray *arr = CMNewArray(resource->broker, 1, CMPI_uint16, NULL);
    CMSetArrayElementAt(arr, 0, (CMPIValue *)&dedicated, CMPI_uint16);
    CMSetProperty(inst, "Dedicated",(CMPIValue *)&arr, CMPI_uint16A);
    CMSetProperty(inst, "Description",(CMPIValue *)ctx->host_rec->name_description, CMPI_chars);
    CMSetProperty(inst, "ElementName",(CMPIValue *)ctx->host_rec->name_label, CMPI_chars);
    DMTF_EnabledDefault eDefault = DMTF_EnabledDefault_Enabled;
    CMSetProperty(inst, "EnabledDefault",(CMPIValue *)&eDefault, CMPI_uint16);
    DMTF_EnabledState eState = DMTF_EnabledState_Enabled;
    if (!ctx->host_rec->enabled)
        eState = DMTF_EnabledState_Enabled_but_Offline;
    CMSetProperty(inst, "EnabledState",(CMPIValue *)&eState, CMPI_uint16);
    DMTF_HealthState hState = DMTF_HealthState_OK;
    CMSetProperty(inst, "HealthState",(CMPIValue *)&hState, CMPI_uint16);
    //CMPIDateTime *date_time = xen_utils_time_t_to_CMPIDateTime(resource->broker, <time_value>);
    //CMSetProperty(inst, "InstallDate",(CMPIValue *)&date_time, CMPI_dateTime);
    CMSetProperty(inst, "NameFormat",(CMPIValue *)DMTF_NameFormat_Other, CMPI_chars);
    DMTF_OperationalStatus opStatus = DMTF_OperationalStatus_OK;
    if (!ctx->host_rec->enabled)
        opStatus = DMTF_OperationalStatus_Stopped;
    CMPIArray *opStatusArr = CMNewArray(resource->broker, 1, CMPI_uint16, NULL);
    CMSetArrayElementAt(opStatusArr, 0, (CMPIValue *)&opStatus, CMPI_uint16);
    CMSetProperty(inst, "OperationalStatus",(CMPIValue *)&opStatusArr, CMPI_uint16A);
    //CMPIArray *arr = CMNewArray(resource->broker, 1, CMPI_chars, NULL);
    //CMSetArrayElementAt(arr, 0, (CMPIValue *)<value>, CMPI_chars);
    //CMSetProperty(inst, "OtherDedicatedDescriptions",(CMPIValue *)&arr, CMPI_charsA);
    //CMSetProperty(inst, "OtherEnabledState",(CMPIValue *)<value>, CMPI_chars);
    arr = xen_utils_convert_string_string_map_to_CMPIArray(resource->broker, ctx->host_rec->other_config);
    if(arr)
        CMSetProperty(inst, "OtherConfig",(CMPIValue *)&arr, CMPI_stringA);
    CMPIArray *otheridinfo = CMNewArray(resource->broker, 4, CMPI_chars, NULL);
    char* brand = xen_utils_get_from_string_string_map(ctx->host_rec->software_version, "product_brand");
    char* version = xen_utils_get_from_string_string_map(ctx->host_rec->software_version, "product_version");
    char* build = xen_utils_get_from_string_string_map(ctx->host_rec->software_version, "build_number");
    CMSetArrayElementAt(otheridinfo, 0, (CMPIValue *)ctx->host_rec->address, CMPI_chars);
    CMSetArrayElementAt(otheridinfo, 1, (CMPIValue *)brand, CMPI_chars);
    CMSetArrayElementAt(otheridinfo, 2, (CMPIValue *)version, CMPI_chars);
    CMSetArrayElementAt(otheridinfo, 3, (CMPIValue *)build, CMPI_chars);
    CMSetProperty(inst, "OtherIdentifyingInfo",(CMPIValue *)&otheridinfo, CMPI_charsA);
    CMPIArray *iddesc = CMNewArray(resource->broker, 4, CMPI_chars, NULL);
    CMSetArrayElementAt(iddesc, 0, (CMPIValue *)"IPv4Address", CMPI_chars);
    CMSetArrayElementAt(iddesc, 1, (CMPIValue *)"ProductBrand", CMPI_chars);
    CMSetArrayElementAt(iddesc, 2, (CMPIValue *)"ProductVersion", CMPI_chars);
    CMSetArrayElementAt(iddesc, 3, (CMPIValue *)"BuildNumber", CMPI_chars);
    CMSetProperty(inst, "IdentifyingDescriptions",(CMPIValue *)&iddesc, CMPI_charsA);

    //CMPIArray *arr = CMNewArray(resource->broker, 1, CMPI_uint16, NULL);
    //CMSetArrayElementAt(arr, 0, (CMPIValue *)&<value>, CMPI_uint16);
    //CMSetProperty(inst, "PowerManagementCapabilities",(CMPIValue *)&arr, CMPI_uint16A);
    char *owner = xen_utils_get_from_string_string_map(ctx->host_rec->other_config, "owner");
    char *ownercontact = xen_utils_get_from_string_string_map(ctx->host_rec->other_config, "ownercontact");
    if (owner)
        CMSetProperty(inst, "PrimaryOwnerName",(CMPIValue *)owner, CMPI_chars);
    if (ownercontact)
        CMSetProperty(inst, "PrimaryOwnerContact",(CMPIValue *)ownercontact, CMPI_chars);
    DMTF_RequestedState rState = DMTF_RequestedState_Enabled;

    CMSetProperty(inst, "RequestedState",(CMPIValue *)&rState, CMPI_uint16);
    //CMSetProperty(inst, "ResetCapability",(CMPIValue *)&<value>, CMPI_uint16);
    char *serverrole = xen_utils_get_from_string_string_map(ctx->host_rec->other_config, "role");
    if (serverrole) {
        CMPIArray *rolesarr = CMNewArray(resource->broker, 1, CMPI_chars, NULL);
        CMSetArrayElementAt(rolesarr, 0, (CMPIValue *)serverrole, CMPI_chars);
        CMSetProperty(inst, "Roles",(CMPIValue *)&rolesarr, CMPI_charsA);
    }

    if (ctx->host_rec->other_config) {
        char *val = xen_utils_get_from_string_string_map(ctx->host_rec->other_config, "boot_time");
        if (val) {
            time_t time = atol(val);
            CMPIDateTime *start_time = xen_utils_time_t_to_CMPIDateTime(resource->broker, time);
            if (start_time) CMSetProperty(inst, "StartTime",(CMPIValue *)&start_time, CMPI_dateTime);
        }
    }
    CMSetProperty(inst, "Status",(CMPIValue *)DMTF_Status_OK, CMPI_chars);
    //CMPIArray *arr = CMNewArray(resource->broker, 1, CMPI_chars, NULL);
    //CMSetArrayElementAt(arr, 0, (CMPIValue *)<value>, CMPI_chars);
    //CMSetProperty(inst, "StatusDescriptions",(CMPIValue *)&arr, CMPI_charsA);
    if (metrics_rec && (metrics_rec->last_updated != 0)) {
        CMPIDateTime *install_time = xen_utils_time_t_to_CMPIDateTime(resource->broker, metrics_rec->last_updated);
        CMSetProperty(inst, "TimeOfLastStateChange",(CMPIValue *)&install_time, CMPI_dateTime);
    }

    /* properties to indicate hosts's time zone. We compute local time zone on this 
    host and assume all hosts are in the same zone since xapi doest report the time zone at this time */
    time_t now = time(NULL);
    struct tm tmnow;
    localtime_r(&now, &tmnow);
    CMSetProperty(inst, "TimeOffset", (CMPIValue *)&tmnow.tm_gmtoff, CMPI_sint32);

    if (metrics_rec)
        xen_host_metrics_record_free(metrics_rec);
    return CMPI_RC_OK;
}