Class: OvirtSDK4::GlusterVolumesService

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

Creates a new gluster volume.

The volume is created based on properties of the volume parameter. The properties name, volume_type and bricks are required.

For example, to add a volume with name myvolume to the cluster 123, send the following request:

POST /ovirt-engine/api/clusters/123/glustervolumes

With the following request body:

<gluster_volume>
  <name>myvolume</name>
  <volume_type>replicate</volume_type>
  <replica_count>3</replica_count>
  <bricks>
    <brick>
      <server_id>server1</server_id>
      <brick_dir>/exp1</brick_dir>
    </brick>
    <brick>
      <server_id>server2</server_id>
      <brick_dir>/exp1</brick_dir>
    </brick>
    <brick>
      <server_id>server3</server_id>
      <brick_dir>/exp1</brick_dir>
    </brick>
  <bricks>
</gluster_volume>

Parameters:

  • volume (GlusterVolume)

    The gluster volume definition from which to create the volume is passed as input and the newly created volume is returned.

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



10550
10551
10552
# File 'lib/ovirtsdk4/services.rb', line 10550

def add(volume, opts = {})
  internal_add(volume, GlusterVolume, ADD, opts)
end

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

Lists all gluster volumes in the cluster.

For example, to list all Gluster Volumes in cluster 456, send a request like this:

GET /ovirt-engine/api/clusters/456/glustervolumes

The order of the returned list of volumes isn’t guaranteed.

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.

  • :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 volumes to return. If not specified all the volumes are returned.

  • :search (String)

    A query string used to restrict the returned volumes.

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



10600
10601
10602
# File 'lib/ovirtsdk4/services.rb', line 10600

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.



10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
# File 'lib/ovirtsdk4/services.rb', line 10622

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

#volume_service(id) ⇒ GlusterVolumeService

Reference to a service managing gluster volume.

Parameters:

  • id (String)

    The identifier of the volume.

Returns:



10611
10612
10613
# File 'lib/ovirtsdk4/services.rb', line 10611

def volume_service(id)
  GlusterVolumeService.new(self, id)
end