Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Issue #403: Add support for multiple bricks to gluster_volume #406

Merged
merged 3 commits into from
Apr 20, 2015
Merged

Issue #403: Add support for multiple bricks to gluster_volume #406

merged 3 commits into from
Apr 20, 2015

Conversation

rnowling
Copy link
Contributor

Adds support for creating volumes with multiple bricks and adding multiple bricks to a volume at a single time. I chose to override the brick parameter to take a string containing one or more paths separated by commas. Addresses Issue #403 .

@Jmainguy
Copy link
Contributor

Tested on Centos7 target. Works well.

[root@phy01 new]# ansible -i hosts all -m gluster_volume -a "name=test1 state=present bricks=/export/BRICK1/brick,/export/BRICK2/brick cluster=centos7.soh.re"                                
centos7.soh.re | FAILED >> {
    "failed": true,
    "msg": "unsupported parameter for module: bricks"
}

[root@phy01 new]# ansible -i hosts all -m gluster_volume -a "name=test1 state=present brick=/export/BRICK1/brick,/export/BRICK2/brick cluster=centos7.soh.re"                                 
centos7.soh.re | success >> {
    "ansible_facts": {
        "glusterfs": {
            "peers": {},
            "quotas": {},
            "volumes": {
                "test1": {
                    "bricks": [
                        "centos7.soh.re:/export/BRICK1/brick",
                        "centos7.soh.re:/export/BRICK2/brick"
                    ],
                    "id": "26320f78-0822-4c70-8a7b-ded51fb30dc4",
                    "name": "test1",
                    "options": {},
                    "quota": false,
                    "status": "Started",
                    "transport": "tcp"
                }
            }
        }
    },
    "changed": true
}


[root@centos7 BRICK1]# gluster volume info

Volume Name: test1
Type: Distribute
Volume ID: 26320f78-0822-4c70-8a7b-ded51fb30dc4
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: centos7.soh.re:/export/BRICK1/brick
Brick2: centos7.soh.re:/export/BRICK2/brick

@Jmainguy
Copy link
Contributor

@rnowling a few things I would suggest based on my test.

  1. change brick to bricks in the module and examples. (This would ensure that people in the future writing playbooks would use bricks instead of brick)
  2. Add an alias for bricks, named brick (This will ensure people who already have playbooks with brick in them, will still be able to use them)
  3. Add an example for creating a volume with multiple bricks. If there is an example that it can be used with one brick, or multiple, it would be great.

@bcoca @abadger what do you guys think about the above?

@rnowling
Copy link
Contributor Author

@Jmainguy thank you for taking the time to review my patch.

I changed the brick parameters to bricks and added brick as an alias. I added an example using multiple bricks -- can you check if that is what you had in mind?

bcoca added a commit that referenced this pull request Apr 20, 2015
Issue #403: Add support for multiple bricks to gluster_volume
@bcoca bcoca merged commit 048a3b8 into ansible:devel Apr 20, 2015
@coderlol
Copy link

coderlol commented Aug 1, 2015

With ansible 1.9.2, the module thinks the comma separated list is the name of a single volume. For some reason the module does not recognize "bricks" either. It does recognize "brick" as an argument.

Error: Failed to create brick directory for brick my-glusterfs-01:/gfs01/br01,/gfs02/br02. Reason : No such file or directory

/gfs01/br01 exists
/gfs02/br02 also exists

Linux networkmgmt-console1 3.16.0-41-generic #57~14.04.1-Ubuntu SMP Thu Jun 18 18:01:13 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

ansible --version

ansible 1.9.2
configured module search path = None

@rnowling
Copy link
Contributor Author

rnowling commented Aug 1, 2015

@coderlol these changes were made after 1.9.2. Please try pulling directly from Git and see if it solves your issues.

@coderlol
Copy link

coderlol commented Aug 7, 2015

Thx

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants