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

    create a new vm using a iso setting cpu ram network via api

    Scheduled Pinned Locked Moved REST API
    6 Posts 3 Posters 153 Views 3 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.
    • M Offline
      markxc
      last edited by

      hi
      i am struggling with the api.

      can i do the following using api?:

      1. Create a VM using ubuntu 22X. template
      • define the following:
        -) CPU, Ram, bios, network interface and iso i want to use for install

      then it should start vm creation and run my iso (its a autoinstall iso)

      i was able to make it work using packer but packer plugin is quit old and not really mantained...

      br

      mark

      1 Reply Last reply Reply Quote 0
      • olivierlambertO Offline
        olivierlambert Vates 🪐 Co-Founder CEO
        last edited by

        Hi,

        Packer plugin is maintained. Which one you used?

        M 1 Reply Last reply Reply Quote 0
        • M Offline
          markxc @olivierlambert
          last edited by

          @olivierlambert

          Hi Oliver,

          I’ve been experimenting with Terraform — I can create a VM and boot it using my autoinstall ISO, but unfortunately, most other things aren’t working as expected.

          So I gave Packer a try instead.

          With Packer, I can successfully create a VM, mount the ISO, and perform the installation.

          At the moment, I’m stuck trying to reliably detect when the VM installation is actually finished — I’m currently working on a script to solve that.

          Out of curiosity: how do you handle the Xen Orchestra appliance installation?

          Here’s what I’m aiming for:

          We want to generate a custom VM image for our clients to import into different hypervisors (VMware, Xen, XCP-ng, Hyper-V, VirtualBox).

          My current workflow and progress:

          Generate autoinstall ISO with custom config — DONE

          Create VM, mount ISO, perform install, and detect when installation is complete — NOT WORKING YET

          Shut down the VM — DONE

          Export VM as an OVA template — DONE

          Convert that export to other formats for common hypervisors — DONE

          Upload final images to our storage for delivery to clients — DONE

          The goal is to fully automate the process — like a CI/CD pipeline for VM images.

          Right now, I’m able to do nearly everything except reliably detecting when the VM installation is finished.

          br

          mark

          nathanael-hN 1 Reply Last reply Reply Quote 0
          • olivierlambertO Offline
            olivierlambert Vates 🪐 Co-Founder CEO
            last edited by

            That's a question for the DevOps Tools team 🙂

            Ping @devops-team

            1 Reply Last reply Reply Quote 0
            • nathanael-hN Offline
              nathanael-h Vates 🪐 DevOps Team @markxc
              last edited by

              @markxc said in create a new vm using a iso setting cpu ram network via api:

              Out of curiosity: how do you handle the Xen Orchestra appliance installation?

              We use Packer, a Debian iso and an Ansible playbook in the ansible provisioner. See https://developer.hashicorp.com/packer/integrations/hashicorp/ansible/latest/components/provisioner/ansible

              With this setup, we achieve these tasks:

              • Create VM, mount ISO, perform install, and detect when installation is complete
              • Shut down the VM
              • Export VM as an OVA template

              We also have a CI/CD pipeline doing this automatically.

              M 1 Reply Last reply Reply Quote 0
              • M Offline
                markxc @nathanael-h
                last edited by

                @nathanael-h

                thanks for info

                i used https://github.com/ddelnano/packer-plugin-xenserver
                but because of lack of ssh key support i changed the code a bit.
                now i can use ssh keys. (not ready for a PR)

                my problem is that inside the auto iso i use a shell script doing a reboot within the install.
                the reason is that i use this iso also on bare metal installations, some software i cant install without doing a reboot.

                i will now focus on the ansible integratian an fire the commands after the reboot using ansible.
                this might work.

                br

                Mark

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