Class: OvirtSDK4::HostService

Inherits:
MeasurableService show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary collapse

Methods inherited from Service

#inspect, #to_s

Instance Method Details

#activate(opts = {}) ⇒ Object

Activates the host for use, for example to run virtual machines.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the activation should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


36922
36923
36924
# File 'lib/ovirtsdk4/services.rb', line 36922

def activate(opts = {})
  internal_action(:activate, nil, ACTIVATE, opts)
end

#affinity_labels_serviceAssignedAffinityLabelsService

List of scheduling labels assigned to this host.

Returns:


38209
38210
38211
# File 'lib/ovirtsdk4/services.rb', line 38209

def affinity_labels_service
  @affinity_labels_service ||= AssignedAffinityLabelsService.new(self, 'affinitylabels')
end

#approve(opts = {}) ⇒ Object

Approve a pre-installed Hypervisor host for usage in the virtualization environment.

This action also accepts an optional cluster element to define the target cluster for this host.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :activate (Boolean)

    When set to 'true', this host will be activated after its approval completes. When set to 'false' the host will remain in 'maintenance' status after its approval. Absence of this parameter will be interpreted as 'true', since the desired default behavior is activating the host after approval.

  • :async (Boolean)

    Indicates if the approval should be performed asynchronously.

  • :cluster (Cluster)

    The cluster where the host will be added after it is approved.

  • :host (Host)

    The host to approve.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


36961
36962
36963
# File 'lib/ovirtsdk4/services.rb', line 36961

def approve(opts = {})
  internal_action(:approve, nil, APPROVE, opts)
end

#approve_using_root_password(opts = {}) ⇒ Object

Executes the approve_using_root_password method.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :activate (Boolean)

    When set to 'true', this host will be activated after its approval completes. When set to 'false' the host will remain in 'maintenance' status after its approval. Absence of this parameter will be interpreted as 'true', since the desired default behavior is activating the host after approval.

  • :async (Boolean)

    Indicates if the approval should be performed asynchronously.

  • :cluster (Cluster)

    The cluster where the host will be added after it is approved.

  • :host (Host)

    The host to approve.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37994
37995
37996
# File 'lib/ovirtsdk4/services.rb', line 37994

def approve_using_root_password(opts = {})
  internal_action(:approve, nil, APPROVE_USING_ROOT_PASSWORD, opts)
end

#approve_using_ssh(opts = {}) ⇒ Object

Approve the specified host to be added to the engine by using ssh authentication. This occurs when the host registers itself with the engine.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :activate (Boolean)

    When set to 'true', this host will be activated after its approval completes. When set to 'false' the host will remain in 'maintenance' status after its approval. Absence of this parameter will be interpreted as 'true', since the desired default behavior is activating the host after approval.

  • :async (Boolean)

    Indicates if the approval should be performed asynchronously.

  • :cluster (Cluster)

    The cluster where the host will be added after it is approved.

  • :host (Host)

    The host to approve.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


38116
38117
38118
# File 'lib/ovirtsdk4/services.rb', line 38116

def approve_using_ssh(opts = {})
  internal_action(:approve, nil, APPROVE_USING_SSH, opts)
end

#commit_net_config(opts = {}) ⇒ Object

Marks the network configuration as good and persists it inside the host.

An API user commits the network configuration to persist a host network interface attachment or detachment, or persist the creation and deletion of a bonded interface.

Important
Networking configuration is only committed after the engine has established that host connectivity is not lost as a result of the configuration changes. If host connectivity is lost, the host requires a reboot and automatically reverts to the previous networking configuration.

For example, to commit the network configuration of host with id 123 send a request like this:

POST /ovirt-engine/api/hosts/123/commitnetconfig

With a request body like this:

<action/>
Important
Since engine-name 4.3, it is possible to also specify commit_on_success in the setupnetworks request, in which case the new configuration is automatically saved in the hypervisor-name upon completing the setup and re-establishing connectivity between the hypervisor-name and engine-name, and without waiting for a separate commitnetconfig request.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the action should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37014
37015
37016
# File 'lib/ovirtsdk4/services.rb', line 37014

