On 06/06/2012 04:02 PM, Anil Vettathu wrote:
Hi
I am writing a small python script to get the name of all the VMs
that matches a string.
==========
import sys
import getopt
import optparse
import os
import time
from ovirtsdk.api import API
from ovirtsdk.xml import params
URL='https://192.168.1.1:8443/api'
#RHEVM API ACCESS URL
USERNAME='admin@internal'
PASSWORD='ovirt'
api=API(url=URL, username=USERNAME, password=PASSWORD)
vmnames = api.vms.list(query = 'name=a')
print vmnames
you print the vm object you get, while you need to print the "name"
field:
print
vmnames.name
_______________________________________________
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users
--
Thanks,
Rami Vaknin, QE @ Red Hat, TLV, IL.