Managing your Xen DomU: Difference between "xm new" and "xm create"
by KBOYLE
When you use Yast to “Create Virtual Machines”, it does several things. For example, suppose you create a VM (DomU) called “oes11”. The information you provide is saved in a file: /etc/xen/oes11. That information is also imported into the XenStore where it can be managed. You can then use “Virtual Machine Manager” to make changes to the DomU configuration saved in the XenStore. You can add devices, increase memory etc. but you will notice that none of those changes are reflected in /etc/xen/oes11.1. To see what DomU’s are being managed by xend:
xm list
2. To see the current xen configuration for your oes11 DomU:
xm list -l oes11
(That’s a lower case ELL after the “-“)
3. To save the current xen configuration for your oes11 DomU:
xm list -l oes11 >oes11.py
the current xen configuration will be save to file oes11.py, in your current directory
4. Now, if you no longer want xend to manage your oes11 Domu:
xm delete oes11
Note: this doesn’t delete the DomU or the virtual filestore. It just removes the definition from the XenStore.
5. To verify that Xen no longer knows about your oes11 DomU:
xm list
That will list all the DomU’s managed by xend. oes11 is no longer listed.
6. Even though the DomU is no longer managed by xend, you can still “run” it using the original configuration:
xm create /etc/xen/oes11
7. You can also import the configuration back into the XenStore using the file created in step 3:
xm new -F oes11.py
8. Step 7 just imports the configuration. It doesn’t start the DomU. To start the DomU:
xm start oes11
There are a few more important points to consider:
- The XenStore contains the current configuration including changes made with “Virtual Machine Manager”.
- The file you use with xm create is static. It contains the initial configuration without any subsequent changes. For this reason it is often obsolete.
- You are limited to making relatively simple changes to your DomU using “Virtual Machine Manager”.
This is the preferred method for changing your Xen configuration:
A. Shutdown the DomU using the appropriate OS specific method or from the Dom0:
xm shutdown <DomU>
B. Verify the DomU is no longer running:
xm list
C. Save the current xen configuration for your DomU in a file:
xm list -l <DomU> > DomU.py
D. Save a copy of the file (just in case!).
E. Make any changes to the configuration using your favorite text editor and save the changes. <Modified Configuration>
F. Delete the current configuration from the XenStore
xm delete <DomU>
G. Import the modified configuration back into the XenStore using the file created in step E:
xm new -F <Modified Configuration>
H. Start the DomU
xm start <DomU>
An added benefit of following this procedure is you retain a backup copy of your DomU configuration should anything happen to the XenStore.
Related Articles
Feb 16th, 2022
Kubernetes cost management with Kubecost and SUSE Rancher
Oct 25th, 2022
Comments
Xen Project Upgrade to 4.1+ Reference
https://wiki.xen.org/wiki/Migration_Guide_To_Xen4.1%2B#Toolstack_upgrade_notes
xl is a direct replacement to xm EXCEPT for Managed Domain commands;
https://wiki.xen.org/wiki/XL#Anti-Features
Python no longer supprted in xl;
https://wiki.xen.org/wiki/PythonInXlConfig
Ken, your post served us very well with SLES 11.x and xm. It allowed us to move domU’s very easily between hosts, backups, etc. Thank you. Unfortunately with SLES 12.x the replacement to xm is xl and the “xl new” command still isn’t implemented (and likely will never be at this point as it’s considered an “anti-feature” (see above)). Do you know if there’s a supported way to accomplish the same tasks via the command line in SLES 12.x? Are others using another toolstack on SLE 12 with success?
Looks like virsh is the preferred way;
SLES 11 SP 4 XEN -> SLES 12.X XEN
Export domain config on SLE11 dom0;
virsh dumpxml domu > domu.xml
On new dom0 (SLE12.x) import domain config;
virsh define domu.xml
xm list is replaced by: virsh list –all
See here for more details about virsh and xen: https://wiki.xen.org/wiki/Virsh_Commands