def commit_net_config(opts = {})
  internal_action(:commitnetconfig, nil, COMMIT_NET_CONFIG, opts)
end

#copy_host_networks(opts = {}) ⇒ Object

Copy the network configuration of the specified host to current host.

To copy networks from another host, send a request like this:

POST /ovirt-engine/api/hosts/123/copyhostnetworks

With a request body like this:

<action>
   <sourceHost id="456" />
</action>

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the action should be performed asynchronously.

  • :source_host (Host)

    The host to copy networks from.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37059
37060
37061
# File 'lib/ovirtsdk4/services.rb', line 37059

def copy_host_networks(opts = {})
  internal_action(:copyhostnetworks, nil, COPY_HOST_NETWORKS, opts)
end

#deactivate(opts = {}) ⇒ Object

Deactivates the host to perform maintenance tasks.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the deactivation should be performed asynchronously.

  • :reason (String)
  • :stop_gluster_service (Boolean)

    Indicates if the gluster service should be stopped as part of deactivating the host. It can be used while performing maintenance operations on the gluster host. Default value for this variable is false.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37092
37093
37094
# File 'lib/ovirtsdk4/services.rb', line 37092

def deactivate(opts = {})
  internal_action(:deactivate, nil, DEACTIVATE, opts)
end

#devices_serviceHostDevicesService

A reference to the host devices service. Use this service to view the devices of the host object.

Returns:


38218
38219
38220
# File 'lib/ovirtsdk4/services.rb', line 38218

def devices_service
  @devices_service ||= HostDevicesService.new(self, 'devices')
end

#enroll_certificate(opts = {}) ⇒ Object

Enrolls the certificate of the host. Useful in case you get a warning that it is about to expire or has already expired.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the enrollment should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37119
37120
37121
# File 'lib/ovirtsdk4/services.rb', line 37119

def enroll_certificate(opts = {})
  internal_action(:enrollcertificate, nil, ENROLL_CERTIFICATE, opts)
end

#external_network_provider_configurations_serviceExternalNetworkProviderConfigurationsService

External network providers provisioned by the system on the host.

Returns:


38227
38228
38229
# File 'lib/ovirtsdk4/services.rb', line 38227

def external_network_provider_configurations_service
  @external_network_provider_configurations_service ||= ExternalNetworkProviderConfigurationsService.new(self, 'externalnetworkproviderconfigurations')
end

#fence(opts = {}) ⇒ Object

Controls the host’s power management device.

For example, to start the host. This can be done via:

#!/bin/sh -ex

url="https://engine.example.com/ovirt-engine/api"
user="[email protected]"
password="..."

curl \
--verbose \
--cacert /etc/pki/ovirt-engine/ca.pem \
--user "${user}:${password}" \
--request POST \
--header "Version: 4" \
--header "Content-Type: application/xml" \
--header "Accept: application/xml" \
--data '
<action>
  <fence_type>start</fence_type>
</action>
' \
"${url}/hosts/123/fence"

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the fencing should be performed asynchronously.

  • :fence_type (String)
  • :maintenance_after_restart (Boolean)

    Indicates if host should be put into maintenance after restart.

  • :power_management (PowerManagement)
  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37179
37180
37181
# File 'lib/ovirtsdk4/services.rb', line 37179

def fence(opts = {})
  internal_action(:fence, :power_management, FENCE, opts)
end

#fence_agents_serviceFenceAgentsService

A reference to the fence agents service. Use this service to manage fence and power management agents on the host object.

Returns:


38237
38238
38239
# File 'lib/ovirtsdk4/services.rb', line 38237

def fence_agents_service
  @fence_agents_service ||= FenceAgentsService.new(self, 'fenceagents')
end

#force_select_spm(opts = {}) ⇒ Object

To manually set a host as the storage pool manager (SPM).

POST /ovirt-engine/api/hosts/123/forceselectspm

With a request body like this:

<action/>

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the action should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37217
37218
37219
# File 'lib/ovirtsdk4/services.rb', line 37217

def force_select_spm(opts = {})
  internal_action(:forceselectspm, nil, FORCE_SELECT_SPM, opts)
end

#get(opts = {}) ⇒ Host

Gets the host details.

