Class: OvirtSDK4::VmHostDevicesService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#add(device, opts = {}) ⇒ HostDevice
Attach target device to given virtual machine.
-
#device_service(id) ⇒ VmHostDeviceService
Returns a reference to the service that manages a specific host device attached to given virtual machine.
-
#list(opts = {}) ⇒ Array<HostDevice>
List the host devices assigned to given virtual machine.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
Methods inherited from Service
Instance Method Details
#add(device, opts = {}) ⇒ HostDevice
Attach target device to given virtual machine.
Example:
POST /ovirt-engine/api/vms/123/hostdevices HTTP/1.1
With request body of type HostDevice, for example
<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 HostDevice 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.
33328 33329 33330 |
# File 'lib/ovirtsdk4/services.rb', line 33328 def add(device, opts = {}) internal_add(device, HostDevice, ADD, opts) end |
#device_service(id) ⇒ VmHostDeviceService
Returns a reference to the service that manages a specific host device attached to given virtual machine.
33373 33374 33375 |
# File 'lib/ovirtsdk4/services.rb', line 33373 def device_service(id) VmHostDeviceService.new(self, id) end |
#list(opts = {}) ⇒ Array<HostDevice>
List the host devices assigned to given virtual machine.
The order of the returned list of devices isn’t guaranteed.
33362 33363 33364 |
# File 'lib/ovirtsdk4/services.rb', line 33362 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
33384 33385 33386 33387 33388 33389 33390 33391 33392 33393 |
# File 'lib/ovirtsdk4/services.rb', line 33384 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 |