Created
December 29, 2012 13:08
-
-
Save just-wow/4406853 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
devices.each do |device| | |
disk = new Hash | |
disk[:uuid] = get_device_uuid(device) | |
disk[:device] = device | |
if disk[:uuid].nil? | |
if has_partition_table(device) | |
if !empty_partition_table(device) | |
# probably there's some unsupported file system on the first partition - don't touch it | |
say("Unable to read disk UUID, although device seem to have data on it - skipping") | |
next | |
end | |
else | |
say("initializing device with new partition table") | |
create_partition_table(device) | |
end | |
create_xfs_partition(device) | |
disk[:uuid] = get_device_uuid(device) | |
enable_swift_disk(disk) | |
elsif node[:swift][:devs][disk[:uuid]] | |
# the disk is known and used | |
say("It's ok - we're already using this device for Swift") | |
else | |
# the disk is unknown but definitely has a certain structure - just don't touch it | |
say("disk ${device} seems to have data on it - skipping") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment