[libvirt-users] where is libvirt-python document??
Hanyu Xiao
hanyu.xiao at eayun.com
Mon Nov 12 02:31:22 UTC 2012
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 at 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 at eayun.com <mailto:hanyu.xiao at 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 at redhat.com <mailto:libvirt-users at redhat.com>
>> https://www.redhat.com/mailman/listinfo/libvirt-users
>
> --
>
> Hanyu Xiao
> Eayun.com
>
>
> _______________________________________________
> libvirt-users mailing list
> libvirt-users at redhat.com <mailto:libvirt-users at redhat.com>
> https://www.redhat.com/mailman/listinfo/libvirt-users
>
>
>
>
> --
> 樱宝宝: http://www.xuanmingyi.com
>
--
Hanyu Xiao
Eayun.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20121112/fee4bf59/attachment.htm>
More information about the libvirt-users
mailing list