Hi all,
I am using Xen C++ Api to connect to remote Xen server and get vif metrics of a vm. But value 0 is returned for both read io and write io, while the performance graph from XenServer interface shows me non 0 value...
Following is the function which I am using to get vif parameter of VM. I have included error handling but control never goes to error condition... Can any body suggest me what is the problem here...
Is it because, I am connecting to remote server or problem with the way I am using Api ? Does Xen Api C++ support remote connection?
bool GetVMNwUtilisation(xen_vm vm, double& dreadIO, double& dwriteIO)
{ xen_vif_set* vif_set = new xen_vif_set[MAX_VIF_SIZE]; if(!(xen_vm_get_vifs(m_session, &vif_set, vm)))
{ cout << "Failed to get VM VIF " << endl; return false; }
double readIO = 0.0, double writeIO = 0.0;
for(int i=0; i<vif_set->size; i++) {
xen_vif vif = vif_set->contents[i]; bool bAttached=false; xen_vif_get_currently_attached(m_session, &bAttached, vif);
if(bAttached) { xen_vif_metrics vif_metrics;
if(!(xen_vif_get_metrics(m_session, &vif_metrics, vif))) {
cout << "Err in xen_vif_get_metrics" << endl; return false;
} if (!(xen_vif_metrics_get_io_read_kbs(m_session,&readIO,vif_metrics)))
{ cout << "Err in xen_vif_metrics_get_io_read_kbs" << endl;
return false; }
if (!(xen_vif_metrics_get_io_write_kbs(m_session,&writeIO,vif_metrics))) {
cout << "Err in xen_vif_metrics_get_io_write_kbs" << endl;
return false; } dreadIO += readIO;
dwriteIO += writeIO; } }
cout << "Read IO : " << dreadIO << " Write IO " << dwriteIO << endl;
}
-- Life is like an Ice Cream, Enjoy it before it melts...
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
|