Class: OvirtSDK4::HostNicService

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

Instance Method Summary (collapse)

Instance Method Details

- (HostNic) get(opts = {})

Returns the representation of the object managed by this service.

Parameters:

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

    Additional options.

Returns:



29194
29195
29196
29197
29198
29199
29200
29201
29202
29203
29204
29205
29206
29207
29208
29209
# File 'lib/ovirtsdk4/services.rb', line 29194

def get(opts = {})
  query = {}
  request = Request.new(:method => :GET, :path => @path, :query => query)
  response = @connection.send(request)
  case response.code
  when 200
    begin
      reader = XmlReader.new(response.body)
      return HostNicReader.read_one(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (NetworkAttachmentsService) network_attachments_service

Locates the network_attachments service.

Returns:



29244
29245
29246
# File 'lib/ovirtsdk4/services.rb', line 29244

def network_attachments_service
  return NetworkAttachmentsService.new(@connection, "#{@path}/networkattachments")
end

- (NetworkLabelsService) network_labels_service

Locates the network_labels service.

Returns:



29252
29253
29254
# File 'lib/ovirtsdk4/services.rb', line 29252

def network_labels_service
  return NetworkLabelsService.new(@connection, "#{@path}/networklabels")
end

- (Service) service(path)

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.

Raises:

  • (Error)


29289
29290
29291
29292
29293
29294
29295
29296
29297
29298
29299
29300
29301
29302
29303
29304
29305
29306
29307
29308
29309
29310
29311
29312
29313
29314
29315
29316
29317
29318
29319
29320
29321
29322
29323
29324
# File 'lib/ovirtsdk4/services.rb', line 29289

def service(path)
  if path.nil? || path == ''
    return self
  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 == 'networklabels'
    return network_labels_service
  end
  if path.start_with?('networklabels/')
    return network_labels_service.service(path[14..-1])
  end
  if path == 'statistics'
    return statistics_service
  end
  if path.start_with?('statistics/')
    return statistics_service.service(path[11..-1])
  end
  if path == 'virtualfunctionallowedlabels'
    return virtual_function_allowed_labels_service
  end
  if path.start_with?('virtualfunctionallowedlabels/')
    return virtual_function_allowed_labels_service.service(path[29..-1])
  end
  if path == 'virtualfunctionallowednetworks'
    return virtual_function_allowed_networks_service
  end
  if path.start_with?('virtualfunctionallowednetworks/')
    return virtual_function_allowed_networks_service.service(path[31..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

- (StatisticsService) statistics_service

Locates the statistics service.

Returns:



29260
29261
29262
# File 'lib/ovirtsdk4/services.rb', line 29260

def statistics_service
  return StatisticsService.new(@connection, "#{@path}/statistics")
end

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


29331
29332
29333
# File 'lib/ovirtsdk4/services.rb', line 29331

def to_s
  return "#<#{HostNicService}:#{@path}>"
end

- (Object) update_virtual_functions_configuration(opts = {})

The action updates virtual function configuration in case the current resource represents an SR-IOV enabled NIC. The input should be consisted of at least one of the following properties:

  • allNetworksAllowed

  • numberOfVirtualFunctions

Please see the HostNicVirtualFunctionsConfiguration type for the meaning of the properties.



29220
29221
29222
29223
29224
29225
29226
29227
29228
29229
29230
29231
29232
29233
29234
29235
29236
29237
29238
# File 'lib/ovirtsdk4/services.rb', line 29220

def update_virtual_functions_configuration(opts = {})
  action = Action.new(opts)
  writer = XmlWriter.new(nil, true)
  ActionWriter.write_one(action, writer)
  body = writer.string
  writer.close
  request = Request.new({
  :method => :POST,
  :path => "#{@path}/updatevirtualfunctionsconfiguration",
  :body => body,
  })
  response = @connection.send(request)
  case response.code
  when 200
    action = check_action(response)
  else
    check_fault(response)
  end
end

- (NetworkLabelsService) virtual_function_allowed_labels_service

Retrieves sub-collection resource of network labels that are allowed on an the virtual functions in case that the current resource represents an SR-IOV physical function NIC.

Returns:



29269
29270
29271
# File 'lib/ovirtsdk4/services.rb', line 29269

def virtual_function_allowed_labels_service
  return NetworkLabelsService.new(@connection, "#{@path}/virtualfunctionallowedlabels")
end

- (VirtualFunctionAllowedNetworksService) virtual_function_allowed_networks_service

Retrieves sub-collection resource of networks that are allowed on an the virtual functions in case that the current resource represents an SR-IOV physical function NIC.

Returns:



29278
29279
29280
# File 'lib/ovirtsdk4/services.rb', line 29278

def virtual_function_allowed_networks_service
  return VirtualFunctionAllowedNetworksService.new(@connection, "#{@path}/virtualfunctionallowednetworks")
end