Vm.create unable to create vm using xo-cli
-
Ping @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"}]'
-
@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
-
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
) -
-
@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 stringI also try your corrected it give me same error
-
Which OS/shell are you using?
-
@julien-f windos windows 10
-
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
-
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""}]"
-
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
-
xo-cli vm.set id=89517372-b45b-ca36-4c51-dd17c0e760c0 CPUs=3
× invalid parameters
property @.CPUs: must be integer, but is string