# File lib/ironfan/provider/ec2/ebs_volume.rb, line 27 def self.expected_ids(computer) computer.server.volumes.values.map do |volume| saved = computer.node[:volumes][volume.name][:volume_id] rescue nil ebs_name = "#{computer.server.full_name}-#{volume.name}" [ volume.volume_id, saved, ebs_name ] end.flatten.compact end
Discovery
# File lib/ironfan/provider/ec2/ebs_volume.rb, line 51 def self.load!(cluster=nil) Ec2.connection.volumes.each do |vol| next if vol.blank? next if ]deleting deleted error].include?(vol.state.to_s) ebs = EbsVolume.new(:adaptee => vol) # Already have a volume by this name if recall? ebs.name ebs.bogus << :duplicate_volumes recall(ebs.name).bogus << :duplicate_volumes remember ebs, :append_id => "duplicate:#{ebs.id}" else remember ebs end Chef::Log.debug("Loaded #{ebs}") end end
# File lib/ironfan/provider/ec2/ebs_volume.rb, line 25 def self.multiple?() true; end
# File lib/ironfan/provider/ec2/ebs_volume.rb, line 26 def self.resource_type() :ebs_volume; end
Manipulation
# File lib/ironfan/provider/ec2/ebs_volume.rb, line 96 def self.save!(computer) Ironfan.step(computer.name,"syncing EBS volumes",:blue) computer.drives.each do |drive| # Only worry about computers with ebs volumes ebs = drive.disk or next # Only attach volumes if they aren't already attached if ebs.server_id.nil? Ironfan.step(computer.name, " - attaching #{ebs.name}", :blue) Ironfan.safely do ebs.device = drive.volume.device ebs.server = computer.machine.adaptee end end end end
# File lib/ironfan/provider/ec2/ebs_volume.rb, line 80 def self.validate_computer!(computer) computer.drives.each do |drive| next unless drive.disk.class == EbsVolume [ (drive.node['volume_id'] rescue nil), (drive.volume.volume_id rescue nil) ].compact.each do |id| Chef::Log.debug "checking #{id} against ebs_volume id #{drive.disk.id}" id == drive.disk.id or drive.disk.bogus << :volume_id_mismatch end end end
# File lib/ironfan/provider/ec2/ebs_volume.rb, line 39 def drivename return id unless tags.key? "Name" tags["Name"].split('-').pop end
# File lib/ironfan/provider/ec2/ebs_volume.rb, line 44 def ephemeral_device? false end
# File lib/ironfan/provider/ec2/ebs_volume.rb, line 35 def name tags["Name"] || tags["name"] || id end
# File lib/ironfan/provider/ec2/ebs_volume.rb, line 73 def on_correlate(computer) drive = computer.drive(drivename) drive.disk = self drive.node = computer.node[:volumes][drivename].to_hash rescue {} drive end
Generated with the Darkfish Rdoc Generator 2.