Class: OvirtSDK4::MacPoolsService

Inherits:
Service
  • Object
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

#add(pool, opts = {}) ⇒ MacPool

Creates a new MAC address pool.

Creation of a MAC address pool requires values for the name and ranges attributes.

For example, to create MAC address pool send a request like this:

POST /ovirt-engine/api/macpools

With a request body like this:

<mac_pool>
  <name>MACPool</name>
  <description>A MAC address pool</description>
  <allow_duplicates>true</allow_duplicates>
  <default_pool>false</default_pool>
  <ranges>
    <range>
      <from>00:1A:4A:16:01:51</from>
      <to>00:1A:4A:16:01:e6</to>
    </range>
  </ranges>
</mac_pool>

Parameters:

  • pool (MacPool)

    The pool to add.

  • 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.

Returns:



15707
15708
15709
# File 'lib/ovirtsdk4/services.rb', line 15707

def add(pool, opts = {})
  internal_add(pool, MacPool, ADD, opts)
end

#list(opts = {}) ⇒ Array<MacPool>

Return the list of MAC address pools of the system.

The returned list of MAC address pools isn’t guaranteed.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :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.

  • :max (Integer)

    Sets the maximum number of pools to return. If not specified all the pools are returned.

  • :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:



15741
15742
15743
# File 'lib/ovirtsdk4/services.rb', line 15741

def list(opts = {})
  internal_get(LIST, opts)
end

#mac_pool_service(id) ⇒ MacPoolService

Locates the mac_pool service.

Parameters:

  • id (String)

    The identifier of the mac_pool.

Returns:



15752
15753
15754
# File 'lib/ovirtsdk4/services.rb', line 15752

def mac_pool_service(id)
  MacPoolService.new(self, id)
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.



15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
# File 'lib/ovirtsdk4/services.rb', line 15763

def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return mac_pool_service(path)
  end
  return mac_pool_service(path[0..(index - 1)]).service(path[(index + 1)..-1])
end