{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/2754","repository_url":"https://api.github.com/repos/ansible/ansible-modules-extras","labels_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/2754/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/2754/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/2754/events","html_url":"https://github.com/ansible/ansible-modules-extras/issues/2754","id":171904694,"number":2754,"title":"gluster_volume should add replica and stripe arguments when adding bricks","user":{"login":"afunix","id":5682770,"avatar_url":"https://avatars.githubusercontent.com/u/5682770?v=3","gravatar_id":"","url":"https://api.github.com/users/afunix","html_url":"https://github.com/afunix","followers_url":"https://api.github.com/users/afunix/followers","following_url":"https://api.github.com/users/afunix/following{/other_user}","gists_url":"https://api.github.com/users/afunix/gists{/gist_id}","starred_url":"https://api.github.com/users/afunix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afunix/subscriptions","organizations_url":"https://api.github.com/users/afunix/orgs","repos_url":"https://api.github.com/users/afunix/repos","events_url":"https://api.github.com/users/afunix/events{/privacy}","received_events_url":"https://api.github.com/users/afunix/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-18T13:45:43Z","updated_at":"2016-08-18T13:46:17Z","closed_at":null,"body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\ngluster_volume\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.1.1.0 (stable-2.1 137385059c) last updated 2016/07/13 17:51:42 (GMT +300)\r\n  lib/ansible/modules/core: (detached HEAD 887e7cf145) last updated 2016/07/13 17:51:49 (GMT +300)\r\n  lib/ansible/modules/extras: (detached HEAD e9c30f811f) last updated 2016/07/13 17:51:49 (GMT +300)\r\n  config file = /Users/cqx874/ansible/w7k-spb-lab-ansible/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### CONFIGURATION\r\n<!---\r\nMention any settings you have changed/added/removed in ansible.cfg\r\n(or using the ANSIBLE_* environment variables).\r\n-->\r\n\r\n##### OS / ENVIRONMENT\r\nOS: Mac OS X 10.11.6\r\n\r\n```\r\n$ cat ansible.cfg \r\n[defaults]\r\nroles_path = ./roles\r\nretry_files_enabled = False\r\n\r\n[ssh_connection]\r\npipelining=False\r\n```\r\n\r\n```\r\n$ env | grep ANSIBLE\r\nANSIBLE_VAULT_PASSWORD_FILE=/Users/cqx874/.vault\r\nANSIBLE_HOME=/Users/cqx874/ansible/ansible\r\n```\r\n\r\n\r\n##### SUMMARY\r\n`gluster_volume` module fails to add brick to a gluster volume as it issues gluster command without reconfiguration of stripes and replicas:\r\n`gluster volume add-brick XXX HOST:PATH force`\r\ninstead of\r\n`gluster volume add-brick XXX replica N HOST:PATH force`\r\n\r\n\r\n##### STEPS TO REPRODUCE\r\nRole has the following task\r\n```\r\n- name: Configure gluster volume\r\n  gluster_volume:\r\n    state=present\r\n    name=\"{{__gluster_volume_name}}\"\r\n    brick=\"/home/gluster/{{__gluster_volume_name}}/brick\"\r\n    replicas=\"{{__gluster_replica}}\"\r\n    cluster=\"{{__gluster_servers | join(',') }}\"\r\n    host=\"{{inventory_hostname}}\"\r\n    start_on_create=yes\r\n    transport=tcp\r\n    force=yes\r\n  run_once: true\r\n```\r\n\r\nInitial situation: gluster has a volume with two bricks and replica=2\r\nI've added a new host to the inventory.\r\n\r\n##### EXPECTED RESULTS\r\nI've expected the role would add a new brick.\r\n\r\n##### ACTUAL RESULTS\r\n`gluster_volume` failed:\r\n```\r\nerror running gluster (/usr/sbin/gluster volume add-brick engine node3:/home/gluster/engine/brick force) command (rc=1): volume add-brick: failed: Incorrect number of bricks supplied 1 with count 2\\n\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/comments/240727476","html_url":"https://github.com/ansible/ansible-modules-extras/issues/2754#issuecomment-240727476","issue_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/2754","id":240727476,"user":{"login":"afunix","id":5682770,"avatar_url":"https://avatars.githubusercontent.com/u/5682770?v=3","gravatar_id":"","url":"https://api.github.com/users/afunix","html_url":"https://github.com/afunix","followers_url":"https://api.github.com/users/afunix/followers","following_url":"https://api.github.com/users/afunix/following{/other_user}","gists_url":"https://api.github.com/users/afunix/gists{/gist_id}","starred_url":"https://api.github.com/users/afunix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afunix/subscriptions","organizations_url":"https://api.github.com/users/afunix/orgs","repos_url":"https://api.github.com/users/afunix/repos","events_url":"https://api.github.com/users/afunix/events{/privacy}","received_events_url":"https://api.github.com/users/afunix/received_events","type":"User","site_admin":false},"created_at":"2016-08-18T13:46:17Z","updated_at":"2016-08-18T13:46:17Z","body":"The patch for whoever may be interested:\r\n```\r\n--- ../ansible/lib/ansible/modules/extras/system/gluster_volume.py\t2016-03-14 14:37:19.000000000 +0300\r\n+++ library/cqx874_gluster_volume.py\t2016-08-18 16:28:37.000000000 +0300\r\n@@ -288,8 +288,14 @@ def stop_volume(name):\r\n def set_volume_option(name, option, parameter):\r\n     run_gluster([ 'volume', 'set', name, option, parameter ])\r\n \r\n-def add_bricks(name, new_bricks, force):\r\n+def add_bricks(name, new_bricks, stripe, replica, force):\r\n     args = [ 'volume', 'add-brick', name ]\r\n+    if stripe:\r\n+        args.append('stripe')\r\n+        args.append(str(stripe))\r\n+    if replica:\r\n+        args.append('replica')\r\n+        args.append(str(replica))\r\n     args.extend(new_bricks)\r\n     if force:\r\n         args.append('force')\r\n@@ -412,7 +418,7 @@ def main():\r\n                     removed_bricks.append(brick)\r\n \r\n             if new_bricks:\r\n-                add_bricks(volume_name, new_bricks, force)\r\n+                add_bricks(volume_name, new_bricks, stripes, replicas, force)\r\n                 changed = True\r\n \r\n             # handle quotas\r\n```"}}
{"actor":{"display_login":"afunix"}}