GET /ovirt-engine/api/hosts/123

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :all_content (Boolean)

    Indicates if all of the attributes of the host should be included in the response.

    By default the following attributes are excluded:

    • hosted_engine

    For example, to retrieve the complete representation of host '123':

    GET /ovirt-engine/api/hosts/123?all_content=true
    Note
    These attributes are not included by default because retrieving them impacts performance. They are seldom used and require additional queries to the database. Use this parameter with caution and only when specifically required.
  • :filter (Boolean)

    Indicates if the results should be filtered according to the permissions of the user.

  • :follow (String)

    Indicates which inner links should be followed. The objects referenced by these links will be fetched as part of the current request. See here for details.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:


37271
37272
37273
# File 'lib/ovirtsdk4/services.rb', line 37271

def get(opts = {})
  internal_get(GET, opts)
end

#hooks_serviceHostHooksService

A reference to the host hooks service. Use this service to view the hooks available in the host object.

Returns:


38246
38247
38248
# File 'lib/ovirtsdk4/services.rb', line 38246

def hooks_service
  @hooks_service ||= HostHooksService.new(self, 'hooks')
end

#install(opts = {}) ⇒ Object

Installs the latest version of VDSM and related software on the host.

The action also performs every configuration steps on the host which is done during adding host to the engine: kdump configuration, hosted-engine deploy, kernel options changes, etc.

The host type defines additional parameters for the action.

Example of installing a host, using curl and JSON, plain:

curl \
--verbose \
--cacert /etc/pki/ovirt-engine/ca.pem \
--request PUT \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Version: 4" \
--user "[email protected]:..." \
--data '
{
  "root_password": "myrootpassword"
}
' \
"https://engine.example.com/ovirt-engine/api/hosts/123"

Example of installing a host using curl and JSON with hosted engine components:

curl \
curl \
--verbose \
--cacert /etc/pki/ovirt-engine/ca.pem \
--request PUT \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Version: 4" \
--user "[email protected]:..." \
--data '
{
  "root_password": "myrootpassword"
}
' \
"https://engine.example.com/ovirt-engine/api/hosts/123?deploy_hosted_engine=true"
Important
Since version 4.1.2 of the engine, when a host is reinstalled we override the host firewall definitions by default.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :activate (Boolean)

    When set to 'true', this host will be activated after its installation completes. When set to 'false' the host will remain in 'maintenance' status after its installation. Absence of this parameter will be interpreted as 'true', since the desired default behavior is activating the host after install.

  • :async (Boolean)

    Indicates if the installation should be performed asynchronously.

  • :deploy_hosted_engine (Boolean)

    When set to true this host will also deploy the self-hosted engine components. A missing value is treated as true i.e deploy. Omitting this parameter means false and will not perform any operation in the self-hosted engine area.

  • :host (Host)

    The override_iptables property is used to indicate if the firewall configuration should be replaced by the default one.

  • :image (String)

    When installing hypervisor-name, an ISO image file is required.

  • :root_password (String)

    The password of the root user used to connect to the host via SSH.

  • :ssh (Ssh)

    The SSH details used to connect to the host.

  • :undeploy_hosted_engine (Boolean)

    When set to true this host will un-deploy the self-hosted engine components, and this host will not function as part of the High Availability cluster. A missing value is treated as true i.e un-deploy. Omitting this parameter means false and will not perform any operation in the self-hosted engine area.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37374
37375
37376
# File 'lib/ovirtsdk4/services.rb', line 37374

def install(opts = {})
  internal_action(:install, nil, INSTALL, opts)
end

#install_using_root_password(opts = {}) ⇒ Object

