This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


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

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] Xen Api - c++ vif metrics
From: LiveShell <liveshell@xxxxxxxxx>
Date: Mon, 23 May 2011 13:43:21 +0530
Delivery-date: Mon, 23 May 2011 01:13:35 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=PfYqIUvb9eh85P7Hud6dObJ5LmWiOo4ooMNyiJJ9EdA=; b=GgSV6Qy926cKEnMS4Xu6XGIhndCejkFofz+D2+incaQbAD2GpJGkIbeE7WyybLwm05 1g2dOFnxxo27k1PwmV4fvh0zDcNch9ldtjKxt6hq7YcNRyL5nT/u1FL9d1OYv7LClWsO gWL7O8nTE1kthijUa2PQcQoWLFSqNvRB2uZB0=
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=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
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);
       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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] Xen Api - c++ vif metrics, LiveShell <=