Skip to main content

datacenter_hosts

Creates, updates, deletes, gets or lists a datacenter_hosts resource.

Overview​

Namedatacenter_hosts
TypeResource
Idovh.dedicated_cloud.datacenter_hosts

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
namestringName of the host (IP address)
host_idintegerId of the host (wire: hostId)
parent_host_idintegerId of the parent host (if any) (wire: parentHostId)
cluster_namestringCluster of the host (wire: clusterName)
resource_namestringResource name (wire: resourceName)
billing_typestringBilling type of the host (freeSpare, hourly, monthly, undefined) (wire: billingType)
connection_statestringConnection state of the host (connected, disconnected, notResponding) (wire: connectionState)
cpuobjectCPU total frenquency
cpu_maxintegerThe maximum speed of the cpu, in Mhz (wire: cpuMax)
cpu_max_coreintegerThe speed of the CPU cores. This is an average value if there are multiple speeds. in Mhz (wire: cpuMaxCore)
cpu_numintegerNumber of physical CPU cores on the host. (wire: cpuNum)
cpu_usedintegerCurrent cpu utilization, in Mhz (wire: cpuUsed)
in_maintenancebooleanHost is in maintenance mode (wire: inMaintenance)
memory_usednumberAmount of used memory. Sum of the memory used by all powered on virtual machines and vSphere services on the host. in MB (wire: memoryUsed)
profilestringHost profile in a commercial range
profile_codestringHost profile code (wire: profileCode)
rackstringRack of the host
ramobjectTotal RAM quantity
statestringState of the host (adding, delivered, error, removing, unknown)
uptimeintegerHost uptime in second
vm_totalintegerNumber of Virtual Machine on the host (wire: vmTotal)
vm_vcpu_totalintegerNumber of Vcpu use by virtual machines on the host (wire: vmVcpuTotal)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectdatacenter_id, host_id, service_nameGet a host. Returns the host: profile, state, connection state, cluster, CPU and memory usage, and number of virtual machines.
listselectdatacenter_id, service_namex_pagination_modeList hosts
add_host_spareexecdatacenterId, hostId, serviceName, reasonRequest a host replacement. Asks for a spare host to replace this host. A reason is required. Returns a task to track progress.
removeexecdatacenterId, hostId, serviceNameRemove a host

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
datacenterIdintegerId of the Datacenter
datacenter_idintegerId of the Datacenter (wire: datacenterId)
hostIdintegerId of the host
host_idintegerId of the host (wire: hostId)
serviceNamestringDomain of the service
service_namestringDomain of the service (wire: serviceName)
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

Get a host. Returns the host: profile, state, connection state, cluster, CPU and memory usage, and number of virtual machines.

SELECT
name,
host_id,
parent_host_id,
cluster_name,
resource_name,
billing_type,
connection_state,
cpu,
cpu_max,
cpu_max_core,
cpu_num,
cpu_used,
in_maintenance,
memory_used,
profile,
profile_code,
rack,
ram,
state,
uptime,
vm_total,
vm_vcpu_total
FROM ovh.dedicated_cloud.datacenter_hosts
WHERE datacenter_id = '{{ datacenter_id }}' -- required
AND host_id = '{{ host_id }}' -- required
AND service_name = '{{ service_name }}' -- required
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Request a host replacement. Asks for a spare host to replace this host. A reason is required. Returns a task to track progress.

EXEC ovh.dedicated_cloud.datacenter_hosts.add_host_spare
@datacenterId='{{ datacenterId }}' --required,
@hostId='{{ hostId }}' --required,
@serviceName='{{ serviceName }}' --required
@@json=
'{
"reason": "{{ reason }}"
}'
;