Class: OvirtSDK4::ClustersService

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(cluster, opts = {}) ⇒ Cluster

Creates a new cluster.

This requires the name, cpu.type, and data_center attributes. Identify the data center with either the id or name attribute.

POST /ovirt-engine/api/clusters

With a request body like this:

<cluster>
  <name>mycluster</name>
  <cpu>
    <type>Intel Nehalem Family</type>
  </cpu>
  <data_center id="123"/>
</cluster>

To create a cluster with an external network provider to be deployed on every host that is added to the cluster, send a request like this:

POST /ovirt-engine/api/clusters

With a request body containing a reference to the desired provider:

<cluster>
  <name>mycluster</name>
  <cpu>
    <type>Intel Nehalem Family</type>
  </cpu>
  <data_center id="123"/>
  <external_network_providers>
    <external_provider name="ovirt-provider-ovn"/>
  </external_network_providers>
</cluster>

Parameters:

  • cluster (Cluster)

    The cluster 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:



5298
5299
5300
# File 'lib/ovirtsdk4/services.rb', line 5298

def add(cluster, opts = {})
  internal_add(cluster, Cluster, ADD, opts)
end

#cluster_service(id) ⇒ ClusterService

A reference to the service that manages a specific cluster.

Parameters:

  • id (String)

    The identifier of the cluster.

Returns:



5355
5356
5357
# File 'lib/ovirtsdk4/services.rb', line 5355

def cluster_service(id)
  ClusterService.new(self, id)
end

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

Returns the list of clusters of the system.

The order of the returned clusters 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 should be performed taking case into account. The default value is true, which means that case is taken into account. 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 clusters to return. If not specified, all the clusters are returned.

  • :search (String)

    A query string used to restrict the returned clusters.

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



5344
5345
5346
# File 'lib/ovirtsdk4/services.rb', line 5344

def list(opts = {})
  internal_get(LIST, opts)
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.



5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
# File 'lib/ovirtsdk4/services.rb', line 5366

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