[libvirt] Xen config files again

I've seen in the src tree that there are functions to read and use Xen configuration files. Are these functions available in the Python bindings or do I need to use C to get access to them? What I am mostly interested in doing is parsing the Xen config file and getting back the XML version that I can store and use later on. -- Thomas Moyer Graduate Student CSE Department Penn State University tmmoyer@cse.psu.edu http://www.cse.psu.edu/~tmmoyer

On Sat, Jul 05, 2008 at 10:21:36PM -0400, Thomas Moyer wrote:
I've seen in the src tree that there are functions to read and use Xen configuration files. Are these functions available in the Python bindings or do I need to use C to get access to them? What I am mostly interested in doing is parsing the Xen config file and getting back the XML version that I can store and use later on.
No, these methods are for internal use only. All acccess to the Xen config files must go via the public interfaces and XML format. Internally we use the config file API to convert from XML into the config file format and vica-verca Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

You told me earlier that I can pass the name of the VM (which has a corresponding .cfg file in /etc/xen) to lookupByName() and then use getXMLDesc() to get information in XML format about the VM, but it would appear that at least the first function is only useful for running VM's not for VM's that are not running. Example to clarify my goals: I use xen-create-image to create the VM. It puts a config file called host1.cfg in /etc/xen. I would like to have a python script to automatically convert this .cfg file to something libvirt can use to start the VM. Or another option would be some automated method of creating the VM in a similar fashion as xen-create-image. thanks, tom On Jul 6, 2008, at 4:34 AM, Daniel P. Berrange wrote:
On Sat, Jul 05, 2008 at 10:21:36PM -0400, Thomas Moyer wrote:
I've seen in the src tree that there are functions to read and use Xen configuration files. Are these functions available in the Python bindings or do I need to use C to get access to them? What I am mostly interested in doing is parsing the Xen config file and getting back the XML version that I can store and use later on.
No, these methods are for internal use only. All acccess to the Xen config files must go via the public interfaces and XML format. Internally we use the config file API to convert from XML into the config file format and vica-verca
Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
-- Thomas Moyer Graduate Student CSE Department Penn State University tmmoyer@cse.psu.edu http://www.cse.psu.edu/~tmmoyer

On Sun, Jul 06, 2008 at 08:59:55AM -0400, Thomas Moyer wrote:
You told me earlier that I can pass the name of the VM (which has a corresponding .cfg file in /etc/xen) to lookupByName() and then use getXMLDesc() to get information in XML format about the VM, but it would appear that at least the first function is only useful for running VM's not for VM's that are not running.
This depends on the version of Xen. For 3.0.3 or earlier the we look for inactive VMs in /etc/xen. For 3.0.4 or newer, then we simply ask XenD for them - it manages inactive domains directly instead of using the /etc/xen directory.
Example to clarify my goals: I use xen-create-image to create the VM. It puts a config file called host1.cfg in /etc/xen. I would like to have a python script to automatically convert this .cfg file to something libvirt can use to start the VM.
If you have 3.0.4 or newer then just do 'xm new CONFIG' and this will load it into XenD and allow it to be seen by libvirt
Or another option would be some automated method of creating the VM in a similar fashion as xen-create-image.
I've not used xen-create-image, but guessing from its name I'd say you want to try virt-install Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (2)
-
Daniel P. Berrange
-
Thomas Moyer