[libvirt-users] nparams in virNodeGetCPUStats and CPU utilization
by Hari Pyla
Hi,
I am trying to get the CPU utilization of a node and I am using
virNodeGetCPUStats(...)
Here is my code snippet. The error checking is omitted for brevity.
/* get the number of params */
retval = virNodeGetCPUStats (conn, VIR_NODE_CPU_STATS_ALL_CPUS,\
NULL, &nparams, 0);
printf ("nparams: %d\n", nparams);
/* allocate space for the params */
params = (virNodeCPUStatsPtr *) malloc (sizeof (virNodeCPUStats) *
nparams );
/* get the values */
retval = virNodeGetCPUStats (conn, VIR_NODE_CPU_STATS_ALL_CPUS,\
params, &nparams, 0);
for ( i = 0 ; i < nparams ; i++)
{
printf ("params[%d].field: %s \tparams[%d].value: %llu\n",
i, params[i].field, i, params[i].value);
}
output:
nparams: 4
params[0].field: kernel params[0].value: 77930000000
params[1].field: user params[1].value: 568270000000
params[2].field: idle params[2].value: 471429230000000
params[3].field: iowait params[3].value: 67100000000
The documentation at http://libvirt.org/html/libvirt-libvirt.html on the
virNodeGetCPUStats(...) API says that nparams is dynamic. Does that mean
that not all
params are available for a node? I was hoping that nparams would be 5
and that params[4]
would contain the utilization (VIR_NODE_CPU_STATS_UTILIZATION).
If the answer to the above is 'yes'. Then, I was wondering as to what
would be the
correct way to calculate the CPU utilization of a node?.
Thanks,
--Hari
11 years, 8 months
[libvirt-users] XML error: missing security model on virsh migrate
by Hari Pyla
Hi,
I am trying to migrate a VM from one node to another and I get the
following error message.
[user@n0 ~]$ virsh --c qemu:///system migrate --verbose
Fedora-17-x86_64-1 qemu+ssh://n1/system
error: XML error: missing security model when using multiple labels
On both the src and dest nodes, I've disabled SELinux and I have the
following libvirt version installed
$virsh --connect qemu:///system version --daemon
Compiled against library: libvirt 0.10.2
Using library: libvirt 0.10.2
Using API: QEMU 0.10.2
Running hypervisor: QEMU 0.12.1
Running against daemon: 0.10.2
Any help is greatly appreciated.
Thanks,
--Hari
11 years, 8 months