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

    Cannot find the link between virtual machine and virtual disk

    Scheduled Pinned Locked Moved Xen Orchestra
    14 Posts 3 Posters 690 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.
    • P Offline
      paul.besret
      last edited by paul.besret

      Hello,

      I am starting to work on implementing the JSON RPC API on our side.
      I can get virtual machines and virtual disks, but cannot find where to link both.

      I looked on XenOrchestra to see the ws messages but couldn't find on message where content indicate that one virtual disk is part a one vm.

      Any help would be appreciated.

      Best regards,
      Paul BESRET.

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

        Hi,

        In the lower layer (XAPI API), the link is called "VBD". See:

        Source: https://xapi-project.github.io/xen-api/

        That should be helpful to search what you need. Also, I'm pinging julien-f for more details 🙂

        P 1 Reply Last reply Reply Quote 1
        • P Offline
          paul.besret @olivierlambert
          last edited by

          olivierlambert Thank's for the answer.
          So do you have an "action" to use on the JSON RPC API which helps me join the VMs and VDI ?

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

            That's a question for julien-f 🙂

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

              @paul-besret No, you can fetch all objects from the API with the method xo.getAllObjects but then it's up to you to do the join.

              On this side, the REST API is much better, you can fetch a VM at /rest/v0/vms/:id and all its VDIs at /rest/vms/:id/vdis.

              To understand how to interact with a collection, check out the documentation.

              P 1 Reply Last reply Reply Quote 0
              • P Offline
                paul.besret @julien-f
                last edited by paul.besret

                julien-f Thank's for your answer.
                So I understand that I have to get all the disks, then all the VMs and finally all the VBDs to be able to map, what disk is attached to what VM ?

                Is that right ?

                Moreover, I can't wait to use the REST API in the future, but since it doesn't have enough functionality yet, we will stick to use only one third party system to avoid misunderstanding and technical debt.

                Best regards,
                Paul BESRET

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

                  So I understand that I have to get all the disks, then all the VMs and finally all the VBDs to be able to map, what disk is attached to what VM ?

                  Exactly.

                  Moreover, I can't wait to use the REST API in the future, but since it doesn't have enough functionality yet, we will stick to use only one third party system to avoid misunderstanding and technical debt.

                  As you wish, objects are the same in both APIs.

                  P 1 Reply Last reply Reply Quote 1
                  • P Offline
                    paul.besret @julien-f
                    last edited by

                    julien-f
                    Thanks a lot, I have been able to work on it today and it's works just fine.
                    Now I would like to reference the same disk on 2 differents VMs (it is possible, right ?)
                    But I cannot click on the button "Connect VBD", is there something i am missing ?

                    4587789b-4ecf-47ba-a4c6-6b366d743bfd-image.png

                    julien-fJ 2 Replies Last reply Reply Quote 0
                    • julien-fJ Offline
                      julien-f Vates 🪐 Co-Founder XO Team @paul.besret
                      last edited by

                      @paul-besret A VDI cannot be attached to multiple running VMs at the same time, just like you cannot connect a physical disks to multiple computers.

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

                        @paul-besret What's your use case of this?

                        P 1 Reply Last reply Reply Quote 0
                        • P Offline
                          paul.besret @julien-f
                          last edited by

                          julien-f
                          I found that it is possible to attach the same disk on multiple VMs, and succeded to do it on XOA web IHM.
                          So since it is possible, we have to handle this case in our integration.

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

                            So in theory, you can attach a VDI to multiple VMs, by default if you plug it in read only on any extra VM.

                            If you want to mount the VDI on multiple VMs in read/write mode, you need to create a VDI with sharable=true flag in XAPI. However, then, you must use a shared-disk file system to be able to use it without corrupting data.

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

                              @paul-besret It is indeed possible to do it but the VDI must be created as sharable, something which I believe is not currently possible on XO UI.

                              I'll investigate how the UI behave with such a VDI.

                              P 1 Reply Last reply Reply Quote 0
                              • P Offline
                                paul.besret @julien-f
                                last edited by paul.besret

                                julien-f Maybe we do not differentiate "attaching" a disk and "connecting" a disk. I just created a new disk then went to a VM to attach it, then did the same on another VM without problem on XO UI.
                                BUT it seems that I cannot "connect" it on both VMs, which is not a problem, I only need to know what's possible, and what's not to be able to handle it.

                                Regards 🙂

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