### start Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vm_appliance Starts all VMs associated with the specified appliance. ```APIDOC ## RPC start ### Description Start all VMs in the appliance. ### Signature void start (session ref session_ref, VM_appliance ref self, bool paused) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VM_appliance ref) - Required - The VM appliance - **paused** (bool) - Required - Instantiate all VMs belonging to this appliance in paused state if set to true. ### Minimum Role pool-operator ### Possible Error Codes - OPERATION_PARTIALLY_FAILED ``` -------------------------------- ### Install XenServer SDK via NuGet Source: https://docs.xenserver.com/en-us/xenserver/developer/sdk-guide/c-sharp Commands to configure the NuGet source and install the XenServer.NET package. ```bash nuget sources Add -Name "Offline Package" -Source "/full/path/to/package/directory" ``` ```bash nuget install XenServer.NET ``` -------------------------------- ### Install server certificate Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-host Installs a TLS server certificate, private key, and certificate chain on the host. ```text void install_server_certificate (session ref session_ref, host ref host, string certificate, string private_key, string certificate_chain) ``` -------------------------------- ### JSON-RPC v2.0 Response Examples Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/wire-protocol Examples of successful and error response objects for the host.get_resident_VMs function. ```json { "jsonrpc": "2.0", "result": [ "OpaqueRef:604f51e7-630f-4412-83fa-b11c6cf008ab", "OpaqueRef:670d08f5-cbeb-4336-8420-ccd56390a65f" ], "id": 3 } ``` ```json { "jsonrpc": "2.0", "error": { "code": 1, "message": "SESSION_INVALID", "data": [ "OpaqueRef:c90cd28f-37ec-4dbf-88e6-f697ccb28b39" ] }, "id": 3 } ``` -------------------------------- ### JSON-RPC v2.0 Request Example Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/wire-protocol Example of a request body to retrieve resident VMs from a host. ```json { "jsonrpc": "2.0", "method": "host.get_resident_VMs", "params": [ "OpaqueRef:c90cd28f-37ec-4dbf-88e6-f697ccb28b39", "OpaqueRef:08c34fc9-f418-4f09-8274-b9cb25cd8550" ], "id": 3 } ``` -------------------------------- ### Install XenAPI Python Package Source: https://docs.xenserver.com/en-us/xenserver/developer/sdk-guide/python Use this command to install the XenAPI module from PyPi within an active virtual environment. ```bash pip install XenAPI ``` -------------------------------- ### install_server_certificate Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-host Installs a TLS server certificate on the host. ```APIDOC ## RPC install_server_certificate ### Description Install the TLS server certificate. ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **host** (host ref) - Required - The host - **certificate** (string) - Required - The server certificate, in PEM form - **private_key** (string) - Required - The unencrypted private key used to sign the certificate, in PKCS#8 form - **certificate_chain** (string) - Required - The certificate chain, in PEM form ``` -------------------------------- ### enable Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-host Puts the host into a state in which new VMs can be started. ```APIDOC ## RPC: enable ### Description Puts the host into a state in which new VMs can be started. ### Signature void enable (session ref session_ref, host ref host) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **host** (host ref) - Required - The Host to enable ### Minimum Role client-cert ### Return Type void ``` -------------------------------- ### Get Certificate host Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-certificate Retrieves the reference to the host where the specified Certificate is installed. ```text host ref get_host (session ref session_ref, Certificate ref self) ``` -------------------------------- ### Get Server Certificate Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-host?lang-switch=true Retrieves the installed server public TLS certificate in PEM form. ```text string get_server_certificate (session ref session_ref, host ref host) ``` -------------------------------- ### create Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vm_appliance Create a new VM_appliance instance, and return its handle. ```APIDOC ## RPC create ### Description Create a new VM_appliance instance, and return its handle. ### Signature VM_appliance ref create (session ref session_ref, VM_appliance record args) ### Parameters - **session_ref** (session ref) - Reference to a valid session - **args** (VM_appliance record) - All constructor arguments ### Return Type VM_appliance ref ``` -------------------------------- ### Get remaining_capacity Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-gpu_group?lang-switch=true Calculates the number of VGPUs of a given type that can still be started on the PGPUs in the group. ```text int get_remaining_capacity (session ref session_ref, GPU_group ref self, VGPU_type ref vgpu_type) ``` -------------------------------- ### Retrieve XenAPI Object Properties Source: https://docs.xenserver.com/en-us/xenserver/developer/sdk-guide/using-ps-module Example of getting a specific property from a Physical Interface (PIF). ```PowerShell Get-XenPIFProperty -Ref OpaqueRef:f433bf7b-2b0c-5f53-7018-7d195addb3ca ` -XenProperty Network ``` -------------------------------- ### introduce Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-sdn_controller Introduce an SDN controller to the pool. ```APIDOC ## RPC introduce ### Description Introduce an SDN controller to the pool. ### Signature SDN_controller ref introduce (session ref session_ref, sdn_controller_protocol protocol, string address, int port) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **protocol** (sdn_controller_protocol) - Required - Protocol to connect with the controller - **address** (string) - Required - IP address of the controller - **port** (int) - Required - TCP port of the controller ### Return Type - **SDN_controller ref** - The introduced SDN controller ### Minimum Role pool-operator ``` -------------------------------- ### Get PGPU remaining capacity Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-pgpu?lang-switch=true Calculates the number of VGPUs of a specific type that can still be started on the PGPU. ```text int get_remaining_capacity (session ref session_ref, PGPU ref self, VGPU_type ref vgpu_type) ``` -------------------------------- ### Enable Host Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-host?lang-switch=true Sets the host to a state where new VMs can be started. ```text void enable (session ref session_ref, host ref host) ``` -------------------------------- ### GET /rrd_updates Source: https://docs.xenserver.com/en-us/xenserver/developer/sdk-guide/using-http Retrieves RRD metric updates for VMs and optionally the host, starting from a specified epoch time. ```APIDOC ## GET /rrd_updates ### Description Retrieves incremental RRD metric updates for all VMs resident on the host. Optionally includes host metrics. ### Method GET ### Endpoint /rrd_updates ### Parameters #### Query Parameters - **session_id** (string) - Required - The session opaque reference for authentication. - **start** (integer) - Required - The start time in epoch seconds. - **host** (boolean) - Optional - If true, includes host metrics in the response. - **cf** (string) - Optional - The data consolidation mode (average, min, or max). - **interval** (integer) - Optional - The interval between values to be reported. ``` -------------------------------- ### Initialize xe CLI environment Source: https://docs.xenserver.com/en-us/xenserver/developer/sdk-guide/using?lang-switch=true Sets the path for the xe binary and prompts for credentials if a local configuration file is missing. ```bash # Allow the path to the 'xe' binary to be overridden by the XE environment variable if [ -z "${XE}" ]; then XE=xe fi if [ ! -e "${HOME}/.xe" ]; then read -p "Server name: " SERVER read -p "Username: " USERNAME read -p "Password: " PASSWORD XE="${XE} -s ${SERVER} -u ${USERNAME} -pw ${PASSWORD}" fi ``` -------------------------------- ### Use cbt-util to get log file information Source: https://docs.xenserver.com/en-us/xenserver/developer/changed-block-tracking-guide/troubleshoot?lang-switch=true Example usage of the cbt-util utility to retrieve the child log file UUID. ```bash cbt-util get –c –n ``` -------------------------------- ### create Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vgpu Creates a new VGPU instance. ```APIDOC ## RPC: create ### Description Creates a new VGPU instance. ### Signature VGPU ref create (session ref session_ref, VM ref VM, GPU_group ref GPU_group, string device, (string -> string) map other_config, VGPU_type ref type) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **VM** (VM ref) - Required - **GPU_group** (GPU_group ref) - Required - **device** (string) - Required - **other_config** ((string -> string) map) - Required - **type** (VGPU_type ref) - Required ### Minimum Role pool-operator ### Return Type VGPU ref (The reference of the created VGPU object) ``` -------------------------------- ### Install Trusted Certificate Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-pool?lang-switch=true Installs a trusted TLS certificate across the entire pool. ```text void install_trusted_certificate (session ref session_ref, pool ref self, bool ca, string cert, certificate_purpose set purpose) ``` -------------------------------- ### Initialize workload balancing Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-pool Sets up WLB monitoring on the pool using the provided server credentials. ```text void initialize_wlb (session ref session_ref, string wlb_url, string wlb_username, string wlb_password, string xenserver_username, string xenserver_password) ``` -------------------------------- ### create Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-console?lang-switch=true Create a new console instance, and return its handle. ```APIDOC ## RPC: create ### Description Create a new console instance, and return its handle. ### Signature console ref create (session ref session_ref, console record args) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **args** (console record) - Required - All constructor arguments ### Minimum Role vm-admin ``` -------------------------------- ### Install TLS Certificate Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-pool Installs a TLS CA certificate pool-wide. This method is deprecated. ```text void certificate_install (session ref session_ref, string name, string cert) ``` -------------------------------- ### introduce Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-pvs_server Registers a new PVS server in the system. ```APIDOC ## RPC introduce ### Description Introduces a new PVS server to the system. ### Signature PVS_server ref introduce (session ref session_ref, string set addresses, int first_port, int last_port, PVS_site ref site) ### Arguments - **session_ref** (session ref) - Reference to a valid session - **addresses** (string set) - IPv4/IPv6 addresses of the server - **first_port** (int) - first UDP port accepted by this server - **last_port** (int) - last UDP port accepted by this server - **site** (PVS_site ref) - PVS site this server is a part of ### Minimum Role pool-operator ### Return Type - **PVS_server ref** - The new PVS server ``` -------------------------------- ### HOST_STILL_BOOTING Error Signature Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/api-errors?lang-switch=true Indicates the host toolstack is currently initializing. ```text HOST_STILL_BOOTING() ``` -------------------------------- ### create Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-network Create a new network instance. ```APIDOC ## RPC create ### Description Create a new network instance, and return its handle. ### Signature network ref create (session ref session_ref, network record args) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **args** (network record) - Required - All constructor arguments ### Minimum Role vm-admin ### Return Type network ref (reference to the newly created object) ``` -------------------------------- ### Introduce Bundle Repository Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-repository Adds the configuration for a new bundle repository. Requires a valid session and returns the reference to the created repository record. ```text Repository ref introduce_bundle (session ref session_ref, string name_label, string name_description) ``` -------------------------------- ### introduce Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-pvs_site Introduces a new PVS site to the system. ```APIDOC ## RPC introduce ### Description Introduce new PVS site ### Signature PVS_site ref introduce (session ref session_ref, string name_label, string name_description, string PVS_uuid) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **name_label** (string) - Required - name of the PVS site - **name_description** (string) - Required - description of the PVS site - **PVS_uuid** (string) - Required - unique identifier of the PVS site ### Return Type - **PVS_site ref** - the new PVS site ``` -------------------------------- ### create Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-user Creates a new user instance and returns its handle. ```APIDOC ## RPC create ### Description Create a new user instance, and return its handle. ### Signature user ref create (session ref session_ref, user record args) ### Parameters - **session_ref** (session ref) - Reference to a valid session - **args** (user record) - All constructor arguments ### Minimum Role pool-admin ### Return Type user ref (reference to the newly created object) ``` -------------------------------- ### get_allowed_operations Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vbd Gets allowed operations for a VBD. ```APIDOC ## RPC: get_allowed_operations ### Description Get the allowed_operations field of the given VBD. ### Signature vbd_operations set get_allowed_operations (session ref session_ref, VBD ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VBD ref) - Required - reference to the object ### Return Type vbd_operations set (value of the field) ### Minimum Role read-only ``` -------------------------------- ### RPC: create Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-user Creates a new user instance and returns its handle. ```text user ref create (session ref session_ref, user record args) ``` -------------------------------- ### get_bootable Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vbd?lang-switch=true Gets the bootable field of a VBD. ```APIDOC ## RPC: get_bootable ### Description Get the bootable field of the given VBD. ### Signature bool get_bootable (session ref session_ref, VBD ref self) ### Arguments - **session_ref** (session ref) - Reference to a valid session - **self** (VBD ref) - reference to the object ### Minimum Role read-only ### Return Type bool (value of the field) ``` -------------------------------- ### create Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-pbd?lang-switch=true Creates a new PBD instance. ```APIDOC ## RPC create ### Description Create a new PBD instance, and return its handle. ### Signature PBD ref create (session ref session_ref, PBD record args) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **args** (PBD record) - Required - All constructor arguments ### Return Type PBD ref (reference to the newly created object) ### Minimum Role pool-operator ``` -------------------------------- ### dmesg Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-host Get the host xen dmesg. ```APIDOC ## RPC dmesg ### Description Get the host xen dmesg. ### Signature string dmesg (session ref session_ref, host ref host) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **host** (host ref) - Required - The Host to query ### Minimum Role pool-operator ``` -------------------------------- ### record_data_source Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-host Start recording the specified data source. ```APIDOC ## RPC record_data_source ### Description Start recording the specified data source. ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **host** (host ref) - Required - The host - **data_source** (string) - Required - The data source to record ### Return Type void ``` -------------------------------- ### Retrieve WLB recommendations Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-pool?lang-switch=true Fetches VM migration recommendations from the workload balancing server. ```text (VM ref -> string set) map retrieve_wlb_recommendations (session ref session_ref) ``` -------------------------------- ### get_by_name_label Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vm_appliance Get all the VM_appliance instances with the given label. ```APIDOC ## RPC get_by_name_label ### Description Get all the VM_appliance instances with the given label. ### Signature VM_appliance ref set get_by_name_label (session ref session_ref, string label) ### Parameters - **session_ref** (session ref) - Reference to a valid session - **label** (string) - label of object to return ### Return Type VM_appliance ref set ``` -------------------------------- ### install_trusted_certificate Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-pool Install a trusted TLS certificate, pool-wide. ```APIDOC ## RPC: install_trusted_certificate ### Description Install a trusted TLS certificate, pool-wide. ### Signature void install_trusted_certificate (session ref session_ref, pool ref self, bool ca, string cert, certificate_purpose set purpose) ### Parameters - **session_ref** (session ref) - Reference to a valid session - **self** (pool ref) - The pool - **ca** (bool) - The trusted certificate is a root CA certificate used to verify a chain (true), or a leaf certificate used for certificate pinning (false) - **cert** (string) - The certificate in PEM format - **purpose** (certificate_purpose set) - The purpose of the certificate ### Minimum Role client-cert ### Return Type void ``` -------------------------------- ### Create a VM Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vm Creates a new VM instance. This is generally not recommended for standard use; VM.clone or VM.copy are preferred. ```text VM ref create (session ref session_ref, VM record args) ``` -------------------------------- ### Introduce a Storage Repository Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-sr?lang-switch=true Registers an existing Storage Repository into the managed system. ```text SR ref introduce (session ref session_ref, string uuid, string name_label, string name_description, string type, string content_type, bool shared, (string -> string) map sm_config) ``` -------------------------------- ### Create console Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-console?lang-switch=true Creates a new console instance and returns its handle. ```text console ref create (session ref session_ref, console record args) ``` -------------------------------- ### get_VBDs Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vdi?lang-switch=true Get the VBDs field of the given VDI. ```APIDOC ## RPC get_VBDs ### Description Get the VBDs field of the given VDI. ### Signature VBD ref set get_VBDs (session ref session_ref, VDI ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VDI ref) - Required - reference to the object ### Return Type - **VBD ref set** - value of the field ``` -------------------------------- ### get_uuid Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vdi?lang-switch=true Get the uuid field of the given VDI. ```APIDOC ## RPC get_uuid ### Description Get the uuid field of the given VDI. ### Signature string get_uuid (session ref session_ref, VDI ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VDI ref) - Required - reference to the object ### Return Type - **string** - value of the field ``` -------------------------------- ### create Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-sr Creates a new Storage Repository and introduces it into the managed system. ```APIDOC ## create ### Description Create a new Storage Repository and introduce it into the managed system, creating both SR record and PBD record to attach it to current host (with specified device_config parameters). ### Signature SR ref create (session ref session_ref, host ref host, (string -> string) map device_config, int physical_size, string name_label, string name_description, string type, string content_type, bool shared, (string -> string) map sm_config) ### Arguments - **session_ref** (session ref) - Reference to a valid session - **host** (host ref) - The host to create/make the SR on - **device_config** ((string -> string) map) - The device config string that will be passed to backend SR driver - **physical_size** (int) - The physical size of the new storage repository - **name_label** (string) - The name of the new storage repository - **name_description** (string) - The description of the new storage repository - **type** (string) - The type of the SR; used to specify the SR backend driver to use - **content_type** (string) - The type of the new SRs content, if required - **shared** (bool) - True if the SR (is capable of) being shared by multiple hosts - **sm_config** ((string -> string) map) - Storage backend specific configuration options ### Minimum Role pool-operator ### Return Type SR ref (The reference of the newly created Storage Repository) ### Possible Error Codes SR_UNKNOWN_DRIVER ``` -------------------------------- ### get_all Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vm_appliance Return a list of all the VM_appliances known to the system. ```APIDOC ## RPC get_all ### Description Return a list of all the VM_appliances known to the system. ### Signature VM_appliance ref set get_all (session ref session_ref) ### Parameters - **session_ref** (session ref) - Reference to a valid session ### Return Type VM_appliance ref set ``` -------------------------------- ### get_type Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vdi?lang-switch=true Get the type field of the given VDI. ```APIDOC ## RPC get_type ### Description Get the type field of the given VDI. ### Signature vdi_type get_type (session ref session_ref, VDI ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VDI ref) - Required - reference to the object ### Return Type - **vdi_type** - value of the field ``` -------------------------------- ### get_tags Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vdi?lang-switch=true Get the tags field of the given VDI. ```APIDOC ## RPC get_tags ### Description Get the tags field of the given VDI. ### Signature string set get_tags (session ref session_ref, VDI ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VDI ref) - Required - reference to the object ### Return Type - **string set** - value of the field ``` -------------------------------- ### create Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmss?lang-switch=true Creates a new VMSS instance. ```APIDOC ## RPC create ### Description Create a new VMSS instance and return its handle. ### Signature VMSS ref create (session ref session_ref, VMSS record args) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **args** (VMSS record) - Required - All constructor arguments ### Minimum Role pool-operator ### Return Type VMSS ref (reference to the newly created object) ``` -------------------------------- ### get_storage_lock Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vdi?lang-switch=true Get the storage_lock field of the given VDI. ```APIDOC ## RPC get_storage_lock ### Description Get the storage_lock field of the given VDI. ### Signature bool get_storage_lock (session ref session_ref, VDI ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VDI ref) - Required - reference to the object ### Return Type - **bool** - value of the field ``` -------------------------------- ### get_SR Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vdi?lang-switch=true Get the SR field of the given VDI. ```APIDOC ## RPC get_SR ### Description Get the SR field of the given VDI. ### Signature SR ref get_SR (session ref session_ref, VDI ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VDI ref) - Required - reference to the object ### Return Type - **SR ref** - value of the field ``` -------------------------------- ### Create VGPU RPC Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vgpu?lang-switch=true Creates a new VGPU instance. ```text VGPU ref create (session ref session_ref, VM ref VM, GPU_group ref GPU_group, string device, (string -> string) map other_config, VGPU_type ref type) ``` -------------------------------- ### get_snapshots Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vdi?lang-switch=true Get the snapshots field of the given VDI. ```APIDOC ## RPC get_snapshots ### Description Get the snapshots field of the given VDI. ### Signature VDI ref set get_snapshots (session ref session_ref, VDI ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VDI ref) - Required - reference to the object ### Return Type - **VDI ref set** - value of the field ``` -------------------------------- ### Execute asynchronous operations with Wait-XenTask Source: https://docs.xenserver.com/en-us/xenserver/developer/sdk-guide/using-ps-module Shows how to start a VM asynchronously and track the progress of the resulting task using Wait-XenTask. ```powershell Invoke-XenVM -Name $vm_name -XenAction Start -Async -PassThru |` Wait-XenTask -ShowProgress ``` -------------------------------- ### get_snapshot_time Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vdi?lang-switch=true Get the snapshot_time field of the given VDI. ```APIDOC ## RPC get_snapshot_time ### Description Get the snapshot_time field of the given VDI. ### Signature datetime get_snapshot_time (session ref session_ref, VDI ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VDI ref) - Required - reference to the object ### Return Type - **datetime** - value of the field ``` -------------------------------- ### Import Raw VDI with Chunked Data in Python Source: https://docs.xenserver.com/en-us/xenserver/developer/sdk-guide/using-http Example of using Python to perform a chunked VDI import, including the required completion header. ```python from io import BytesIO import os import requests from struct import pack from urllib import parse def upload(session_ref, vdi_ref, base_url): request_url = parse.urljoin(base_url, 'import_raw_vdi') params = {'session_id': session_ref, 'vdi': vdi_ref, 'format': 'raw', 'chunked': True} stream_data = BytesIO() # Write 1MB random data at 10 MB intervals for i in range(0, 9): offset = i * 10 * 1024 * 1024 size = 1 * 1024 * 1024 data = os.urandom(size) stream_data.write(pack(' string) map get_sm_config (session ref session_ref, VDI ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VDI ref) - Required - reference to the object ### Return Type - **(string -> string) map** - value of the field ``` -------------------------------- ### Create network Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-network Creates a new network instance and returns its handle. ```text network ref create (session ref session_ref, network record args) ``` -------------------------------- ### get_sharable Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vdi?lang-switch=true Get the sharable field of the given VDI. ```APIDOC ## RPC get_sharable ### Description Get the sharable field of the given VDI. ### Signature bool get_sharable (session ref session_ref, VDI ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VDI ref) - Required - reference to the object ### Return Type - **bool** - value of the field ``` -------------------------------- ### Introduce New Repository Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-repository?lang-switch=true Adds the configuration for a new remote repository. ```text Repository ref introduce (session ref session_ref, string name_label, string name_description, string binary_url, string source_url, bool update, string gpgkey_path) ``` -------------------------------- ### create Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmpp?lang-switch=true Creates a new VMPP instance. ```APIDOC ## RPC create ### Description Create a new VMPP instance, and return its handle. ### Signature VMPP ref create (session ref session_ref, VMPP record args) ### Arguments - **session_ref** (session ref) - Reference to a valid session - **args** (VMPP record) - All constructor arguments ### Minimum Role pool-operator ### Return Type VMPP ref (reference to the newly created object) ``` -------------------------------- ### get_VMs Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmpp?lang-switch=true Get the VMs field of the given VMPP. ```APIDOC ## RPC get_VMs ### Description Get the VMs field of the given VMPP. ### Signature VM ref set get_VMs (session ref session_ref, VMPP ref self) ### Arguments - **session_ref** (session ref) - Reference to a valid session - **self** (VMPP ref) - reference to the object ### Return Type - **VM ref set** - value of the field ``` -------------------------------- ### SR.introduce Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-sr Introduces a new Storage Repository into the managed system. ```APIDOC ## RPC: introduce ### Description Introduce a new Storage Repository into the managed system. ### Signature SR ref introduce (session ref session_ref, string uuid, string name_label, string name_description, string type, string content_type, bool shared, (string -> string) map sm_config) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **uuid** (string) - Required - The uuid assigned to the introduced SR - **name_label** (string) - Required - The name of the new storage repository - **name_description** (string) - Required - The description of the new storage repository - **type** (string) - Required - The type of the SR; used to specify the SR backend driver to use - **content_type** (string) - Required - The type of the new SRs content, if required (for example, ISOs) - **shared** (bool) - Required - True if the SR (is capable of) being shared by multiple hosts - **sm_config** ((string -> string) map) - Required - Storage backend specific configuration options ### Return Type SR ref (The reference of the newly introduced Storage Repository) ``` -------------------------------- ### get_uuid Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmpp?lang-switch=true Get the uuid field of the given VMPP. ```APIDOC ## RPC get_uuid ### Description Get the uuid field of the given VMPP. ### Signature string get_uuid (session ref session_ref, VMPP ref self) ### Arguments - **session_ref** (session ref) - Reference to a valid session - **self** (VMPP ref) - reference to the object ### Return Type - **string** - value of the field ``` -------------------------------- ### get_VMs Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmss?lang-switch=true Get the VMs field of the given VMSS. ```APIDOC ## RPC get_VMs ### Description Get the VMs field of the given VMSS. ### Signature VM ref set get_VMs (session ref session_ref, VMSS ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VMSS ref) - Required - reference to the object ### Return Type - **VM ref set** - value of the field ``` -------------------------------- ### apply_recommended_guidances Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-host Applies recommended guidances on the host and HVM VMs. ```APIDOC ## RPC apply_recommended_guidances ### Description apply all recommended guidances both on the host and on all HVM VMs on the host after updates are applied on the host ### Signature void apply_recommended_guidances (session ref session_ref, host ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (host ref) - Required - The host whose recommended guidances will be applied ### Minimum Role pool-operator ### Return Type void ``` -------------------------------- ### Create a Storage Repository (Deprecated) Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-sr?lang-switch=true Creates a new Storage Repository on disk. Use SR.create instead. ```text string make (session ref session_ref, host ref host, (string -> string) map device_config, int physical_size, string name_label, string name_description, string type, string content_type, (string -> string) map sm_config) ``` -------------------------------- ### get_backup_schedule Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmpp?lang-switch=true Get the backup_schedule field of the given VMPP. ```APIDOC ## RPC get_backup_schedule ### Description Get the backup_schedule field of the given VMPP. ### Signature (string -> string) map get_backup_schedule (session ref session_ref, VMPP ref self) ### Arguments - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VMPP ref) - Required - reference to the object ### Return Type (string -> string) map ``` -------------------------------- ### Create a new VM appliance Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vm_appliance Creates a new instance of a VM appliance and returns its reference handle. ```text VM_appliance ref create (session ref session_ref, VM_appliance record args) ``` -------------------------------- ### get_backup_retention_value Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmpp?lang-switch=true Get the backup_retention_value field of the given VMPP. ```APIDOC ## RPC get_backup_retention_value ### Description Get the backup_retention_value field of the given VMPP. ### Signature int get_backup_retention_value (session ref session_ref, VMPP ref self) ### Arguments - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VMPP ref) - Required - reference to the object ### Return Type int ``` -------------------------------- ### introduce Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-pool_update Introduce an update VDI to the pool. ```APIDOC ## RPC: introduce ### Description Introduce update VDI. ### Signature pool_update ref introduce (session ref session_ref, VDI ref vdi) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **vdi** (VDI ref) - Required - The VDI which contains a software update. ### Return Type - **pool_update ref** - The introduced pool update ### Minimum Role pool-operator ``` -------------------------------- ### get_backup_last_run_time Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmpp?lang-switch=true Get the backup_last_run_time field of the given VMPP. ```APIDOC ## RPC get_backup_last_run_time ### Description Get the backup_last_run_time field of the given VMPP. ### Signature datetime get_backup_last_run_time (session ref session_ref, VMPP ref self) ### Arguments - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VMPP ref) - Required - reference to the object ### Return Type datetime ``` -------------------------------- ### introduce_bundle Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-repository Adds the configuration for a new bundle repository. ```APIDOC ## RPC introduce_bundle ### Description Adds the configuration for a new bundle repository. ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **name_label** (string) - Required - The name of the repository - **name_description** (string) - Required - The description of the repository ### Return Type - **Repository ref** - The ref of the created repository record. ``` -------------------------------- ### get_backup_frequency Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmpp?lang-switch=true Get the backup_frequency field of the given VMPP. ```APIDOC ## RPC get_backup_frequency ### Description Get the backup_frequency field of the given VMPP. ### Signature vmpp_backup_frequency get_backup_frequency (session ref session_ref, VMPP ref self) ### Arguments - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VMPP ref) - Required - reference to the object ### Return Type vmpp_backup_frequency ``` -------------------------------- ### create Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vtpm Create a new VTPM instance and return its handle. ```APIDOC ## RPC: create ### Description Create a new VTPM instance, and return its handle. ### Signature `VTPM ref create (session ref session_ref, VM ref vM, bool is_unique)` ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **vM** (VM ref) - Required - The VM reference the VTPM will be attached to - **is_unique** (bool) - Required - Whether the VTPM must be unique ### Return Type - **VTPM ref** - The reference of the newly created VTPM ``` -------------------------------- ### get_archive_target_type Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmpp?lang-switch=true Get the archive_target_type field of the given VMPP. ```APIDOC ## RPC get_archive_target_type ### Description Get the archive_target_type field of the given VMPP. ### Signature vmpp_archive_target_type get_archive_target_type (session ref session_ref, VMPP ref self) ### Arguments - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VMPP ref) - Required - reference to the object ### Return Type vmpp_archive_target_type ``` -------------------------------- ### Create VBD Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vbd?lang-switch=true Creates a new VBD instance and returns its reference. ```text VBD ref create (session ref session_ref, VBD record args) ``` -------------------------------- ### get_archive_target_config Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmpp?lang-switch=true Get the archive_target_config field of the given VMPP. ```APIDOC ## RPC get_archive_target_config ### Description Get the archive_target_config field of the given VMPP. ### Signature (string -> string) map get_archive_target_config (session ref session_ref, VMPP ref self) ### Arguments - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VMPP ref) - Required - reference to the object ### Return Type (string -> string) map ``` -------------------------------- ### Configure Early Access or Normal Update Channels Source: https://docs.xenserver.com/en-us/xenserver/developer/sdk-guide/ps-apply-updates Use these scripts to introduce a base repository and an update channel repository, then associate it with the XenServer pool. ```PowerShell $baseBinUrl = "https://repo.ops.xenserver.com/xs8/base" $baseSrcUrl = "https://repo-src.ops.xenserver.com/xs8/base" $baseRepo = Invoke-XenRepository -Name "dummy" -XenAction Introduce` -BinaryUrl $baseBinUrl -SourceUrl $baseSrcUrl -Update $false ` -NameLabel "base_repo" -NameDescription "Base" -GpgkeyPath "" -PassThru $eaBinUrl = "https://repo.ops.xenserver.com/xs8/earlyaccess" $eaSrcUrl = "https://repo-src.ops.xenserver.com/xs8/earlyaccess" $updateRepo = Invoke-XenRepository -Name "dummy" -XenAction Introduce` -BinaryUrl $eaBinUrl -SourceUrl $eaSrcUrl -Update $true ` -NameLabel "early_access_repo" -NameDescription "Early Access" -GpgkeyPath "" -PassThru Get-XenPool | Add-XenPool -Repository $updateRepo.opaque_ref ``` ```PowerShell $baseBinUrl = "https://repo.ops.xenserver.com/xs8/base" $baseSrcUrl = "https://repo-src.ops.xenserver.com/xs8/base" $baseRepo = Invoke-XenRepository -Name "dummy" -XenAction Introduce` -BinaryUrl $baseBinUrl -SourceUrl $baseSrcUrl -Update $false ` -NameLabel "base_repo" -NameDescription "Base" -GpgkeyPath "" -PassThru $normBinUrl = "https://repo.ops.xenserver.com/xs8/normal" $normSrcUrl = "https://repo-src.ops.xenserver.com/xs8/normal" $updateRepo = Invoke-XenRepository -Name "dummy" -XenAction Introduce` -BinaryUrl $normBinUrl -SourceUrl $normSrcUrl -Update $true ` -NameLabel "normal_repo" -NameDescription "Normal" -GpgkeyPath "" -PassThru Get-XenPool | Add-XenPool -Repository $updateRepo.opaque_ref ``` -------------------------------- ### get_archive_schedule Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmpp?lang-switch=true Get the archive_schedule field of the given VMPP. ```APIDOC ## RPC get_archive_schedule ### Description Get the archive_schedule field of the given VMPP. ### Signature (string -> string) map get_archive_schedule (session ref session_ref, VMPP ref self) ### Arguments - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VMPP ref) - Required - reference to the object ### Return Type (string -> string) map ``` -------------------------------- ### create Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vdi?lang-switch=true Creates a new VDI instance. ```APIDOC ## RPC: create ### Description Create a new VDI instance, and return its handle. ### Signature VDI ref create (session ref session_ref, VDI record args) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **args** (VDI record) - Required - All constructor arguments ### Minimum Role vm-admin ### Return Type VDI ref (reference to the newly created object) ``` -------------------------------- ### get_archive_last_run_time Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmpp?lang-switch=true Get the archive_last_run_time field of the given VMPP. ```APIDOC ## RPC get_archive_last_run_time ### Description Get the archive_last_run_time field of the given VMPP. ### Signature datetime get_archive_last_run_time (session ref session_ref, VMPP ref self) ### Arguments - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VMPP ref) - Required - reference to the object ### Return Type datetime ``` -------------------------------- ### introduce Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-repository Adds the configuration for a new remote repository. ```APIDOC ## RPC introduce ### Description Add the configuration for a new remote repository. ### Signature Repository ref introduce (session ref session_ref, string name_label, string name_description, string binary_url, string source_url, bool update, string gpgkey_path) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **name_label** (string) - Required - The name of the repository - **name_description** (string) - Required - The description of the repository - **binary_url** (string) - Required - Base URL of binary packages in this repository - **source_url** (string) - Required - Base URL of source packages in this repository - **update** (bool) - Required - True if the repository is an update repository - **gpgkey_path** (string) - Required - The GPG public key file name ### Return Type - **Repository ref** - The ref of the created repository record. ``` -------------------------------- ### get_archive_frequency Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmpp?lang-switch=true Get the archive_frequency field of the given VMPP. ```APIDOC ## RPC get_archive_frequency ### Description Get the archive_frequency field of the given VMPP. ### Signature vmpp_archive_frequency get_archive_frequency (session ref session_ref, VMPP ref self) ### Arguments - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VMPP ref) - Required - reference to the object ### Return Type vmpp_archive_frequency ``` -------------------------------- ### Initialize project dependencies Source: https://docs.xenserver.com/en-us/xenserver/developer/sdk-guide/go Run these commands in your terminal to update and clean up your project's module dependencies before building. ```bash go get -u all go mod tidy ``` -------------------------------- ### get_uuid Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vmss?lang-switch=true Get the uuid field of the given VMSS. ```APIDOC ## RPC get_uuid ### Description Get the uuid field of the given VMSS. ### Signature string get_uuid (session ref session_ref, VMSS ref self) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **self** (VMSS ref) - Required - reference to the object ### Return Type - **string** - value of the field ``` -------------------------------- ### Get nomigrate Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vm_metrics?lang-switch=true Retrieves the nomigrate field value. ```text bool get_nomigrate (session ref session_ref, VM_metrics ref self) ``` -------------------------------- ### create Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-vif Create a new VIF instance, and return its handle. ```APIDOC ## RPC create ### Description Create a new VIF instance, and return its handle. ### Signature VIF ref create (session ref session_ref, VIF record args) ### Parameters - **session_ref** (session ref) - Required - Reference to a valid session - **args** (VIF record) - Required - All constructor arguments ### Minimum Role vm-admin ``` -------------------------------- ### RPC: introduce Source: https://docs.xenserver.com/en-us/xenserver/developer/xenserver-9/management-api/class-pvs_server?lang-switch=true Introduces a new PVS server to the system. ```APIDOC ## RPC introduce ### Description Introduces a new PVS server into the XenServer environment. ### Signature PVS_server ref introduce (session ref session_ref, string set addresses, int first_port, int last_port, PVS_site ref site) ### Arguments - **session_ref** (session ref) - Reference to a valid session - **addresses** (string set) - IPv4/IPv6 addresses of the server - **first_port** (int) - first UDP port accepted by this server - **last_port** (int) - last UDP port accepted by this server - **site** (PVS_site ref) - PVS site this server is a part of ### Minimum Role pool-operator ### Return Type - **PVS_server ref** - The new PVS server ```