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

    Xen-Orchestra Terraform provider and Windows

    Scheduled Pinned Locked Moved Infrastructure as Code
    34 Posts 7 Posters 8.6k Views 7 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.
    • olivierlambertO Offline
      olivierlambert Vates 🪐 Co-Founder CEO
      last edited by

      @julien-f do you remember how hard it was to create a FAT system entirely from XO in Javascript? Do you think it's a lot harder to do that in a partition? (ie creating the partition table, then just one partition with the FAT system inside)

      julien-fJ 1 Reply Last reply Reply Quote 0
      • R Offline
        rochemike @olivierlambert
        last edited by

        @olivierlambert yes, I think that would do it. I can't see any other difference at this point.

        1 Reply Last reply Reply Quote 1
        • julien-fJ Offline
          julien-f Vates 🪐 Co-Founder XO Team @olivierlambert
          last edited by julien-f

          @olivierlambert https://github.com/vatesfr/xen-orchestra/blob/master/packages/xo-server/src/fatfs-buffer.mjs

          I don't remember the details exactly, but it would probably be harder to do it with a partition table.

          R 1 Reply Last reply Reply Quote 0
          • R Offline
            rochemike @julien-f
            last edited by

            @julien-f and @olivierlambert

            Admittedly, I'm not proficient in this kind of programming, not at all. I tried reading through the code you linked to above and it makes no sense to me. Normally I would try to try fixing this myself, but I just don't have time to invest learning something that's this new to me.

            However, I know in a bash script we simply partition the drive and it wouldn't change another thing about subsequent commands, because you're still writing to the drive in the same manner. How is that different in this code?

            Your comments make me sad and afraid that you won't take up this challenge to support Windows VMs with cloud-init. I would ask that if you put this off into the future, that you update any blogs or documents to explicitly describe that Windows VMs are excluded from cloud-init compatibility for now, to save anyone else from spending as much time on this as I have.

            On a personal note, the news that warm VM migrations from VMware will be built into the GUI for all versions of VMware is then a bittersweet story because it will give us what we need to support migration of our virtualization platforms from VMware. But lack of support for terraform / cloud-init for Windows would mean having to pivot to re-engineer our automation service.

            Please advise what we can expect of this bug-squashing in terms of time.

            Thanks for all you have done to create and continually improve this platform.

            Mike

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

              We will discuss this internally ( @marcungeschikts can you add this to the backlog?) and we'll see if it's doable and at which level of difficulty šŸ™‚

              marcungeschiktsM R 2 Replies Last reply Reply Quote 0
              • marcungeschiktsM Offline
                marcungeschikts Vates 🪐 Project mgmt @olivierlambert
                last edited by

                šŸ‘Œ

                1 Reply Last reply Reply Quote 0
                • R Offline
                  rochemike @olivierlambert
                  last edited by

                  @olivierlambert

                  I'm happy to help test if that kind of help is needed.

                  Mike

                  florentF 1 Reply Last reply Reply Quote 1
                  • florentF Offline
                    florent Vates 🪐 XO Team @rochemike
                    last edited by

                    @rochemike hi,

                    I did some test on a branch (adding a MBR at the beginning of the cloud init drive) : https://github.com/vatesfr/xen-orchestra/pull/6889 it should fix the windows problem. Can you test it ?

                    Regards

                    fbeauchamp opened this pull request in vatesfr/xen-orchestra

                    closed feat(xo-server): add MBR to cloud-init drive #6889

                    R 1 Reply Last reply Reply Quote 1
                    • R Offline
                      rochemike @florent
                      last edited by

                      @florent Great news! I'm eager to test, but tied up. I hope to get to it within the next 1-2 weeks.

                      Is there anything special I need to do from my end, or is the patch live?

                      Mike

                      florentF 1 Reply Last reply Reply Quote 0
                      • florentF Offline
                        florent Vates 🪐 XO Team @rochemike
                        last edited by

                        @rochemike for now the patch lives in a separate branch, it will reach master soon
                        it will on latest XOA by the end of the month

                        R 1 Reply Last reply Reply Quote 0
                        • R Offline
                          rochemike @florent
                          last edited by

                          @florent I confess I'm still new to things like "branches" I understand the concepts but am unsure how to go forward. Should I just wait until after the changes go live, or is there some way to test them before then?

                          florentF 1 Reply Last reply Reply Quote 0
                          • florentF Offline
                            florent Vates 🪐 XO Team @rochemike
                            last edited by

                            @rochemike I can help you for this

                            Do you use XO from the source or a XOA ?

                            R 1 Reply Last reply Reply Quote 0
                            • R Offline
                              rochemike @florent
                              last edited by

                              @florent XOA

                              florentF 1 Reply Last reply Reply Quote 0
                              • florentF Offline
                                florent Vates 🪐 XO Team @rochemike
                                last edited by

                                @rochemike great, that will be even easier

                                can you open a support ticket and open a support tunnel ? I will connect and patch your installation

                                R 1 Reply Last reply Reply Quote 2
                                • R Offline
                                  rochemike @florent
                                  last edited by

                                  @florent ticket opened!

                                  florentF 2 Replies Last reply Reply Quote 0
                                  • florentF Offline
                                    florent Vates 🪐 XO Team @rochemike
                                    last edited by

                                    @rochemike patch done this morning

                                    1 Reply Last reply Reply Quote 2
                                    • florentF Offline
                                      florent Vates 🪐 XO Team @rochemike
                                      last edited by

                                      @rochemike hi mike did you have time to test ?

                                      R 1 Reply Last reply Reply Quote 0
                                      • R Offline
                                        rochemike @florent
                                        last edited by rochemike

                                        @florent hello, I'm sorry for the delay.

                                        Yes, and I'm getting errors.

                                        right after "terraform apply" and answering "yes" to the prompt, I got this:

                                        xenorchestra_vm.rbbmspcs2: Creating...
                                        ā•·
                                        │ Error: jsonrpc2: code 10 message: invalid parameters: {"errors":[{"instancePath":"/affinityHost","schemaPath":"#/properties/affinityHost/minLength","keyword":"minLength","params":{"limit":1},"message":"must NOT have fewer than 1 characters"},{"instancePath":"/VIFs/0/mac","schemaPath":"#/properties/VIFs/items/properties/mac/minLength","keyword":"minLength","params":{"limit":1},"message":"must NOT have fewer than 1 characters"}]}
                                        │
                                        │   with xenorchestra_vm.rbbmspcs2,
                                        │   on vm.tf line 19, in resource "xenorchestra_vm" "rbbmspcs2":
                                        │   19: resource "xenorchestra_vm" "rbbmspcs2" {
                                        │
                                        ╵
                                        

                                        So... I did some Googling and found that another person was experiencing a similar issue recently, so I added the following line to my tf file:

                                        affinity_host = data.xenorchestra_pool.pool.master
                                        

                                        Now, I'm getting this error - and I can't figure out a solution on my own. Any ideas? I haven't toyed with my TF files in months, ever since I reported this, and wasn't getting these errors back then.

                                        xenorchestra_vm.rbbmspcs2: Creating...
                                        ā•·
                                        │ Error: jsonrpc2: code 10 message: invalid parameters: {"errors":[{"instancePath":"/VIFs/0/mac","schemaPath":"#/properties/VIFs/items/properties/mac/minLength","keyword":"minLength","params":{"limit":1},"message":"must NOT have fewer than 1 characters"}]}
                                        │
                                        │   with xenorchestra_vm.rbbmspcs2,
                                        │   on vm-windows.tf line 19, in resource "xenorchestra_vm" "rbbmspcs2":
                                        │   19: resource "xenorchestra_vm" "rbbmspcs2" {
                                        │
                                        ╵
                                        

                                        Here follows the simplified TF file I've been using, with the new "affinity_host" line:

                                        data "xenorchestra_pool" "pool" {
                                          name_label = "b500-2555 Server Room"
                                        }
                                        
                                        data "xenorchestra_template" "vm_template" {
                                          name_label = "rbbmswsoe2019s_2023-02-28"
                                        }
                                        
                                        data "xenorchestra_sr" "sr" {
                                          name_label = "nfs-isilon-xcpng-b500-2555"
                                          pool_id = data.xenorchestra_pool.pool.id
                                        }
                                        
                                        data "xenorchestra_network" "network" {
                                          name_label = "VLAN113"
                                          pool_id = data.xenorchestra_pool.pool.id
                                        }
                                        
                                        resource "xenorchestra_vm" "rbbmspcs2" {
                                          memory_max = 8589934594
                                          cpus = 2
                                          name_label = "XO terraform tutorial"
                                          affinity_host = data.xenorchestra_pool.pool.master
                                          template = data.xenorchestra_template.vm_template.id
                                        
                                          network {
                                            network_id = data.xenorchestra_network.network.id
                                          }
                                        
                                          disk {
                                            sr_id = data.xenorchestra_sr.sr.id
                                            name_label = "VM boot drive"
                                            size = 50212254720
                                          }
                                        }
                                        
                                        G 1 Reply Last reply Reply Quote 0
                                        • G Offline
                                          gsrfan01
                                          last edited by gsrfan01

                                          What is your version of XO? There was a breaking change a few months back that required a MAC address to be defined but was changed. It's fixed now so if you update to the latest version it would fix it.

                                          Though I can't find it now, I remember having to roll back a version until it was fixed. Might be mixing this up with the affinity host actually...

                                          In case this is useful, here is my ubuntu TF

                                          data "xenorchestra_pool" "pool" {
                                              name_label = var.pool_name
                                          }
                                          
                                          data "xenorchestra_template" "template" {
                                              name_label = var.vmtemplate
                                          }
                                          
                                          data "xenorchestra_network" "net" {
                                            name_label = var.network
                                            pool_id = var.pool_uuid
                                          }
                                          
                                          resource "xenorchestra_cloud_config" "bar" {
                                            name = "cloud config name"
                                            # Template the cloudinit if needed
                                            template = templatefile("cloud_config.tftpl", {
                                              hostname = var.hostname
                                            })
                                          }
                                          
                                          resource "xenorchestra_cloud_config" "net" {
                                            name = "cloud network config name"
                                            # Template the cloudinit if needed
                                            template = templatefile("cloud_network_config.tftpl", {
                                            })
                                          }
                                          
                                          
                                          resource "xenorchestra_vm" "bar" {
                                              memory_max = var.ram
                                              cpus  = var.cpus
                                              cloud_config = xenorchestra_cloud_config.bar.template
                                              cloud_network_config = xenorchestra_cloud_config.net.template
                                              name_label = var.name_label
                                              name_description = var.name_description
                                              template = data.xenorchestra_template.template.id
                                          
                                              # Prefer to run the VM on the primary pool instance
                                              affinity_host = data.xenorchestra_pool.pool.master
                                              network {
                                                network_id = data.xenorchestra_network.net.id
                                              }
                                          
                                              disk {
                                                sr_id = var.disk_sr
                                                name_label = var.disk_name
                                                size = var.disk_size 
                                              }
                                          
                                              tags = [
                                                "Nightly Backup"
                                              ]
                                          
                                              wait_for_ip = true
                                          
                                              // Override the default create timeout from 5 mins to 20.
                                              timeouts {
                                                create = "20m"
                                              }
                                          }
                                          
                                          R 1 Reply Last reply Reply Quote 0
                                          • R Offline
                                            rochemike @gsrfan01
                                            last edited by

                                            @gsrfan01 I'm up-to-date as far as I can tell.

                                            Current version: 5.84.0

                                            I just want to build a VM to test another feature - what can I do to get past this message? I can't find a way to define VIFs in Terraform for XO.

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