Default templates
-
https://github.com/vatesfr/xen-orchestra/issues/8388#issuecomment-2687553041
I opened an issue on the github too and @julien-f responded me over there. The deletion part is working as expected. But now I want to add my templates so that I can create VMs using those templates. Any way to achieve this? NFS Remote?
-
Maybe the docs would give some hints?
https://docs.xcp-ng.org/guides/create-use-custom-xcpng-ubuntu-templates/IIRC the most challenging part is Cloud init...
-
@irtaza9 Isn't it dangerous to remove default templates? They are used to create VMs from scratch by booting ISO image (or PXE) and installing a system. In a sense, they are not real templates. They are just metadata related to particular guest OS that describe expected guest OS of the VM instantiated from it, resource limits and restrictions, virtualization type (i.e. PV vs HVM) etc. XenServer/XCP-ng is using this metadata to possibly activate OS specific optimizations or workarounds. In VMware world the equivalent is more or less the so called Guest ID.
How do you intend to create VM templates? You can always just import premade templates from external sources or use "Other install media" as a base but it could introduce some issues later like XenServer/XCP-ng having more strict restrictions on resources (CPUs, number of disks, number of network interfaces...) compared to templates created by using some of these built in default "templates".
I would strongly advise you against removing default templates.
-
@olivierlambert Maybe a suggestion for XO dev team to implement a way to filter out default templates from drop down menus and other listings in XO. There are a lot of them and they can pretty much spam the lists.
Idea could be to show only "real" templates by default but let the user chose an option to include builtin/default templates, snapshots, and other shut down VMs that can be used as templates.
-
-
@redakula we have a team who do this work for us to create cloud ready templates. We get the templates which we need. I need a good way to list those templates in my XO so that I can consume them to create vms. How can we list those templates
qcow2
via NFS? As you know NFS can work ISO or file base topology. When I do NFS ISO then all my ISOs are listed in Install settings. -
@bvitnik no it is not dangerous at all. It depends upon the use case to use case. When use use cloud ready templates they are setup ISO of OS's and If you want to change the limits cpu, disks and network then you can.
-
@irtaza9 The way you are describing your intent and what you are trying to accomplish makes me think you are doing it the wrong way. Cloud-ready or not, your templates have to be XenServer/XCP-ng ready. To accomplish that you have two options:
-
Create an empty VM from one of built in default templates, boot an ISO/PXE and install your system. Add XenServer/XCP-ng guest tools and cloud-init to the VM, shutdown and convert the VM to the template. You can automate this process using Packer or Ansible if needed.
-
Import your VM template from OVA/OVF.
NFS ISO library is ment to be used only for ISOs. While you can store qcow2 images on it, they will not be shown. Qcow2 images are disk images, not templates... at least not in a sense of XenServer/XCP-ng.
To create a VM in XenServer/XCP-ng using qcow2 image, you have to:
- Store the image to some shared SR of NFS or SMB type (not NFS ISO library)
- Create a VDI associated with the qcow2 image file
- Create an empty VM using one of builtin default templates and attach the VDI to the VM
-
-
@bvitnik said in Default templates:
automate this process using Packer or Ansible if needed.
bro look, right now XO have a
Hub
where we have cloud-ready templates and we can install those on ourpools
and then we create VMs using those installed templates. First tell me how can we create these same templates on our own and then how can we list these templates to the XOtemplates dropdown
so that we can use them. We do not want to use raw ISO images to for booting and VM creation.I am importing my xva one by one on the pool and the file is repeated now i want to a centrallize way to serve these files, is there any way to do this?
centra-repo:
ubuntu22.xva
ubuntu24.xvacentral-repo -> pool
-
The default templates are all re-created from JSON files on the filesystem everytime the
guest-templates-json*
RPMs are updated in dom0. -
@irtaza9 bro, believe it or not, I already answered your question
. If you have your templates in XVA format and want to have them accessible to all your pool members, you have to put them on a shared SR. They will still be per pool. I don't do not know of a way to have them centralized so that they are available cross pool.
Update:
Theoretically an NFS shared SR could be mounted to multiple pools but it would have to be read only except for one pool. I have not seen something like that in action.
-
It's also not hard to "copy" a template from one pool to another. So if you create your "golden image" template, you can just copy that template to another pool.
You can see the template
Intangible Debian Bookworm 12 (Cloud Init)_2023-09-26T21:48:00.318Z
that I originally created in my "performance" pool, then later when I set up my "efficiency" pool, I simply copied to an SR in my "efficiency" pool.In order for a pool to utilize a template, the template needs to be within one of the shared SRs within that pool. Once it has been copied to an SR in the destination pool, that pool can now create new VMs using that template.
-
I have imported/uploaded my
golden template
to the pool on a SR then I checked my pool in xcp-ng center about it then I found that It stored my template in the pool on the SR which we attached to the pool and now that template is visible to all the host in that pool. I was looking to achieve the same thing. We are not going with NFS anymore as this is so simple to manage. But cross pool template sharing is still not available. Right now each SR have a unique UUID, It will be nice to have a persistent UUID for each custom template across all the pool.https://github.com/vatesfr/xen-orchestra/issues/7690
-
@stormi omg, there should be a flag to on/off this feature. like when dom0 goes for update then it check the flag and process accordingly.