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

Fix gluster volume create force #79

Merged
merged 1 commit into from Dec 9, 2016

Conversation

Projects
None yet
2 participants
@shortdudey123
Owner

shortdudey123 commented Dec 9, 2016

Since we are allowing gluster volumes to be created on the root parition when lvm management is not being used, gluster volume create must have the force option added. Since the determination of the volume mount location happens in the compile phase, but the directory creation happens in the converge phase, the determination will always be false since the directory does not exist yet.

This moves the check and force directive into a lazy evaluation block so solve the problem.

* execute[gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick] action run

  ================================================================================
  Error executing action `run` on resource 'execute[gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick]'
  ================================================================================

  Mixlib::ShellOut::ShellCommandFailed
  ------------------------------------
  Expected process to exit with [0], but received '1'
  ---- Begin output of gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick ----
  STDOUT:
  STDERR: volume create: gv0: failed: The brick gluster2:/data/gv0/brick is being created in the root partition. It is recommended that you don't use the system's root partition for storage backend. Or use 'force' at the end of the command if you want to override this behavior.
  ---- End output of gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick ----
  Ran gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick returned 1

  Resource Declaration:
  ---------------------
  # In /tmp/kitchen/cache/cookbooks/gluster/recipes/server_setup.rb

  166:         execute "gluster volume create #{volume_name} #{options}" do
  167:           action :run
  168:           not_if options.empty?
  169:         end
  170:       end

  Compiled Resource:
  ------------------
  # Declared in /tmp/kitchen/cache/cookbooks/gluster/recipes/server_setup.rb:166:in `block in from_file'

  execute("gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick") do
    action [:run]
    retries 0
    retry_delay 2
    default_guard_interpreter :execute
    command "gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick"
    backup 5
    returns 0
    declared_type :execute
    cookbook_name "gluster"
    recipe_name "server_setup"
  end

  Platform:
  ---------
  x86_64-linux
Fix gluster volume create force
Since we are allowing gluster volumes to be created on the root parition when lvm management is not being used, gluster volume create must have the force option added.  Since the determination of the volume mount location happens in the compile phase, but the directory creation happens in the converge phase, the determination will always be false since the directory does not exist yet.

This moves the check and force directive into a lazy evaluation block so solve the problem.

```
* execute[gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick] action run

  ================================================================================
  Error executing action `run` on resource 'execute[gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick]'
  ================================================================================

  Mixlib::ShellOut::ShellCommandFailed
  ------------------------------------
  Expected process to exit with [0], but received '1'
  ---- Begin output of gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick ----
  STDOUT:
  STDERR: volume create: gv0: failed: The brick gluster2:/data/gv0/brick is being created in the root partition. It is recommended that you don't use the system's root partition for storage backend. Or use 'force' at the end of the command if you want to override this behavior.
  ---- End output of gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick ----
  Ran gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick returned 1

  Resource Declaration:
  ---------------------
  # In /tmp/kitchen/cache/cookbooks/gluster/recipes/server_setup.rb

  166:         execute "gluster volume create #{volume_name} #{options}" do
  167:           action :run
  168:           not_if options.empty?
  169:         end
  170:       end

  Compiled Resource:
  ------------------
  # Declared in /tmp/kitchen/cache/cookbooks/gluster/recipes/server_setup.rb:166:in `block in from_file'

  execute("gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick") do
    action [:run]
    retries 0
    retry_delay 2
    default_guard_interpreter :execute
    command "gluster volume create gv0 replica 2 gluster2:/data/gv0/brick gluster1:/data/gv0/brick"
    backup 5
    returns 0
    declared_type :execute
    cookbook_name "gluster"
    recipe_name "server_setup"
  end

  Platform:
  ---------
  x86_64-linux
```

@shortdudey123 shortdudey123 added the Bug label Dec 9, 2016

@shortdudey123

This comment has been minimized.

Show comment
Hide comment
@shortdudey123
Owner

shortdudey123 commented Dec 9, 2016

@theundefined

This comment has been minimized.

Show comment
Hide comment
@theundefined

theundefined Dec 9, 2016

Contributor

weird. I didn't noticed that issue :/ Now i see that i didn't destroyed second vm. And after second converge it works fine because directory alredy existed... Thanks for fix.

Contributor

theundefined commented Dec 9, 2016

weird. I didn't noticed that issue :/ Now i see that i didn't destroyed second vm. And after second converge it works fine because directory alredy existed... Thanks for fix.

@shortdudey123

This comment has been minimized.

Show comment
Hide comment
@shortdudey123

shortdudey123 Dec 9, 2016

Owner

No problem :)

Owner

shortdudey123 commented Dec 9, 2016

No problem :)

@shortdudey123 shortdudey123 merged commit 74bc7da into master Dec 9, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@shortdudey123 shortdudey123 deleted the fix_volume_create_force branch Dec 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment