Class: OvirtSDK4::GlusterBricksService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#activate(opts = {}) ⇒ Object
Activate the bricks post data migration of remove brick operation.
-
#add(bricks, opts = {}) ⇒ Array<GlusterBrick>
Adds a list of bricks to gluster volume.
-
#brick_service(id) ⇒ GlusterBrickService
Returns a reference to the service managing a single gluster brick.
-
#list(opts = {}) ⇒ Array<GlusterBrick>
Lists the bricks of a gluster volume.
-
#migrate(opts = {}) ⇒ Object
Start migration of data prior to removing bricks.
-
#remove(opts = {}) ⇒ Object
Removes bricks from gluster volume.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
-
#stop_migrate(opts = {}) ⇒ Object
Stops migration of data from bricks for a remove brick operation.
Methods inherited from Service
Instance Method Details
#activate(opts = {}) ⇒ Object
Activate the bricks post data migration of remove brick operation.
Used to activate brick(s) once the data migration from bricks is complete but user no longer wishes to remove bricks. The bricks that were previously marked for removal will now be used as normal bricks.
For example, to retain the bricks that on glustervolume 123
from which data was migrated, send a request like
this:
POST /ovirt-engine/api/clusters/567/glustervolumes/123/glusterbricks/activate
With a request body like this:
<action>
<bricks>
<brick>
<name>host1:/rhgs/brick1</name>
</brick>
</bricks>
</action>
11101 11102 11103 |
# File 'lib/ovirtsdk4/services.rb', line 11101 def activate(opts = {}) internal_action(:activate, nil, ACTIVATE, opts) end |
#add(bricks, opts = {}) ⇒ Array<GlusterBrick>
Adds a list of bricks to gluster volume.
Used to expand a gluster volume by adding bricks. For replicated volume types, the parameter replica_count
needs to be passed. In case the replica count is being increased, then the number of bricks needs to be
equivalent to the number of replica sets.
For example, to add bricks to gluster volume 123
, send a request like this:
POST /ovirt-engine/api/clusters/567/glustervolumes/123/glusterbricks
With a request body like this:
<bricks>
<brick>
<server_id>111</server_id>
<brick_dir>/export/data/brick3</brick_dir>
</brick>
</bricks>
11157 11158 11159 |
# File 'lib/ovirtsdk4/services.rb', line 11157 def add(bricks, opts = {}) internal_add(bricks, List, ADD, opts) end |
#brick_service(id) ⇒ GlusterBrickService
Returns a reference to the service managing a single gluster brick.
11389 11390 11391 |
# File 'lib/ovirtsdk4/services.rb', line 11389 def brick_service(id) GlusterBrickService.new(self, id) end |
#list(opts = {}) ⇒ Array<GlusterBrick>
Lists the bricks of a gluster volume.
For example, to list bricks of gluster volume 123
, send a request like this:
GET /ovirt-engine/api/clusters/567/glustervolumes/123/glusterbricks
Provides an output as below:
<bricks>
<brick id="234">
<name>host1:/rhgs/data/brick1</name>
<brick_dir>/rhgs/data/brick1</brick_dir>
<server_id>111</server_id>
<status>up</status>
</brick>
<brick id="233">
<name>host2:/rhgs/data/brick1</name>
<brick_dir>/rhgs/data/brick1</brick_dir>
<server_id>222</server_id>
<status>up</status>
</brick>
</bricks>
The order of the returned list is based on the brick order provided at gluster volume creation.
11218 11219 11220 |
# File 'lib/ovirtsdk4/services.rb', line 11218 def list(opts = {}) internal_get(LIST, opts) end |
#migrate(opts = {}) ⇒ Object
Start migration of data prior to removing bricks.
Removing bricks is a two-step process, where the data on bricks to be removed, is first migrated to remaining bricks. Once migration is completed the removal of bricks is confirmed via the API remove. If at any point, the action needs to be cancelled stopmigrate has to be called.
For instance, to delete a brick from a gluster volume with id 123
, send a request:
POST /ovirt-engine/api/clusters/567/glustervolumes/123/glusterbricks/migrate
With a request body like this:
<action>
<bricks>
<brick>
<name>host1:/rhgs/brick1</name>
</brick>
</bricks>
</action>
11275 11276 11277 |
# File 'lib/ovirtsdk4/services.rb', line 11275 def migrate(opts = {}) internal_action(:migrate, nil, MIGRATE, opts) end |
#remove(opts = {}) ⇒ Object
Removes bricks from gluster volume.
The recommended way to remove bricks without data loss is to first migrate the data using stopmigrate and then removing them. If migrate was not called on bricks prior to remove, the bricks are removed without data migration which may lead to data loss.
For example, to delete the bricks from gluster volume 123
, send a request like this:
DELETE /ovirt-engine/api/clusters/567/glustervolumes/123/glusterbricks
With a request body like this:
<bricks>
<brick>
<name>host:brick_directory</name>
</brick>
</bricks>
11326 11327 11328 |
# File 'lib/ovirtsdk4/services.rb', line 11326 def remove(opts = {}) internal_remove(REMOVE, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 |
# File 'lib/ovirtsdk4/services.rb', line 11400 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return brick_service(path) end return brick_service(path[0..(index - 1)]).service(path[(index + 1)..-1]) end |
#stop_migrate(opts = {}) ⇒ Object
Stops migration of data from bricks for a remove brick operation.
To cancel data migration that was started as part of the 2-step remove brick process in case the user wishes to continue using the bricks. The bricks that were marked for removal will function as normal bricks post this operation.
For example, to stop migration of data from the bricks of gluster volume 123
, send a request like this:
POST /ovirt-engine/api/clusters/567/glustervolumes/123/glusterbricks/stopmigrate
With a request body like this:
<bricks>
<brick>
<name>host:brick_directory</name>
</brick>
</bricks>
11378 11379 11380 |
# File 'lib/ovirtsdk4/services.rb', line 11378 def stop_migrate(opts = {}) internal_action(:stopmigrate, nil, STOP_MIGRATE, opts) end |