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

Re: [Xen-API] Error with VIF_METRICS


  • To: Luiz Roberto <kiko@xxxxxxxxxxxxxxxxx>, "xen-api@xxxxxxxxxxxxx" <xen-api@xxxxxxxxxxxxx>
  • From: John Else <john.else@xxxxxxxxxx>
  • Date: Thu, 28 Jun 2012 09:44:00 +0100
  • Accept-language: en-US
  • Acceptlanguage: en-US
  • Delivery-date: Thu, 28 Jun 2012 08:44:02 +0000
  • List-id: User and development list for XCP and XAPI <xen-api.lists.xen.org>
  • Thread-index: Ac1S495augjDfJ0PRTel3tA1YeVvBACJB0yA
  • Thread-topic: [Xen-API] Error with VIF_METRICS

Hi Luiz,

 

The VIF_metrics is a separate object from the VIF itself – my perl is not very good, but in python I’d do something like this:

 

vms = session.xenapi.VM.get_all()

 

for vm in vms:

                vm_record = session.xenapi.VM.get_record(vm)

                if record[“is_a_template”] == False and record[“is_control_domain”] == False:

                                for vif in vm_record[“VIFs”]:

                                                metrics = session.xenapi.VIF.get_metrics(vif)

                                                if metrics != “OpaqueRef:NULL”:

                                                                metrics_record = session.xenapi.VIF_metrics.get_record(metrics)

                                                                # do something with metrics_record…

 

John

 

From: xen-api-bounces@xxxxxxxxxxxxx [mailto:xen-api-bounces@xxxxxxxxxxxxx] On Behalf Of Luiz Roberto
Sent: 25 June 2012 16:02
To: xen-api@xxxxxxxxxxxxx
Subject: [Xen-API] Error with VIF_METRICS

 

Hello everybody,

I need to get VIF_metrics from a specific VM and I got a problem while trying to do that.

(HANDLE_INVALID VIF_metrics OpaqueRef:f71830ff-301b-77a8-37e9-f4c4aaa2905b)

It is very strange, I never got this error before.
Take a look on my code:

$vms_array = $xenserver->VM_get_all();

foreach ($vms_array as $vm) {
    $record = $xenserver->VM_get_record($vm);
    if($record['is_a_template']==false && $record['is_control_domain']==false) {

        var_dump($record['VIFs']); //Return :  0 => string 'OpaqueRef:f71830ff-301b-77a8-37e9-f4c4aaa2905b' (length=46)

        foreach($record['VIFs'] as $vif) {
            $metrics = $xenserver->__call('VIF_metrics.get_record',array($vif) ));
            var_dump($metrics);
        }
    }
}

I tried many values as parameter but no success...

Anybody here knows what is this problem?
Thanks

_______________________________________________
Xen-api mailing list
Xen-api@xxxxxxxxxxxxx
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api

 


Rackspace

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