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

    Vm.create unable to create vm using xo-cli

    Scheduled Pinned Locked Moved Xen Orchestra
    13 Posts 3 Posters 2.0k Views 1 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

      Ping @julien-f

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

        @bajiya2024 Two things:

        • be careful with shell quotes and interpolation
        • the text following json: must be valid JSON
        VIFs='json:[{"bootable":true,"device":0,"size":8589934592,"type":"system"}]'
        
        1 Reply Last reply Reply Quote 0
        • B Offline
          bajiya2024
          last edited by julien-f

          @julien-f said in Vm.create unable to create vm using xo-cli:

          VIFs='json:[{"bootable":true,"device":0,"size":8589934592,"type":system}]'

          xo-cli vm.create template=e6ea07ce-18dd-2d46-215c-e8cce8b770eb name_label='test' name_description="test-cloud-init" bootAfterCreate=true VIFs='json:[{"bootable":true,"device":0,"size":8589934592,"type":system}]'
          × invalid parameters
            property @.VIFs: must be array, but is string
          

          same issue is comming

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

            My example was incorrect, system needs to be quoted as well, I have fixed my message now.

            Anyway, the error is strange, I would have expected an invalid JSON error, which version are you using? (xo-cli --help)

            1 Reply Last reply Reply Quote 0
            • B Offline
              bajiya2024
              last edited by

              @julien-f said in Vm.create unable to create vm using xo-cli:

              xo-cli --help

              xo-cli v0.11.0

              1 Reply Last reply Reply Quote 0
              • B Offline
                bajiya2024
                last edited by

                @julien-f said in Vm.create unable to create vm using xo-cli:

                VIFs='json:[{"bootable":true,"device":0,"size":8589934592,"type":"system"}]'

                xo-cli vm.create template=e6ea07ce-18dd-2d46-215c-e8cce8b770eb name_label='test' name_description="test-cloud-init" bootAfterCreate=true VIFs='json:[{"bootable":true,"device":0,"size":8589934592,"type":"system"}]'
                × invalid parameters
                property @.VIFs: must be array, but is string

                I also try your corrected it give me same error

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

                  Which OS/shell are you using?

                  B 1 Reply Last reply Reply Quote 0
                  • B Offline
                    bajiya2024 @julien-f
                    last edited by

                    @julien-f windos windows 10

                    1 Reply Last reply Reply Quote 0
                    • B Offline
                      bajiya2024
                      last edited by olivierlambert

                      vm.create
                      {
                        "template": "e6ea07ce-18dd-2d46-215c-e8cce8b770eb",
                        "name_label": "'test'",
                        "name_description": "test-cloud-init",
                        "bootAfterCreate": true,
                        "VIFs": "'json:[{bootable:true,device:0,size:8589934592,type:system}]'"
                      }
                      {
                        "code": 10,
                        "data": {
                          "errors": [
                            {
                              "code": null,
                              "reason": "type",
                              "message": "must be array, but is string",
                              "property": "@.VIFs"
                            }
                          ]
                        },
                        "message": "invalid parameters",
                        "name": "XoError",
                        "stack": "XoError: invalid parameters
                          at Object.invalidParameters (/opt/xen-orchestra/packages/xo-common/src/api-errors.js:21:32)
                          at Object.call (/opt/xen-orchestra/packages/xo-server/src/xo-mixins/api.js:72:18)
                          at Api.callApiMethod (/opt/xen-orchestra/packages/xo-server/src/xo-mixins/api.js:289:19)"
                      }
                      

                      this log coming

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

                        The problem is likely related to quotes and the shell syntax.

                        Unfortunately, I'm not familiar with it and cannot help you a lot.

                        I read somewhere that you should be able to escape quotes by doubling them, that may be worth a try:

                        "VIFs=json:[{""bootable"":true,""device"":0,""size"":8589934592,""type"":""system""}]"
                        
                        1 Reply Last reply Reply Quote 0
                        • B Offline
                          bajiya2024
                          last edited by bajiya2024

                          yes it work for me Thanks @julien-f but if you have any link related this then please share me because i am facing problem in vm.create and vm.set CPUS=2 ...command line always send string but CPUs always need integer

                          1 Reply Last reply Reply Quote 0
                          • B Offline
                            bajiya2024
                            last edited by

                            xo-cli vm.set id=89517372-b45b-ca36-4c51-dd17c0e760c0 CPUs=3
                            × invalid parameters
                            property @.CPUs: must be integer, but is string

                            1 Reply Last reply Reply Quote 0

                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                            With your input, this post could be even better 💗

                            Register Login
                            • First post
                              Last post