Install VDSM and other packages required to get the host ready to be used in the engine providing the root password. This has been deprecated.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :activate (Boolean)

    When set to 'true', this host will be activated after its installation completes. When set to 'false' the host will remain in 'maintenance' status after its installation. Absence of this parameter will be interpreted as 'true', since the desired default behavior is activating the host after install.

  • :async (Boolean)

    Indicates if the installation should be performed asynchronously.

  • :deploy_hosted_engine (Boolean)

    When set to true this host will also deploy the self-hosted engine components. A missing value is treated as true i.e deploy. Omitting this parameter means false and will not perform any operation in the self-hosted engine area.

  • :host (Host)

    The override_iptables property is used to indicate if the firewall configuration should be replaced by the default one.

  • :image (String)

    When installing hypervisor-name, an ISO image file is required.

  • :root_password (String)

    The password of the root user used to connect to the host via SSH.

  • :ssh (Ssh)

    The SSH details used to connect to the host.

  • :undeploy_hosted_engine (Boolean)

    When set to true this host will un-deploy the self-hosted engine components, and this host will not function as part of the High Availability cluster. A missing value is treated as true i.e un-deploy. Omitting this parameter means false and will not perform any operation in the self-hosted engine area.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


38049
38050
38051
# File 'lib/ovirtsdk4/services.rb', line 38049

def install_using_root_password(opts = {})
  internal_action(:install, nil, INSTALL_USING_ROOT_PASSWORD, opts)
end

#install_using_ssh(opts = {}) ⇒ Object

Install VDSM and other packages required to get the host ready to be used in the engine providing the SSH password.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :activate (Boolean)

    When set to 'true', this host will be activated after its installation completes. When set to 'false' the host will remain in 'maintenance' status after its installation. Absence of this parameter will be interpreted as 'true', since the desired default behavior is activating the host after install.

  • :async (Boolean)

    Indicates if the installation should be performed asynchronously.

  • :deploy_hosted_engine (Boolean)

    When set to true this host will also deploy the self-hosted engine components. A missing value is treated as true i.e deploy. Omitting this parameter means false and will not perform any operation in the self-hosted engine area.

  • :host (Host)

    The override_iptables property is used to indicate if the firewall configuration should be replaced by the default one.

  • :image (String)

    When installing hypervisor-name, an ISO image file is required.

  • :root_password (String)

    The password of the root user used to connect to the host via SSH.

  • :ssh (Ssh)

    The SSH details used to connect to the host.

  • :undeploy_hosted_engine (Boolean)

    When set to true this host will un-deploy the self-hosted engine components, and this host will not function as part of the High Availability cluster. A missing value is treated as true i.e un-deploy. Omitting this parameter means false and will not perform any operation in the self-hosted engine area.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


38171
38172
38173
# File 'lib/ovirtsdk4/services.rb', line 38171

def install_using_ssh(opts = {})
  internal_action(:install, nil, INSTALL_USING_SSH, opts)
end

#iscsi_discover(opts = {}) ⇒ Object

Discovers iSCSI targets on the host, using the initiator details.

For example, to discover iSCSI targets available in myiscsi.example.com, from host 123, send a request like this:

POST /ovirt-engine/api/hosts/123/iscsidiscover

With a request body like this:

<action>
  <iscsi>
    <address>myiscsi.example.com</address>
  </iscsi>
</action>

The result will be like this:

<discovered_targets>
  <iscsi_details>
    <address>10.35.1.72</address>
    <port>3260</port>
    <portal>10.35.1.72:3260,1</portal>
    <target>iqn.2015-08.com.tgt:444</target>
  </iscsi_details>
</discovered_targets>

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the discovery should be performed asynchronously.

  • :discovered_targets (Array<IscsiDetails>)

    The discovered targets including all connection information.

  • :iscsi (IscsiDetails)

    The target iSCSI device.

  • :iscsi_targets (Array<String>)

    The iSCSI targets.

    Since version 4.2 of the engine, this parameter is deprecated, use discovered_targets instead.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37443
37444
37445
# File 'lib/ovirtsdk4/services.rb', line 37443

def iscsi_discover(opts = {})
  internal_action(:iscsidiscover, :iscsi_targets, ISCSI_DISCOVER, opts)
end

#iscsi_login(opts = {}) ⇒ Object

Login to iSCSI targets on the host, using the target details.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the login should be performed asynchronously.

  • :iscsi (IscsiDetails)

    The target iSCSI device.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37472
37473
37474
# File 'lib/ovirtsdk4/services.rb', line 37472

def (opts = {})
  internal_action(:iscsilogin, nil, ISCSI_LOGIN, opts)
end

#katello_errata_serviceKatelloErrataService

