[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] Xen Api - c++ vif metrics


  • To: xen-api@xxxxxxxxxxxxxxxxxxx
  • From: LiveShell <liveshell@xxxxxxxxx>
  • Date: Mon, 23 May 2011 13:43:21 +0530
  • Delivery-date: Mon, 23 May 2011 01:13:35 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=l5+mhzdopxJQ+x1fNFhtE9q1mnSONIXYxgtCGczHKKuMleAfRFC4PRpfm/F4EAIE/3 cxMkaWiRco7QZHfdqt8lUiLXD4s07psvFQxKL4h9sz4cg6uw7MNNjmkQGbiQWDpkjm1y Y3Rmbk3XtPCYoFfYwUYkejA26aow1H5jdBmZU=
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.