hi:

Actually, openstack just write some wrappers around libvirt api, together with some logic related to openstack itself.

for example:

    def _lookup_by_name(self, instance_name):
        """Retrieve libvirt domain object given an instance name.

        All libvirt error handling should be handled in this method and
        relevant nova exceptions should be raised in response.

        """
        try:
            return self._conn.lookupByName(instance_name)
        except libvirt.libvirtError as ex:
            error_code = ex.get_error_code()
            if error_code == libvirt.VIR_ERR_NO_DOMAIN:
                raise exception.InstanceNotFound(instance_id=instance_name)

            msg = _("Error from libvirt while looking up %(instance_name)s: "
                    "[Error Code %(error_code)s] %(ex)s") % locals()
            raise exception.NovaException(msg)

self._conn is libvirt connection.

By the way, openstack support multiple virtualization drivers, libvirt is only one of them.

I think you can treat openstack libvirt api as a reference, then modify libvirt api to suite your needs.

Thanks.

On 11/12/2012 10:07 AM, ÐûÃúÒÕ wrote:
Thanks all:
And another question : is openstack libvirt-python rewrited by openstack developers?

here is the openstack libvirt-python doc:

http://wiki.openstack.org/LibvirtAPI

If you install openstack with devstack by default.
You can find the lib in /opt/stack/nova/nova/virt/libvirt
It has these files,but not one file named libvirt.py
"""
root@c65:/opt/stack/nova/nova/virt/libvirt# ls *.py
config.py    imagebackend.py  snapshots.py  volume_nfs.py
driver.py    imagecache.py    utils.py      volume.py
firewall.py  __init__.py      vif.py
"""

I think I may use it.
 

2012/11/12 Xiao Hanyu <hanyu.xiao@eayun.com>
hi:

Matbe there's no libvirt python api document. You can lookup the api directly from the libvirt.py file.

In my machine, libvirt.py is located at /usr/lib/python2.7/site-packages/libvirt.py.

And, you can lookup the ruby api and c api for a reference, most of them are the same name.

Thanks.


On 11/12/2012 09:34 AM, ÐûÃúÒÕ wrote:
Hi libvirt users:

Who can tell me where is the fucking doc?
I want to use libvirt-python in my project.But I can't found the doc.
I only found "TBD" in http://libvirt.org/guide/html/Application_Development_Guide-Language_Bindings.html
Did I miss something?

Thanks.

--
Ó£±¦±¦: http://www.xuanmingyi.com



_______________________________________________
libvirt-users mailing list
libvirt-users@redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-users

-- 

Hanyu Xiao
Eayun.com

_______________________________________________
libvirt-users mailing list
libvirt-users@redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-users



--
Ó£±¦±¦: http://www.xuanmingyi.com


-- 
Hanyu Xiao
Eayun.com