[libvirt-users] creating a domain

Daniel P. Berrange berrange at redhat.com
Thu May 10 09:10:14 UTC 2012


On Thu, May 10, 2012 at 12:00:17PM +0300, Henrik Ahlgren wrote:
> On Wed, May 09, 2012 at 02:26:47PM -0700, John Wayne wrote:
> > looks like i have to use virDomain.create, however virDomain.create
> > needs a defined domain xmldesc as a parameter and i am not sure on how to get that
> 
> Have you tried one of these?
> 
>   lookupByID(self, id)
>       Try to find a domain based on the hypervisor ID number
>       Note that this won't work for inactive domains which have
>       an ID of -1,
>       in that case a lookup based on the Name or UUId need to be
>       done instead.
>   
>   lookupByName(self, name)
>       Try to lookup a domain on the given hypervisor based on
>       its name.
>   
>   lookupByUUID(self, uuid)
>       Try to lookup a domain on the given hypervisor based on
>       its UUID.
>   
>   lookupByUUIDString(self, uuidstr)
>       Try to lookup a domain on the given hypervisor based on
>       its UUID.

Quick python tip... you can get a list of valid APIs from the
interpretor:

$ python
import libvirt
print dir(libvirt)
...snip output...
conn = libvirt.open("qemu:///session")
print dir(conn)
...snip output...
print help(conn.lookupByID)
...snip output...

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvirt-users mailing list