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>
9894 9895 9896 |
# File 'lib/ovirtsdk4/services.rb', line 9894 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>
9950 9951 9952 |
# File 'lib/ovirtsdk4/services.rb', line 9950 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.
10182 10183 10184 |
# File 'lib/ovirtsdk4/services.rb', line 10182 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.
10011 10012 10013 |
# File 'lib/ovirtsdk4/services.rb', line 10011 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>
10068 10069 10070 |
# File 'lib/ovirtsdk4/services.rb', line 10068 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>
10119 10120 10121 |
# File 'lib/ovirtsdk4/services.rb', line 10119 def remove(opts = {}) internal_remove(REMOVE, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 |
# File 'lib/ovirtsdk4/services.rb', line 10193 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>
10171 10172 10173 |
# File 'lib/ovirtsdk4/services.rb', line 10171 def stop_migrate(opts = {}) internal_action(:stopmigrate, nil, STOP_MIGRATE, opts) end |