Default templates
-
How to delete default templates?
I only need cloud-init ready templates in my pool and I do not need these default templates. Please guide me about it so when i create new pool i ignore these templates to be include in my pool. Also how can I list my custom build cloud init ready templates in the dropdown?
Performing Delete Action:
vm.delete { "id": "d4515c45-71ca-7675-ea70-0fe0a8f7dbe4-7aa32be8-a06c-4ade-8a1d-49e51e03e9d2" } { "code": "HANDLE_INVALID", "params": [ "VM", "OpaqueRef:f08029f8-b0d1-4031-9c14-d5c9a84750fe" ], "call": { "duration": 8, "method": "VM.get_record", "params": [ "OpaqueRef:f08029f8-b0d1-4031-9c14-d5c9a84750fe" ] }, "message": "HANDLE_INVALID(VM, OpaqueRef:f08029f8-b0d1-4031-9c14-d5c9a84750fe)", "name": "XapiError", "stack": "XapiError: HANDLE_INVALID(VM, OpaqueRef:f08029f8-b0d1-4031-9c14-d5c9a84750fe) at Function.wrap (file:///opt/xen-orchestra/packages/xen-api/_XapiError.mjs:16:12) at file:///opt/xen-orchestra/packages/xen-api/transports/json-rpc.mjs:38:21 at runNextTicks (node:internal/process/task_queues:65:5) at processImmediate (node:internal/timers:459:9) at process.callbackTrampoline (node:internal/async_hooks:130:17)" }
-
IIRC, you can't. @stormi might confirm
-
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.