XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Default templates

    Scheduled Pinned Locked Moved Management
    17 Posts 7 Posters 613 Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I Offline
      irtaza9
      last edited by irtaza9

      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?

      4fce2223-4e17-4f30-99b4-e4063f665458-image.png

      Performing Delete Action:

      5e4e076e-19f1-4f05-8e3d-3f20e167952f-image.png

      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)"
      }
      
      
      1 Reply Last reply Reply Quote 0
      • olivierlambertO Offline
        olivierlambert Vates 🪐 Co-Founder CEO
        last edited by

        IIRC, you can't. @stormi might confirm

        I B 2 Replies Last reply Reply Quote 0
        • I Offline
          irtaza9 @olivierlambert
          last edited by

          @olivierlambert

          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?

          irtaza9 created this issue in vatesfr/xen-orchestra

          closed Error while deleting default templates #8388

          R B 2 Replies Last reply Reply Quote 0
          • R Offline
            redakula @irtaza9
            last edited by

            @irtaza9

            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...

            I 1 Reply Last reply Reply Quote 0
            • B Offline
              bvitnik @irtaza9
              last edited by bvitnik

              @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.

              I 1 Reply Last reply Reply Quote 0
              • B Offline
                bvitnik @olivierlambert
                last edited by

                @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.

                P 1 Reply Last reply Reply Quote 0
                • P Online
                  ph7 @bvitnik
                  last edited by

                  @bvitnik @redakula @irtaza9
                  This is how I filtered out with TAGS
                  Added a TAG Visa to the Template I wanted to show

                  4b8ee995-612b-448c-b7cf-c26ef7b56841-bild.png

                  Then I selected the tag in Edit my settings | Custom filters | Templates | Default filter

                  5e7f17fa-41a8-40d5-b895-162cc20cf7b7-bild.png

                  1 Reply Last reply Reply Quote 1
                  • I Offline
                    irtaza9 @redakula
                    last edited by

                    @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.

                    b5b46b18-a91f-461f-a9ff-ca37b9646acd-image.png

                    1 Reply Last reply Reply Quote 0
                    • I Offline
                      irtaza9 @bvitnik
                      last edited by

                      @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.

                      B 1 Reply Last reply Reply Quote 0
                      • B Offline
                        bvitnik @irtaza9
                        last edited by

                        @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:

                        1. Store the image to some shared SR of NFS or SMB type (not NFS ISO library)
                        2. Create a VDI associated with the qcow2 image file
                        3. Create an empty VM using one of builtin default templates and attach the VDI to the VM
                        I 1 Reply Last reply Reply Quote 0
                        • I Offline
                          irtaza9 @bvitnik
                          last edited by irtaza9

                          @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 our pools 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 XO templates 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.xva

                          central-repo -> pool

                          d6cc08bb-5305-4a2b-af21-afa793509c29-image.png

                          B 1 Reply Last reply Reply Quote 0
                          • stormiS Offline
                            stormi Vates 🪐 XCP-ng Team
                            last edited by

                            The default templates are all re-created from JSON files on the filesystem everytime the guest-templates-json* RPMs are updated in dom0.

                            I 1 Reply Last reply Reply Quote 1
                            • B Offline
                              bvitnik @irtaza9
                              last edited by bvitnik

                              @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.

                              T 1 Reply Last reply Reply Quote 0
                              • T Offline
                                techjeff @bvitnik
                                last edited by

                                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.

                                Screenshot 2025-03-03 153911.png

                                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 1 Reply Last reply Reply Quote 0
                                • I Offline
                                  irtaza9 @techjeff
                                  last edited by

                                  @techjeff

                                  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

                                  d9348026-7a59-4dbf-ad69-8b3785cbb868-image.png

                                  WhatsApp Image 2025-03-04 at 9.38.31 AM.jpeg

                                  @bvitnik, @techjeff Thank you brothers 🤕

                                  olivierlambert created this issue in vatesfr/xen-orchestra

                                  open Custom template replication between pools #7690

                                  T 1 Reply Last reply Reply Quote 0
                                  • I Offline
                                    irtaza9 @stormi
                                    last edited by

                                    @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.

                                    1 Reply Last reply Reply Quote 0
                                    • T Offline
                                      techjeff @irtaza9
                                      last edited by

                                      @irtaza9 happy to help!

                                      1 Reply Last reply Reply Quote 1
                                      • First post
                                        Last post