A reference to the service that can show the applicable errata available on the host. This information is taken from Katello.

Returns:


38256
38257
38258
# File 'lib/ovirtsdk4/services.rb', line 38256

def katello_errata_service
  @katello_errata_service ||= KatelloErrataService.new(self, 'katelloerrata')
end

#network_attachments_serviceNetworkAttachmentsService

A reference to the network attachments service. You can use this service to attach Logical networks to host interfaces.

Returns:


38266
38267
38268
# File 'lib/ovirtsdk4/services.rb', line 38266

def network_attachments_service
  @network_attachments_service ||= NetworkAttachmentsService.new(self, 'networkattachments')
end

#nics_serviceHostNicsService

A reference to the service that manages the network interface devices on the host.

Returns:


38275
38276
38277
# File 'lib/ovirtsdk4/services.rb', line 38275

def nics_service
  @nics_service ||= HostNicsService.new(self, 'nics')
end

#numa_nodes_serviceHostNumaNodesService

A reference to the service that manage NUMA nodes for the host.

Returns:


38284
38285
38286
# File 'lib/ovirtsdk4/services.rb', line 38284

def numa_nodes_service
  @numa_nodes_service ||= HostNumaNodesService.new(self, 'numanodes')
end

#permissions_serviceAssignedPermissionsService

A reference to the host permission service. Use this service to manage permissions on the host object.

Returns:


38294
38295
38296
# File 'lib/ovirtsdk4/services.rb', line 38294

def permissions_service
  @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')
end

#refresh(opts = {}) ⇒ Object

Refresh the host devices and capabilities.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the refresh should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37498
37499
37500
# File 'lib/ovirtsdk4/services.rb', line 37498

def refresh(opts = {})
  internal_action(:refresh, nil, REFRESH, opts)
end

#remove(opts = {}) ⇒ Object

Remove the host from the system.

#!/bin/sh -ex

url="https://engine.example.com/ovirt-engine/api"
user="[email protected]"
password="..."

curl \
--verbose \
--cacert /etc/pki/ovirt-engine/ca.pem \
--user "${user}:${password}" \
--request DELETE \
--header "Version: 4" \
"${url}/hosts/1ff7a191-2f3b-4eff-812b-9f91a30c3acc"

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the remove should be performed asynchronously.

  • :force (Boolean)

    Indicates that the host should be removed even if it is non-responsive, or if it is part of a Gluster Storage cluster and has volume bricks on it.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37543
37544
37545
# File 'lib/ovirtsdk4/services.rb', line 37543

def remove(opts = {})
  internal_remove(REMOVE, opts)
end

#service(path) ⇒ Service

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.

Raises:


38350
38351
38352
38353
38354
38355
38356
38357
38358
38359
38360
38361
38362
38363
38364
38365
38366
38367
38368
38369
38370
38371
38372
38373
38374
38375
38376
38377
38378
38379
38380
38381
38382
38383
38384
38385
38386
38387
38388
38389
38390
38391
38392
38393
38394
38395
38396
38397
38398
38399
38400
38401
38402
38403
38404
38405
38406
38407
38408
38409
38410
38411
38412
38413
38414
38415
38416
38417
38418
38419
38420
38421
38422
38423
38424
38425
38426
38427
38428
38429
38430
38431
38432
38433
38434
38435
38436
38437
38438
38439
38440
38441
38442
38443
38444
38445
# File 'lib/ovirtsdk4/services.rb', line 38350

