libxl to json return string
Hi,
I have an example attached below where I believe that libxl_physinfo_to_json() does not return all of the correct output. physinfo.c is the C program that outputs the json string. physc.out is the output that I recieved. physgo.out is the output I get using the golang bindings I'm creating for xenlight. The missing fields are :scrub_pages, outstanding_pages, sharing_freed_pages,sharing_used_frames, the last 4 indices of hw_cap, cap_hvm, and cap_hvm_directio
I had a similar problem with libxl_dominfo_to_json() where some data fields were not added to the string.
It was said on the IRC channel that default values are not converted to json, but is there a way to tell what is the default value for a data field?
Thanks!
Ronald Rojas
{
"threads_per_core": 1,
"cores_per_socket": 4,
"max_cpu_id": 3,
"nr_cpus": 4,
"cpu_khz": 3198157,
"total_pages": 4179453,
"free_pages": 32702,
"nr_nodes": 1,
"hw_cap": [
3085695999,
2012935103,
739248128,
33
]
}{
"Threads_per_core": 1,
"Cores_per_socket": 4,
"Max_cpu_id": 3,
"Nr_cpus": 4,
"Cpu_khz": 3198157,
"Total_pages": 4179453,
"Free_pages": 32702,
"Scrub_pages": 0,
"Outstanding_pages": 0,
"Sharing_freed_pages": 0,
"Sharing_used_frames": 0,
"Nr_nodes": 1,
"Hw_cap": [
3085695999,
2012935103,
739248128,
33,
1,
10155,
0,
256
],
"Cap_hvm": false,
"Cap_hvm_directio": false
}
#include <stdio.h>
#include <stdlib.h>
#include <libxl.h>
char * main(){
libxl_ctx *context;
libxl_ctx_alloc(&context,LIBXL_VERSION, 0, NULL);
libxl_physinfo info ;
int err= libxl_get_physinfo(context,&info );
if(err != 0){
return NULL;
}
char * json= libxl_physinfo_to_json(context, &info);
libxl_ctx_free(context);
return json;}
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel