XO Rest API
-
@Danp said in XO Rest API:
xo-cli --list-objects type=VM-template uuid=f6745939-cc54-fa9c-5169-6f14ba830a6a
Reply
C:\Users\PC>xo-cli --list-objects type=VM-template uuid=f6745939-cc54-fa9c-5169-6f14ba830a6a `--list-objects` is deprecated and will be removed in the future, use `list-objects` subcommand instead [ { "type": "VM-template", "addresses": {}, "auto_poweron": false, "bios_strings": { "bios-vendor": "Xen", "bios-version": "", "system-manufacturer": "Xen", "system-product-name": "HVM domU", "system-version": "", "system-serial-number": "", "baseboard-manufacturer": "", "baseboard-product-name": "", "baseboard-version": "", "baseboard-serial-number": "", "baseboard-asset-tag": "", "baseboard-location-in-chassis": "", "enclosure-asset-tag": "", "hp-rombios": "", "oem-1": "Xen", "oem-2": "MS_VM_CERT/SHA1/bdbeb6e0a816d43fa6d3fe8aaef04c2bad9d3e3d" }, "blockedOperations": {}, "boot": { "order": "cdn" }, "CPUs": { "max": 2, "number": 2 }, "current_operations": {}, "expNestedHvm": false, "viridian": true, "high_availability": "", "isFirmwareSupported": true, "memory": { "dynamic": [ 2147483648, 2147483648 ], "static": [ 2147483648, 2147483648 ], "size": 2147483648 }, "installTime": null, "name_description": "Ubuntu Linux (64-bit)", "name_label": "ubuntu22image", "needsVtpm": false, "other": { "import_task": "OpaqueRef:a36b7087-b9a2-4e31-96c6-a0e95a0b280f", "mac_seed": "09d66866-7e77-af81-7432-3d5b48caa0d0", "vgpu_pci": "", "base_template_name": "Other install media", "install-methods": "cdrom" }, "os_version": {}, "power_state": "Halted", "hasVendorDevice": false, "snapshots": [], "startDelay": 0, "startTime": null, "secureBoot": false, "tags": [], "VIFs": [], "VTPMs": [], "virtualizationMode": "hvm", "$container": "d1aa29fb-9fed-e39b-0f88-fc4ebbd42d3f", "$VBDs": [ "11bb8f2c-6cd0-e55a-9ff1-6d9b14689237" ], "VGPUs": [], "$VGPUs": [], "xenStoreData": { "vm-data/mmio-hole-size": "268435456", "vm-data": "" }, "vga": "cirrus", "videoram": 4, "isDefaultTemplate": false, "template_info": { "disks": [], "install_methods": [ "cdrom" ] }, "cpuWeight": 256, "id": "f6745939-cc54-fa9c-5169-6f14ba830a6a", "uuid": "f6745939-cc54-fa9c-5169-6f14ba830a6a", "$pool": "d1aa29fb-9fed-e39b-0f88-fc4ebbd42d3f", "$poolId": "d1aa29fb-9fed-e39b-0f88-fc4ebbd42d3f", "_xapiRef": "OpaqueRef:ce5af387-410c-4e10-8eaf-46315b980ed2" } ]
-
@Danp template info via rest-api
-
@Danp said in XO Rest API:
Is your VM up-to-date with the latest sources?
Yes I configured the XO from sources and it's not up to date. Should I update my XO and will it fix the issue or not?
-
I strongly suggest to read this part of the doc: https://docs.xen-orchestra.com/community
And especially with this big yellow warning: https://docs.xen-orchestra.com/community#report-a-bug
-
@olivierlambert Thank you for your time. I've a paid subscription but I am using XO from sources. I've opened a ticket from the help desk
-
Great For the version from the sources, it doesn't matter that you have paid support or not: you must use it with latest commits as possible For XOA, then it's up to the support to answer you
-
@olivierlambert omg I'll upgrade the XO. My question is still same, why the rest-api is not responding properly when I hit it from postman and the same api is responding with error when using
xo-cli
-
It looks like that's not possible to specify the CPU ??! with the /rest/v0/pools/{{pool_id}}/actions/create_vm
-
What do you mean by "specify the CPU"?
-
@olivierlambert I'm not able to specify the number of vCPU for the VM
-
Are you fully up to date? Also pinging @julien-f about this.
-
@olivierlambert yes I think so.
Here is the result of /rest/v0/pools/_/actions/create_vm (there is no cpu parameter)
{ "params": { "affinity": { "type": "string", "optional": true }, "auto_poweron": { "type": "boolean", "optional": true }, "boot": { "type": "boolean", "default": false }, "clone": { "type": "boolean", "default": true }, "cloud_config": { "type": "string", "optional": true }, "destroy_cloud_config_vdi": { "type": "boolean", "default": false }, "install": { "type": "object", "optional": true, "properties": { "method": { "enum": [ "cdrom", "network" ] }, "repository": { "type": "string" } } }, "memory": { "type": "integer", "optional": true }, "name_description": { "type": "string", "minLength": 0, "optional": true }, "name_label": { "type": "string" }, "network_config": { "type": "string", "optional": true }, "template": { "type": "string" }, "vdis": { "type": "array", "default": [], "items": { "type": "object", "properties": { "destroy": { "type": "boolean", "optional": true }, "userdevice": { "type": "string", "optional": true }, "size": { "type": "number", "optional": true }, "sr": { "type": "string", "optional": true }, "name_description": { "type": "string", "optional": true }, "name_label": { "type": "string", "optional": true } }, "if": { "not": { "required": [ "userdevice" ] } }, "then": { "required": [ "size", "name_label" ], "not": { "required": [ "destroy" ] } } } }, "vifs": { "default": [], "type": "array", "items": { "type": "object", "properties": { "destroy": { "type": "boolean", "optional": true }, "device": { "type": "string", "optional": true }, "ipv4_allowed": { "type": "array", "items": { "type": "string" }, "optional": true }, "ipv6_allowed": { "type": "array", "items": { "type": "string" }, "optional": true }, "mac": { "type": "string", "optional": true }, "network": { "type": "string", "optional": true } } } } } }
-
@df-cgdm You are correct. That feature isn't currently available via the REST APIs as previously mentioned by Julien earlier in this thread.
-
@Danp For now I'm going with
JSON-RPC
for only VM creation and for listings I'm usingrest-apis
. When XO6 will release I'll change the endpoint with rest endpoint. @olivierlambert any expected release date for XO6? -
It's rolled out progressively: every bit of UI that's exposed will use the REST API, so both a getting more stuff every release. You can already use some bits of the REST API like you can already use XO 6 UI with
/v6
-
Yes, you can use JSON-RPC et REST APIs together for now
We will try to add support for CPU settings soon.
Also, expect things to accelerate in 2025 regarding the REST API.