2012-03-22 2 views
1

libvirt-python을 사용하여 libvirt에서 도메인의 XML configs를 XEN 구성 형식으로 내보낼 수 있어야합니다. 이 호출을하려면 분명히 C에서 다음을 사용하십시오.libvirt-python에서 virConnectDomainXMLToNative를 호출 할 수 있습니까?

virConnectDomainXMLToNative 

Reads a domain XML configuration document, and generates a native configuration file describing the domain. The format of the native data is hypervisor dependant. 

conn: a connection object 
nativeFormat: configuration format exporting to 
domainXml: the domain configuration to export 
flags: extra flags; not used yet, so callers should always pass 0 
Returns: a 0 terminated UTF-8 encoded native config datafile, or NULL in case of error. the caller must free() the returned value. 

그러나 파이썬에는 동일한 기능이 없습니다.

libvirt-python에서 특정 C 함수를 호출 할 수있는 것으로 나타났습니다. 내가 현재 도움말 목록에서 보지 못했지만 도움을 사용할 때 (libvirt). (CentOS 5, BTW에서 사용할 수있는 libvirt-python 패키지를 사용하고 있습니다).

어쨌든 파이썬 안에서 그 전화를하고 도메인 .xml을 xen 구성으로 변환 할 수있는 방법이 있습니까?

답변

0

Python API bindings page에 따르면, virConnect으로 시작하는 함수는 Python의 virConnect 오브젝트의 메소드에 맵핑됩니다. 따라서 virConnect 개체를 만든 다음 domainXMLToNative 메서드를 호출해야합니다.

여전히 작동하지 않는다면 ctypes 모듈을 사용하여 공유 라이브러리에서 함수를 호출 할 수 있습니다.

+0

최소한 libvirt 및 libvirt-python 0.7x로 업그레이드해야합니다. 나는 그것이 앞으로 나아갈 길이라고 생각합니다. – Rilindo

관련 문제