def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'affinitylabels'
    return affinity_labels_service
  end
  if path.start_with?('affinitylabels/')
    return affinity_labels_service.service(path[15..-1])
  end
  if path == 'devices'
    return devices_service
  end
  if path.start_with?('devices/')
    return devices_service.service(path[8..-1])
  end
  if path == 'externalnetworkproviderconfigurations'
    return external_network_provider_configurations_service
  end
  if path.start_with?('externalnetworkproviderconfigurations/')
    return external_network_provider_configurations_service.service(path[38..-1])
  end
  if path == 'fenceagents'
    return fence_agents_service
  end
  if path.start_with?('fenceagents/')
    return fence_agents_service.service(path[12..-1])
  end
  if path == 'hooks'
    return hooks_service
  end
  if path.start_with?('hooks/')
    return hooks_service.service(path[6..-1])
  end
  if path == 'katelloerrata'
    return katello_errata_service
  end
  if path.start_with?('katelloerrata/')
    return katello_errata_service.service(path[14..-1])
  end
  if path == 'networkattachments'
    return network_attachments_service
  end
  if path.start_with?('networkattachments/')
    return network_attachments_service.service(path[19..-1])
  end
  if path == 'nics'
    return nics_service
  end
  if path.start_with?('nics/')
    return nics_service.service(path[5..-1])
  end
  if path == 'numanodes'
    return numa_nodes_service
  end
  if path.start_with?('numanodes/')
    return numa_nodes_service.service(path[10..-1])
  end
  if path == 'permissions'
    return permissions_service
  end
  if path.start_with?('permissions/')
    return permissions_service.service(path[12..-1])
  end
  if path == 'statistics'
    return statistics_service
  end
  if path.start_with?('statistics/')
    return statistics_service.service(path[11..-1])
  end
  if path == 'storage'
    return storage_service
  end
  if path.start_with?('storage/')
    return storage_service.service(path[8..-1])
  end
  if path == 'storageconnectionextensions'
    return storage_connection_extensions_service
  end
  if path.start_with?('storageconnectionextensions/')
    return storage_connection_extensions_service.service(path[28..-1])
  end
  if path == 'tags'
    return tags_service
  end
  if path.start_with?('tags/')
    return tags_service.service(path[5..-1])
  end
  if path == 'unmanagednetworks'
    return unmanaged_networks_service
  end
  if path.start_with?('unmanagednetworks/')
    return unmanaged_networks_service.service(path[18..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

#setup_networks(opts = {}) ⇒ Object

This method is used to change the configuration of the network interfaces of a host.

For example, if you have a host with three network interfaces eth0, eth1 and eth2 and you want to configure a new bond using eth0 and eth1, and put a VLAN on top of it. Using a simple shell script and the curl command line HTTP client that can be done as follows:

#!/bin/sh -ex

url="https://engine.example.com/ovirt-engine/api"
user="[email protected]"
password="..."

curl \
--verbose \
--cacert /etc/pki/ovirt-engine/ca.pem \
--user "${user}:${password}" \
--request POST \
--header "Version: 4" \
--header "Content-Type: application/xml" \
--header "Accept: application/xml" \
--data '
<action>
  <modified_bonds>
    <host_nic>
      <name>bond0</name>
      <bonding>
        <options>
          <option>
            <name>mode</name>
            <value>4</value>
          </option>
          <option>
            <name>miimon</name>
            <value>100</value>
          </option>
        </options>
        <slaves>
          <host_nic>
            <name>eth1</name>
          </host_nic>
          <host_nic>
            <name>eth2</name>
          </host_nic>
        </slaves>
      </bonding>
    </host_nic>
  </modified_bonds>
  <modified_network_attachments>
    <network_attachment>
      <network>
        <name>myvlan</name>
      </network>
      <host_nic>
        <name>bond0</name>
      </host_nic>
      <ip_address_assignments>
        <assignment_method>static</assignment_method>
        <ip_address_assignment>
          <ip>
            <address>192.168.122.10</address>
            <netmask>255.255.255.0</netmask>
          </ip>
        </ip_address_assignment>
      </ip_address_assignments>
      <dns_resolver_configuration>
        <name_servers>
          <name_server>1.1.1.1</name_server>
          <name_server>2.2.2.2</name_server>
        </name_servers>
      </dns_resolver_configuration>
    </network_attachment>
  </modified_network_attachments>
 </action>
' \
"${url}/hosts/1ff7a191-2f3b-4eff-812b-9f91a30c3acc/setupnetworks"
Note
This is valid for version 4 of the API. In previous versions some elements were represented as XML attributes instead of XML elements. In particular the options and ip elements were represented as follows:
<options name="mode" value="4"/>
<options name="miimon" value="100"/>
<ip address="192.168.122.10" netmask="255.255.255.0"/>

The same thing can be done using the Python SDK with the following code:

# Find the service that manages the collection of hosts:
hosts_service = connection.system_service().hosts_service()

# Find the host:
host = hosts_service.list(search='name=myhost')[0]

# Find the service that manages the host:
host_service = hosts_service.host_service(host.id)

# Configure the network adding a bond with two slaves and attaching it to a
# network with an static IP address:
host_service.setup_networks(
    modified_bonds=[
        types.HostNic(
            name='bond0',
            bonding=types.Bonding(
                options=[
                    types.Option(
                        name='mode',
                        value='4',
                    ),
                    types.Option(
                        name='miimon',
                        value='100',
                    ),
                ],
                slaves=[
                    types.HostNic(
                        name='eth1',
                    ),
                    types.HostNic(
                        name='eth2',
                    ),
                ],
            ),
        ),
    ],
    modified_network_attachments=[
        types.NetworkAttachment(
            network=types.Network(
                name='myvlan',
            ),
            host_nic=types.HostNic(
                name='bond0',
            ),
            ip_address_assignments=[
                types.IpAddressAssignment(
                    assignment_method=types.BootProtocol.STATIC,
                    ip=types.Ip(
                        address='192.168.122.10',
                        netmask='255.255.255.0',
                    ),
                ),
            ],
            dns_resolver_configuration=types.DnsResolverConfiguration(
                name_servers=[
                    '1.1.1.1',
                    '2.2.2.2',
                ],
            ),
        ),
    ],
)

# After modifying the network configuration it is very important to make it
# persistent:
host_service.commit_net_config()
Important
To make sure that the network configuration has been saved in the host, and that it will be applied when the host is rebooted, remember to call commitnetconfig.
Important
Since engine-name 4.3, it is possible to also specify commit_on_success in the setupnetworks request, in which case the new configuration is automatically saved in the hypervisor-name upon completing the setup and re-establishing connectivity between the hypervisor-name and engine-name, and without waiting for a separate commitnetconfig request.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the action should be performed asynchronously.

  • :check_connectivity (Boolean)
  • :commit_on_success (Boolean)

    Specifies whether to automatically save the configuration in the hypervisor-name upon completing the setup and re-establishing connectivity between the hypervisor-name and engine-name, and without waiting for a separate commitnetconfig request. The default value is false, which means that the configuration will not be saved automatically.

  • :connectivity_timeout (Integer)
  • :modified_bonds (Array<HostNic>)
  • :modified_labels (Array<NetworkLabel>)
  • :modified_network_attachments (Array<NetworkAttachment>)
  • :removed_bonds (Array<HostNic>)
  • :removed_labels (Array<NetworkLabel>)
  • :removed_network_attachments (Array<NetworkAttachment>)
  • :synchronized_network_attachments (Array<NetworkAttachment>)

    A list of network attachments that will be synchronized.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37773
37774
37775
# File 'lib/ovirtsdk4/services.rb', line 37773

def setup_networks(opts = {})
  internal_action(:setupnetworks, nil, SETUP_NETWORKS, opts)
end

#statistics_serviceStatisticsService

Locates the statistics service.

Returns:


38303
38304
38305
# File 'lib/ovirtsdk4/services.rb', line 38303

def statistics_service
  @statistics_service ||= StatisticsService.new(self, 'statistics')
end

#storage_connection_extensions_serviceStorageServerConnectionExtensionsService

A reference to storage connection extensions.

Returns:


38321
38322
38323
# File 'lib/ovirtsdk4/services.rb', line 38321

def storage_connection_extensions_service
  @storage_connection_extensions_service ||= StorageServerConnectionExtensionsService.new(self, 'storageconnectionextensions')
end

#storage_serviceHostStorageService

A reference to the service that manages the host’s storage.

Returns:


38312
38313
38314
# File 'lib/ovirtsdk4/services.rb', line 38312

def storage_service
  @storage_service ||= HostStorageService.new(self, 'storage')
end

#sync_all_networks(opts = {}) ⇒ Object

To synchronize all networks on the host, send a request like this:

POST /ovirt-engine/api/hosts/123/syncallnetworks

With a request body like this:

<action/>

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the action should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37811
37812
37813
# File 'lib/ovirtsdk4/services.rb', line 37811

def sync_all_networks(opts = {})
  internal_action(:syncallnetworks, nil, SYNC_ALL_NETWORKS, opts)
end

#tags_serviceAssignedTagsService

A reference to the host tags service. Use this service to manage tags on the host object.

Returns:


38330
38331
38332
# File 'lib/ovirtsdk4/services.rb', line 38330

def tags_service
  @tags_service ||= AssignedTagsService.new(self, 'tags')
end

#unmanaged_networks_serviceUnmanagedNetworksService

A reference to unmanaged networks.

Returns:


38339
38340
38341
# File 'lib/ovirtsdk4/services.rb', line 38339

def unmanaged_networks_service
  @unmanaged_networks_service ||= UnmanagedNetworksService.new(self, 'unmanagednetworks')
end

#unregistered_storage_domains_discover(opts = {}) ⇒ Object

Discovers the block Storage Domains which are candidates to be imported to the setup. For FCP no arguments are required.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the discovery should be performed asynchronously.

  • :iscsi (IscsiDetails)
  • :storage_domains (Array<StorageDomain>)
  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37843
37844
37845
# File 'lib/ovirtsdk4/services.rb', line 37843

def unregistered_storage_domains_discover(opts = {})
  internal_action(:unregisteredstoragedomainsdiscover, :storage_domains, UNREGISTERED_STORAGE_DOMAINS_DISCOVER, opts)
end

#update(host, opts = {}) ⇒ Host

Update the host properties.

For example, to update a the kernel command line of a host send a request like this:

PUT /ovirt-engine/api/hosts/123

With request body like this:

<host>
  <os>
    <custom_kernel_cmdline>vfio_iommu_type1.allow_unsafe_interrupts=1</custom_kernel_cmdline>
  </os>
</host>

Parameters:

  • host (Host)

    The host to update.

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the update should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:


37890
37891
37892
# File 'lib/ovirtsdk4/services.rb', line 37890

def update(host, opts = {})
  internal_update(host, Host, UPDATE, opts)
end

#update_using_root_password(host, opts = {}) ⇒ Host

Update the specified host in the system. This is deprecated and is provided only for backwards compatibility.

Parameters:

  • host (Host)

    The host to update.

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the update should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:


38078
38079
38080
# File 'lib/ovirtsdk4/services.rb', line 38078

def update_using_root_password(host, opts = {})
  internal_update(host, Host, UPDATE_USING_ROOT_PASSWORD, opts)
end

#update_using_ssh(host, opts = {}) ⇒ Host

Updates the specified host in the system.

Parameters:

  • host (Host)

    The host to update.

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the update should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:


38200
38201
38202
# File 'lib/ovirtsdk4/services.rb', line 38200

def update_using_ssh(host, opts = {})
  internal_update(host, Host, UPDATE_USING_SSH, opts)
end

#upgrade(opts = {}) ⇒ Object

Upgrades VDSM and selected software on the host.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the upgrade should be performed asynchronously.

  • :image (String)

    This property is no longer relevant, since Vintage Node is no longer supported, and has been deprecated.

  • :reboot (Boolean)

    Indicates if the host should be rebooted after the upgrade. By default the host is rebooted.

    Note
    This parameter is ignored for hypervisor-name, which is always rebooted after the upgrade.
  • :timeout (Integer)

    Upgrade timeout.

    The maximum time to wait for upgrade to finish in minutes. Default value is specified by ANSIBLE_PLAYBOOK_EXEC_DEFAULT_TIMEOUT configration option.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37931
37932
37933
# File 'lib/ovirtsdk4/services.rb', line 37931

def upgrade(opts = {})
  internal_action(:upgrade, nil, UPGRADE, opts)
end

#upgrade_check(opts = {}) ⇒ Object

Check if there are upgrades available for the host. If there are upgrades available an icon will be displayed next to host status icon in the Administration Portal. Audit log messages are also added to indicate the availability of upgrades. The upgrade can be started from the webadmin or by using the upgrade host action.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.


37957
37958
37959
# File 'lib/ovirtsdk4/services.rb', line 37957

def upgrade_check(opts = {})
  internal_action(:upgradecheck, nil, UPGRADE_CHECK, opts)
end