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

    Xen-Orchestra Terraform provider and Windows

    Xen Orchestra
    4
    11
    268
    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.
    • R
      rochemike
      last edited by rochemike

      Edit: I see now this should probably have been put in the Xen Orchestra forums - can it be moved? Sorry!

      Hello All

      Having read the recent Terraform and Cloud-init blogs and emails over the past year or so, we decided to use Terraform to deploy our VMs.

      Unfortunately, it sounds like nobody has tried doing this with Windows VMs. If you have, or know anybody who has... PLEASE let me know what I'm doing wrong here.

      We have followed the tutorials and online examples in creating the Terraform configurations correctly. And it works. Cloud-init creates the 10MB "nocloud" configuration drive and the VM starts successfully.

      Joy!

      Except...

      Cloudbase-Init (the cloud-init compatible service for Windows) is unable to mount the config drive. It "sees" it as an unformatted drive. I can have Windows format it. But there's nothing I can do to mount it.

      I have verified that it IS creating the drive - I disconnected the VDI from the Windows VM, attached it to a Linux VM and presto - I can mount the drive, and I see all the configuration that I've written to it with Terraform.

      I thought maybe the Terraform-Provider guys/gals might be interested (https://github.com/terra-farm/terraform-provider-xenorchestra/issues/229), but they indicated that this would be controlled by how XO creates the cloud-init drive.

      I'm here to say -- whatever you're doing, Windows can't mount it. I have been reading a LOT of material online - I can see other hypervisors doing this for Windows VMs and Terraform, just nobody else (but me, apparently) has tried it with XO.

      I'm hoping you have some easy advice for something that I have missed, so I can get on with my projects. 🙂

      If not - please consider including someway of formatting this config drive that it can be mounted by both Linux and Windows VMs, not just Linux VMs.

      Thank you for your time

      Mike

      Roche-Mike created this issue in terra-farm/terraform-provider-xenorchestra

      open Windows VMs unable to mount config drive #229

      1 Reply Last reply Reply Quote 0
      • olivierlambertO olivierlambert moved this topic from Development on
      • olivierlambertO
        olivierlambert Vates 🪐 Co-Founder🦸 CEO 🧑‍💼
        last edited by

        Hi there,

        I think we format it in FAT32, so the question would be a Windows question: why the drive isn't detected correctly by Windows? If we knew the MS specs to get a valid FAT32 drive for it, we could maybe modify it, but without knowing, it's hard to do anything…

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

          @olivierlambert

          As far as I can tell - XO is creating the cloudconfig on a "VFAT" drive with no partition table. Windows needs a partition table. I think this problem could simply be addressed by adding the creation of a FAT16 partition table - the resulting config drive would still be usable by Linux and additionally by Windows VMs.

          FAT32 could be part of the problem - the minimum partition size for FAT32 is 256MB...

          https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system#Size_limits

          I just ran through this experiment.

          Used a terraform plan to deploy a Windows VM.

          Used a terraform plan to deply a Linux VM.

          On the Linux VM, mounted the "XO CloudConfigDrive" and used fdisk to format the device "/dev/xvdb" (on RHEL in my case) and then added a FAT16 partition.

          Here is what I see from fdisk on a "normal CloudConfigDrive

          Command (m for help): p
          Disk /dev/xvde: 10 MiB, 10485760 bytes, 20480 sectors
          Units: sectors of 1 * 512 = 512 bytes
          Sector size (logical/physical): 512 bytes / 512 bytes
          I/O size (minimum/optimal): 512 bytes / 512 bytes
          Disklabel type: dos
          Disk identifier: 0x6c302ad6
          

          Here is what I see from fdisk on a "Windows-enabled" CloudConfigDrive

          Command (m for help): p
          Disk /dev/xvdc: 10 MiB, 10485760 bytes, 20480 sectors
          Units: sectors of 1 * 512 = 512 bytes
          Sector size (logical/physical): 512 bytes / 512 bytes
          I/O size (minimum/optimal): 512 bytes / 512 bytes
          Disklabel type: dos
          Disk identifier: 0x54d69752
          
          Device     Boot Start   End Sectors Size Id Type
          /dev/xvdc1       2048 20479   18432   9M  6 FAT16
          

          ================================

          Now, cloudbase-init is able to see the CloudConfig drive and act upon it.

          1 Reply Last reply Reply Quote 0
          • olivierlambertO
            olivierlambert Vates 🪐 Co-Founder🦸 CEO 🧑‍💼
            last edited by

            Okay if I sum up, "just" creating a FAT16 partition table could do the trick?

            R 1 Reply Last reply Reply Quote 0
            • olivierlambertO
              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
                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
                  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
                    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
                      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
                        marcungeschikts Vates 🪐 Project management ⏱️ @olivierlambert
                        last edited by

                        👌

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

                          @olivierlambert

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

                          Mike

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