Class: OvirtSDK4::VmPoolsService

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 = {}) ⇒ VmPool

Creates a new virtual machine pool.

A new pool requires the name, cluster and template attributes. Identify the cluster and template with the id or name nested attributes:

POST /ovirt-engine/api/vmpools

With the following body:

<vmpool>
  <name>mypool</name>
  <cluster id="123"/>
  <template id="456"/>
</vmpool>

Parameters:

  • pool (VmPool)

    Pool to add.

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

    Additional options.

Options Hash (opts):

  • :seal (Boolean)

    Specifies if virtual machines created for the pool should be sealed after creation.

    If this optional parameter is provided, and its value is true, virtual machines created for the pool will be sealed after creation. If the value is 'false', the virtual machines will not be sealed. If the parameter is not provided, the virtual machines will be sealed, only if they are created from a sealed template and their guest OS is not set to Windows. This parameter affects only the virtual machines created when the pool is created.

    For example, to create a virtual machine pool with 5 virtual machines and to seal them, send a request like this:

    POST /ovirt-engine/api/vmpools?seal=true

    With the following body:

    <vmpool>
      <name>mypool</name>
      <cluster id="123"/>
      <template id="456"/>
      <size>5</size>
    </vmpool>
  • :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:



35024
35025
35026
# File 'lib/ovirtsdk4/services.rb', line 35024

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

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

Get a list of available virtual machines pools.

GET /ovirt-engine/api/vmpools

You will receive the following response:

<vm_pools>
  <vm_pool id="123">
    ...
  </vm_pool>
  ...
</vm_pools>

The order of the returned list of pools is guaranteed only if the sortby clause is included in the search parameter.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :case_sensitive (Boolean)

    Indicates if the search performed using the search parameter should be performed taking case into account. The default value is true, which means that case is taken into account. If you want to search ignoring case set it to false.

  • :filter (Boolean)

    Indicates if the results should be filtered according to the permissions of the user.

  • :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 this value is not specified, all of the pools are returned.

  • :search (String)

    A query string used to restrict the returned pools.

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



35087
35088
35089
# File 'lib/ovirtsdk4/services.rb', line 35087

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

#pool_service(id) ⇒ VmPoolService

Reference to the service that manages a specific virtual machine pool.

Parameters:

  • id (String)

    The identifier of the pool.

Returns:



35098
35099
35100
# File 'lib/ovirtsdk4/services.rb', line 35098

def pool_service(id)
  VmPoolService.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.



35109
35110
35111
35112
35113
35114
35115
35116
35117
35118
# File 'lib/ovirtsdk4/services.rb', line 35109

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