class OvirtSDK4::VmHostDevicesService

Constants

ADD
LIST

Public Instance Methods

add(device, opts = {}) click to toggle source

Attach target device to given virtual machine.

Example:

source

POST /ovirt-engine/api/vms/123/hostdevices


With request body of type xref:types-host_device, for example

source,xml

<host_device id=“123” />


NOTE: A necessary precondition for a successful host device attachment is that the virtual machine must be pinned to exactly one host. The device ID is then taken relative to this host.

NOTE: Attachment of a PCI device that is part of a bigger IOMMU group will result in attachment of the remaining devices from that IOMMU group as “placeholders”. These devices are then identified using the `placeholder` attribute of the xref:types-host_device type set to `true`.

In case you want attach a device that already serves as an IOMMU placeholder, simply issue an explicit Add operation for it, and its `placeholder` flag will be cleared, and the device will be accessible to the virtual machine.

@param device [HostDevice] The host device to be attached to given virtual machine.

@param opts [Hash] Additional options.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (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.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [HostDevice]

# File lib/ovirtsdk4/services.rb, line 33772
def add(device, opts = {})
  internal_add(device, HostDevice, ADD, opts)
end
device_service(id) click to toggle source

Returns a reference to the service that manages a specific host device attached to given virtual machine.

@param id [String] The identifier of the `device`.

@return [VmHostDeviceService] A reference to the `device` service.

# File lib/ovirtsdk4/services.rb, line 33817
def device_service(id)
  VmHostDeviceService.new(self, id)
end
list(opts = {}) click to toggle source

List the host devices assigned to given virtual machine.

The order of the returned list of devices isn't guaranteed.

@param opts [Hash] Additional options.

@option opts [String] :follow Indicates which inner links should be followed. The objects referenced by these links will be fetched as part

of the current request. See <<documents/003_common_concepts/follow, here>> for details.

@option opts [Integer] :max Sets the maximum number of devices to return. If not specified all the devices are returned.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (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.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [Array<HostDevice>]

# File lib/ovirtsdk4/services.rb, line 33806
def list(opts = {})
  internal_get(LIST, opts)
end
service(path) click to toggle source

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 33828
def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return device_service(path)
  end
  return device_service(path[0..(index - 1)]).service(path[(index + 1)..-1])
end