Пример #1
0
// automatically generated. Do not modify
static void testHostCpus(xen_session *session) {
	printf("\nGet all the  HostCpu Records\n");

	xen_host_cpu_set *host_cpu_set;
	bool d = xen_host_cpu_get_all(session, &host_cpu_set);
	if (d) {
		size_t i = 0;
		for (; i < host_cpu_set->size; ++i) {
			xen_host_cpu_record *host_cpu_record;
			xen_host_cpu_get_record(session, &host_cpu_record,
					host_cpu_set->contents[i]);
			char *handle = (char*) host_cpu_record->handle;
			char *opaque = (char*) host_cpu_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_cpu_record_free(host_cpu_record);
		}
	} else {
		print_error(session);
	}
	xen_host_cpu_set_free(host_cpu_set);

	printf("\n==============================================\n\n");
}
Пример #2
0
/********************************************************
 * Function to enumerate provider specific resource
 *
 * @param session - handle to a xen_utils_session object
 * @param resources - pointer to the provider_resource_list
 *   object, the provider specific resource defined above
 *   is a member of this struct
 * @return CMPIrc error codes
 ********************************************************/
static CMPIrc xen_resource_list_enum(
    xen_utils_session *session, 
    provider_resource_list *resources
    )
{
    xen_host_cpu_set *cpu_set = NULL;
    if(!xen_host_cpu_get_all(session->xen, &cpu_set))
        return CMPI_RC_ERR_FAILED;
    resources->ctx = cpu_set;
    return CMPI_RC_OK;
}