class OvirtSDK4::HostService
Public Class Methods
Creates a new implementation of the service.
@param connection [Connection] The connection to be used by this service.
@param path [String] The relative path of this service, for example `vms/123/disks`.
@api private
# File lib/ovirtsdk4/services.rb, line 38638 def initialize(connection, path) @connection = connection @path = path end
Public Instance Methods
Activate the host for use, such as running virtual machines.
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the activation should be performed asynchronously.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 38654 def activate(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/activate", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end
List of scheduling labels assigned to this host.
@return [AssignedAffinityLabelsService] A reference to `affinity_labels` service.
# File lib/ovirtsdk4/services.rb, line 39649 def affinity_labels_service AssignedAffinityLabelsService.new(@connection, "#{@path}/affinitylabels") end
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.
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the approval should be performed asynchronously.
@option opts [Cluster] :cluster
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 38693 def approve(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/approve", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end
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:
- source
POST /ovirt-engine/api/hosts/123/commitnetconfig
With a request body like this:
- source,xml
<action/>
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the action should be performed asynchronously.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 38749 def commit_net_config(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/commitnetconfig", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end
Deactivate the host to perform maintenance tasks.
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the deactivation should be performed asynchronously.
@option opts [String] :reason
@option opts [Boolean] :stop_gluster_service 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`.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 38789 def deactivate(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/deactivate", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end
Reference to the host devices service. Use this service to view the devices of the host object.
@return [HostDevicesService] A reference to `devices` service.
# File lib/ovirtsdk4/services.rb, line 39659 def devices_service HostDevicesService.new(@connection, "#{@path}/devices") end
Enroll certificate of the host. Useful in case you get a warning that it is about to, or already expired.
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the enrollment should be performed asynchronously.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 38824 def enroll_certificate(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/enrollcertificate", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end
Controls host's power management device.
For example, let's assume you want to start the host. This can be done via:
- source
#!/bin/sh -ex
url=“engine.example.com/ovirt-engine/api” user=“admin@internal” 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”
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the fencing should be performed asynchronously.
@option opts [String] :fence_type
@option opts [PowerManagement] :power_management
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 38889 def fence(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/fence", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) return action.power_management else check_action(response) end end
Reference to the fence agents service. Use this service to manage fence and power management agents on the host object.
@return [FenceAgentsService] A reference to `fence_agents` service.
# File lib/ovirtsdk4/services.rb, line 39669 def fence_agents_service FenceAgentsService.new(@connection, "#{@path}/fenceagents") end
Manually set a host as the storage pool manager (SPM).
- source
POST /ovirt-engine/api/hosts/123/forceselectspm
With a request body like this:
- source,xml
<action/>
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the action should be performed asynchronously.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 38937 def force_select_spm(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/forceselectspm", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end
Get the host details.
@param opts [Hash] Additional options.
@option opts [Boolean] :filter Indicates if the results should be filtered according to the permissions of the user.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
@return [Host]
# File lib/ovirtsdk4/services.rb, line 38974 def get(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} value = opts[:filter] unless value.nil? value = Writer.render_boolean(value) query['filter'] = value end request = HttpRequest.new(method: :GET, url: @path, headers: headers, query: query) response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return HostReader.read_one(reader) ensure reader.close end else check_fault(response) end end
Reference to the host hooks service. Use this service to view the hooks available in the host object.
@return [HostHooksService] A reference to `hooks` service.
# File lib/ovirtsdk4/services.rb, line 39679 def hooks_service HostHooksService.new(@connection, "#{@path}/hooks") end
Install VDSM and related software on the host. The host type defines additional parameters for the action.
Example of installing a host, using `curl` and JSON, plain:
- source,bash
curl \ –verbose \ –cacert /etc/pki/ovirt-engine/ca.pem \ –request PUT \ –header “Content-Type: application/json” \ –header “Accept: application/json” \ –header “Version: 4” \ –user “admin@internal:…” \ –data ' {
"root_password": "myrootpassword"
} ' \ “engine.example.com/ovirt-engine/api/hosts/123”
Example of installing a host, using `curl` and JSON, with hosted engine components:
- source,bash
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 “admin@internal:…” \ –data ' {
"root_password": "myrootpassword"
} ' \ “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.
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the installation should be performed asynchronously.
@option opts [Boolean] :deploy_hosted_engine When set to `true` it means this host should deploy also hosted
engine components. Missing value is treated as `true` i.e deploy. Omitting this parameter means `false` and will perform no operation in hosted engine area.
@option opts [Host] :host This `override_iptables` property is used to indicate if the firewall configuration should be
replaced by the default one.
@option opts [String] :image When installing an oVirt node a image ISO file is needed.
@option opts [String] :root_password The password of of the `root` user, used to connect to the host via SSH.
@option opts [Ssh] :ssh The SSH details used to connect to the host.
@option opts [Boolean] :undeploy_hosted_engine When set to `true` it means this host should un-deploy hosted engine
components and this host will not function as part of the High Availability cluster. Missing value is treated as `true` i.e un-deploy Omitting this parameter means `false` and will perform no operation in hosted engine area.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 39072 def install(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/install", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end
Discover iSCSI targets on the host, using the initiator details.
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the discovery should be performed asynchronously.
@option opts [IscsiDetails] :iscsi The target iSCSI device.
@option opts [Array<String>] :iscsi_targets The iSCSI targets.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 39111 def iscsi_discover(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/iscsidiscover", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) return action.iscsi_targets else check_action(response) end end
Login to iSCSI targets on the host, using the target details.
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the login should be performed asynchronously.
@option opts [IscsiDetails] :iscsi The target iSCSI device.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 39149 def iscsi_login(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/iscsilogin", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end
Reference to the service that can show the applicable errata available on the host. This information is taken from Katello.
@return [KatelloErrataService] A reference to `katello_errata` service.
# File lib/ovirtsdk4/services.rb, line 39689 def katello_errata_service KatelloErrataService.new(@connection, "#{@path}/katelloerrata") end
Reference to the network attachments service. You can use this service to attach Logical networks to host interfaces.
@return [NetworkAttachmentsService] A reference to `network_attachments` service.
# File lib/ovirtsdk4/services.rb, line 39699 def network_attachments_service NetworkAttachmentsService.new(@connection, "#{@path}/networkattachments") end
Reference to the service that manages the network interface devices on the host.
@return [HostNicsService] A reference to `nics` service.
# File lib/ovirtsdk4/services.rb, line 39708 def nics_service HostNicsService.new(@connection, "#{@path}/nics") end
Reference to the service that manage NUMA nodes for the host.
@return [HostNumaNodesService] A reference to `numa_nodes` service.
# File lib/ovirtsdk4/services.rb, line 39717 def numa_nodes_service HostNumaNodesService.new(@connection, "#{@path}/numanodes") end
Reference to the host permission service. Use this service to manage permissions on the host object.
@return [AssignedPermissionsService] A reference to `permissions` service.
# File lib/ovirtsdk4/services.rb, line 39727 def permissions_service AssignedPermissionsService.new(@connection, "#{@path}/permissions") end
Refresh the host devices and capabilities.
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the refresh should be performed asynchronously.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 39184 def refresh(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/refresh", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end
Remove the host from the system.
- source
#!/bin/sh -ex
url=“engine.example.com/ovirt-engine/api” user=“admin@internal” 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”
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the remove should be performed asynchronously. @option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 39235 def remove(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} value = opts[:async] unless value.nil? value = Writer.render_boolean(value) query['async'] = value end request = HttpRequest.new(method: :DELETE, url: @path, headers: headers, query: query) response = @connection.send(request) unless response.code == 200 check_fault(response) end end
Locates the service corresponding to the given path.
@param path [String] The path of the service.
@return [Service] A reference to the service.
# File lib/ovirtsdk4/services.rb, line 39784 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 == '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
This method is used to change the configuration of the network interfaces of a host.
For example, lets assume that you have a host with three network interfaces `eth0`, `eth1` and `eth2` and that 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:
- source
#!/bin/sh -ex
url=“engine.example.com/ovirt-engine/api” user=“admin@internal” 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 that 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:
- source,xml
<options name=“mode” value=“4”/> <options name=“miimon” value=“100”/> <ip address=“192.168.122.10” netmask=“255.255.255.0”/>
Using the Python SDK the same can be done with the following code:
- source,python
# 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’)
# 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 <<services/host/methods/commit_net_config, commitnetconfig>>.
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the action should be performed asynchronously.
@option opts [Boolean] :check_connectivity
@option opts [Integer] :connectivity_timeout
@option opts [Array<HostNic>] :modified_bonds
@option opts [Array<NetworkLabel>] :modified_labels
@option opts [Array<NetworkAttachment>] :modified_network_attachments
@option opts [Array<HostNic>] :removed_bonds
@option opts [Array<NetworkLabel>] :removed_labels
@option opts [Array<NetworkAttachment>] :removed_network_attachments
@option opts [Array<NetworkAttachment>] :synchronized_network_attachments
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 39442 def setup_networks(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/setupnetworks", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end
Locates the `statistics` service.
@return [StatisticsService] A reference to `statistics` service.
# File lib/ovirtsdk4/services.rb, line 39736 def statistics_service StatisticsService.new(@connection, "#{@path}/statistics") end
Reference to storage connection extensions.
@return [StorageServerConnectionExtensionsService] A reference to `storage_connection_extensions` service.
# File lib/ovirtsdk4/services.rb, line 39754 def storage_connection_extensions_service StorageServerConnectionExtensionsService.new(@connection, "#{@path}/storageconnectionextensions") end
Reference to the service that manage hosts storage.
@return [HostStorageService] A reference to `storage` service.
# File lib/ovirtsdk4/services.rb, line 39745 def storage_service HostStorageService.new(@connection, "#{@path}/storage") end
Returns an string representation of this service.
@return [String]
# File lib/ovirtsdk4/services.rb, line 39880 def to_s "#<#{HostService}:#{@path}>" end
Reference to unmanaged networks.
@return [UnmanagedNetworksService] A reference to `unmanaged_networks` service.
# File lib/ovirtsdk4/services.rb, line 39773 def unmanaged_networks_service UnmanagedNetworksService.new(@connection, "#{@path}/unmanagednetworks") end
Executes the `unregistered_storage_domains_discover` method.
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the discovery should be performed asynchronously.
@option opts [IscsiDetails] :iscsi
@option opts [Array<StorageDomain>] :storage_domains
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 39481 def unregistered_storage_domains_discover(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/unregisteredstoragedomainsdiscover", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) return action.storage_domains else check_action(response) end end
Update the host properties.
For example, to update a the kernel command line of a host send a request like this:
- source
PUT /ovirt-engine/api/hosts/123
With request body like this:
- source, xml
<host>
<os> <custom_kernel_cmdline>vfio_iommu_type1.allow_unsafe_interrupts=1</custom_kernel_cmdline> </os>
</host>
@param host [Host] The `host` to update. @param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the update should be performed asynchronously.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
@return [Host]
# File lib/ovirtsdk4/services.rb, line 39538 def update(host, opts = {}) if host.is_a?(Hash) host = OvirtSDK4::Host.new(host) end headers = opts[:headers] || {} query = opts[:query] || {} value = opts[:async] unless value.nil? value = Writer.render_boolean(value) query['async'] = value end request = HttpRequest.new(method: :PUT, url: @path, headers: headers, query: query) begin writer = XmlWriter.new(nil, true) HostWriter.write_one(host, writer) request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return HostReader.read_one(reader) ensure reader.close end return result else check_fault(response) end end
Upgrade VDSM and selected software on the host.
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the upgrade should be performed asynchronously.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 39583 def upgrade(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/upgrade", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end
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 webadmin. Audit log messages are also added to indicate the availability of upgrades. The upgrade can be started from the webadmin or by using the <<services/host/methods/upgrade, upgrade>> host action.
@param opts [Hash] Additional options.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
# File lib/ovirtsdk4/services.rb, line 39620 def upgrade_check(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/upgradecheck", body: body, headers: headers, query: query ) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end