Chef

Mount Resource should handle LABEL and UUID

Details

  • Triage Status:
    Triaged

Description

If LABEL=xyz is provided in the device attribute the :mount action fails if the device is already mounted.

This happens because the mount command only reports device names and not labels and uuid's

Maybe one could add a 'label' and 'uuid' attribute

With label one could use -L for mounting, -l for checking mount and write LABEL=xyz to fstab
With uuid one could use -U for mounting, and write UUID=xyz to fstab. Unfortunately there is no checking switch for uuid devices

A workaround could be listing /dev/disks/by-uuid and looking at the symlink.

ls -la /dev/disk/by-uuid/1e1b7e8e-6e73-4f5c-beb9-516a0570ff7d
lrwxrwxrwx 1 root root 9 2009-03-20 13:04 /dev/disk/by-uuid/1e1b7e8e-6e73-4f5c-beb9-516a0570ff7d -> ../../sda

Miguel

Activity

Hide
Miguel Cabeça added a comment - 09/Apr/09 10:53 PM

Or just use findfs to translate the label and uuid to devices:

mail2:~# findfs LABEL=volume2
/dev/sdb

Show
Miguel Cabeça added a comment - 09/Apr/09 10:53 PM Or just use findfs to translate the label and uuid to devices: mail2:~# findfs LABEL=volume2 /dev/sdb
Hide
Miguel Cabeça added a comment - 13/Apr/09 2:42 PM

Mount resource now works with labels and uuids
New device_type attribute added. Can have values :device :label :uuid

Initial commit (needs some peer review):
http://github.com/cabeca/chef/commits/CHEF-187

Show
Miguel Cabeça added a comment - 13/Apr/09 2:42 PM Mount resource now works with labels and uuids New device_type attribute added. Can have values :device :label :uuid Initial commit (needs some peer review): http://github.com/cabeca/chef/commits/CHEF-187
Hide
Miguel Cabeça added a comment - 06/May/09 10:49 AM

Updated the spec to turn all existing tests green.
The tests even caught an error introduced by my modifications. Yay for RSpec.
Still missing specs for the new functionality (labels and uuids)

Show
Miguel Cabeça added a comment - 06/May/09 10:49 AM Updated the spec to turn all existing tests green. The tests even caught an error introduced by my modifications. Yay for RSpec. Still missing specs for the new functionality (labels and uuids)
Hide
Adam Jacob added a comment - 18/May/09 10:15 PM

Thanks for this, Miguel! Nice work - merged and pushed.

Show
Adam Jacob added a comment - 18/May/09 10:15 PM Thanks for this, Miguel! Nice work - merged and pushed.
Hide
Avishai Ish-Shalom added a comment - 09/May/10 5:33 PM

UUID and LABEL are not handled correctly.
for starters, line 43 in providers/mount/mount.rb reads:
if(@new_resource.device !~ /:/ && @new_resource.device !~ /\/\// && !::File.exists?(@new_resource.device) )
raise Chef::Exceptions::Mount, "Device #{@new_resource.device} does not exist"

which raises an exception on UUID and LABEL device types.

Show
Avishai Ish-Shalom added a comment - 09/May/10 5:33 PM UUID and LABEL are not handled correctly. for starters, line 43 in providers/mount/mount.rb reads: if(@new_resource.device !~ /:/ && @new_resource.device !~ /\/\// && !::File.exists?(@new_resource.device) ) raise Chef::Exceptions::Mount, "Device #{@new_resource.device} does not exist" which raises an exception on UUID and LABEL device types.
Hide
Avishai Ish-Shalom added a comment - 12/May/10 1:14 PM - edited
Show
Avishai Ish-Shalom added a comment - 12/May/10 1:14 PM - edited http://github.com/avishai-ish-shalom/chef/commit/2e060bdd0a18f205b1a56094187b247b12eeeb7d fixed another minor issue with uuid
Hide
Daniel DeLeo added a comment - 11/Jun/10 6:19 PM

I tried this a week ago and was getting failures in the spec tests, and now it unfortunately doesn't rebase cleanly. Can you re-apply the fix, add a regression test, and make sure the existing ones still pass?

Show
Daniel DeLeo added a comment - 11/Jun/10 6:19 PM I tried this a week ago and was getting failures in the spec tests, and now it unfortunately doesn't rebase cleanly. Can you re-apply the fix, add a regression test, and make sure the existing ones still pass?
Hide
Avishai Ish-Shalom added a comment - 13/Jun/10 8:22 AM - edited
Show
Avishai Ish-Shalom added a comment - 13/Jun/10 8:22 AM - edited http://github.com/avishai-ish-shalom/chef/commit/3d756375c9cb3ac7a2ec999f093dada7211eea0e (updated commit) BTW, the new spec tests look much better
Hide
Daniel DeLeo added a comment - 22/Jun/10 8:05 PM

This is merged to master, thanks for the patch.

by the way, It was a bit tricky to get your commits on to master, if you can publish branches to github in the future that let me keep an accurate record of what you contributed. We have instructions here: http://wiki.opscode.com/display/opscode/Working+with+Git and you can email me or find me in #chef-hacking on irc.freenode if you have questions.

Again, thanks for contributing!

Show
Daniel DeLeo added a comment - 22/Jun/10 8:05 PM This is merged to master, thanks for the patch. by the way, It was a bit tricky to get your commits on to master, if you can publish branches to github in the future that let me keep an accurate record of what you contributed. We have instructions here: http://wiki.opscode.com/display/opscode/Working+with+Git and you can email me or find me in #chef-hacking on irc.freenode if you have questions. Again, thanks for contributing!

People

Vote (0)
Watch (2)

Dates

  • Created:
    20/Mar/09 3:56 PM
    Updated:
    02/Jul/10 10:48 PM
    Resolved:
    13/Jun/10 8:22 AM