Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to create replica 3 arbiter 1 gluster volumes #48774

Merged
merged 6 commits into from Jul 26, 2018

Conversation

@jdito
Copy link
Contributor

@jdito jdito commented Jul 25, 2018

What does this PR do?

Adds the ability to create replica 3 arbiter 1 gluster volumes

What issues does this PR fix or reference?

#42955

Previous Behavior

Arbiter configuration was not exposed in glusterfs volume creation

New Behavior

Volumes can be created with arbiter (metadata-only replication) bricks

Tests written?

No

Commits signed with GPG?

No

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

jdito@sum-dev-03:/data/salt/salt/gluster$ cat cluster-startup.sls 
peer-cluster:
  glusterfs.peered:
    - names:
      - sum-glfiler-01.storage.dy.gl
      - sum-glfiler-02.storage.dy.gl
      - sum-glfiler-03.storage.dy.gl

{% for volume in ['users','public'] %}
{{ volume }}:
  glusterfs.volume_present:
    - bricks:
      - sum-glfiler-01.storage.dy.gl:/gluster/{{ volume }}/brick
      - sum-glfiler-02.storage.dy.gl:/gluster/{{ volume }}/brick
      - sum-glfiler-03.storage.dy.gl:/gluster/{{ volume }}/brick
    - replica: 3
    - arbiter: True
    - start: True
    - force: True

{% endfor %}
[root@sum-glfiler-03 ~]# salt-call state.apply gluster.cluster-startup
local:
----------
          ID: peer-cluster
    Function: glusterfs.peered
        Name: sum-glfiler-01.storage.dy.gl
      Result: True
     Comment: Host sum-glfiler-01.storage.dy.gl already peered
     Started: 15:31:24.035879
    Duration: 64.799 ms
     Changes:   
----------
          ID: peer-cluster
    Function: glusterfs.peered
        Name: sum-glfiler-02.storage.dy.gl
      Result: True
     Comment: Host sum-glfiler-02.storage.dy.gl already peered
     Started: 15:31:24.101094
    Duration: 58.168 ms
     Changes:   
----------
          ID: peer-cluster
    Function: glusterfs.peered
        Name: sum-glfiler-03.storage.dy.gl
      Result: True
     Comment: Peering with localhost is not needed
     Started: 15:31:24.159656
    Duration: 33.415 ms
     Changes:   
----------
          ID: users
    Function: glusterfs.volume_present
      Result: True
     Comment: Volume users is created and is started
     Started: 15:31:24.193509
    Duration: 4356.89 ms
     Changes:   
              ----------
              new:
                  - users
              old:
----------
          ID: public
    Function: glusterfs.volume_present
      Result: True
     Comment: Volume public is created and is started
     Started: 15:31:28.550847
    Duration: 3752.007 ms
     Changes:   
              ----------
              new:
                  - public
                  - users
              old:
                  - users

Summary for local
------------
Succeeded: 5 (changed=2)
Failed:    0
------------
Total states run:     5
Total run time:   8.265 s
[root@sum-glfiler-03 ~]# gluster volume info
 
Volume Name: public
Type: Replicate
Volume ID: 395e9b53-434f-4a07-9f55-5500ba7499ff
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x (2 + 1) = 3
Transport-type: tcp
Bricks:
Brick1: sum-glfiler-01.storage.dy.gl:/gluster/public/brick
Brick2: sum-glfiler-02.storage.dy.gl:/gluster/public/brick
Brick3: sum-glfiler-03.storage.dy.gl:/gluster/public/brick (arbiter)
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
 
Volume Name: users
Type: Replicate
Volume ID: 787af828-f09b-47fb-b7b9-88486899438d
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x (2 + 1) = 3
Transport-type: tcp
Bricks:
Brick1: sum-glfiler-01.storage.dy.gl:/gluster/users/brick
Brick2: sum-glfiler-02.storage.dy.gl:/gluster/users/brick
Brick3: sum-glfiler-03.storage.dy.gl:/gluster/users/brick (arbiter)
Options Reconfigured:
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
Copy link
Contributor

@rallytime rallytime left a comment

Thanks for submitting this addition @jdito - I have a couple of small requests.

@@ -217,8 +217,8 @@ def peer(name):
return _gluster(cmd)


def create_volume(name, bricks, stripe=False, replica=False, device_vg=False,
transport='tcp', start=False, force=False):
def create_volume(name, bricks, stripe=False, replica=False, arbiter=False,
Copy link
Contributor

@rallytime rallytime Jul 26, 2018

Can you move the new kwarg to the end of the list? We don't want to create an API change with this new addition.

Copy link
Contributor Author

@jdito jdito Jul 26, 2018

Done.

Valid configuration limited to "replica 3 arbiter 1" per \
Gluster documentation. Every third brick in the brick list \
is used as an arbiter brick.
Copy link
Contributor

@rallytime rallytime Jul 26, 2018

Can you add a .. versionadded:: Fluorine tag to these new docs?

Copy link
Contributor Author

@jdito jdito Jul 26, 2018

Done-ish? I wasn't 100% sure on the proper syntax for that tag. I added it just above the new documentation I added, but it looks slightly janky. Let me know if it's OK as-is, or if it should be done differently.

Copy link
Contributor

@rallytime rallytime Jul 26, 2018

Oh, you're close. It needs to be below the arg name. Something like this:

arbiter
    words words words

    .. versionadded:: Fluorine

Copy link
Contributor Author

@jdito jdito Jul 26, 2018

Ah! That looks much better. I tried putting it under initially, but didn't have a blank line after the "words words words" bit, so it didn't interpret it as a tag. Fixed now, thanks!

Copy link
Contributor

@rallytime rallytime Jul 26, 2018

Sure thing! Thanks for fixing this up so quickly!

def volume_present(name, bricks, stripe=False, replica=False, device_vg=False,
transport='tcp', start=False, force=False):
def volume_present(name, bricks, stripe=False, replica=False, arbiter=False,
device_vg=False, transport='tcp', start=False, force=False):
Copy link
Contributor

@rallytime rallytime Jul 26, 2018

Same comment here about the API change.

Copy link
Contributor Author

@jdito jdito Jul 26, 2018

Done.

replica count for volume
arbiter
use every third brick as arbiter (metadata only)
Copy link
Contributor

@rallytime rallytime Jul 26, 2018

This needs a version tag too. :)

Copy link
Contributor Author

@jdito jdito Jul 26, 2018

Done.

Valid configuration limited to "replica 3 arbiter 1" per \
Gluster documentation. Every third brick in the brick list \
is used as an arbiter brick.
Copy link
Contributor

@rallytime rallytime Jul 26, 2018

Sure thing! Thanks for fixing this up so quickly!

@rallytime rallytime merged commit f428d2a into saltstack:develop Jul 26, 2018
5 of 9 checks passed
@jdito jdito deleted the add-gluster-arbiter branch Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants