Xm re-create configuration file from existing vm

debian-wheezyvirtualizationxen

I have Xen set up and working quite nicely.

When I reboot and use:

xm list

I get this output:

Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  4096     4     r-----    153.6
busiserver                                      2048     2                26.0
testserver0                                     2048     2              1596.1
ubuntuserver                                    1024     2                47.8

This is because I created 3 vms through the xm command line by using something like

xm create create /dev/null ramdisk=initrd.img \
   kernel=/boot/vmlinuz-2.6.12.6-xenU \
   name=ramdisk vif='' vcpus=1 \
   memory=64 root=/dev/ram0

I also created one vm through a regular configuration file. This vm does not appear in the output of xm list, and cannot be interacted with in any way unless I use

xm create missingvm.cfg

At which point, it functions as expected, and all data from previous sessions is restored. I would like to know

  1. Where are "xm create" configuration files located when you use the pure command line option(so that I may edit/remove them)?
  2. If they are not stored anywhere since I used the command line options, is there a way to export/infer what the configuration file would look like for an existing vm?

Best Answer

You can find the .sxp configurations used by xen in /var/lib/xend/domains/. You can create a machine from a .sxp file by using xm create -F=FILE (see man xm).

However, if you want to edit them I'd reccomend you to use libvirt's API or using virsh: virsh edit VMNAME.