in ebs/libraries/ebs_volume.rb [16:55]
def self.volume_id(device_name)
if self.has_ebs_tooling?
cmd = Mixlib::ShellOut.new("/sbin/ebsnvme-id #{device_name}")
cmd.run_command
if !Array(cmd.valid_exit_codes).include?(cmd.exitstatus)
if cmd.stderr =~ /Not an EBS device/
return nil
else
cmd.error!
end
end
cmd.stdout.lines.first.split(':')[1].strip
else
cmd = Mixlib::ShellOut.new("/usr/sbin/nvme id-ctrl #{device_name}")
cmd.run_command
cmd.error!
map = Hash[cmd.stdout.lines.map { |l| l.split(':', 2).map(&:strip) }]
return nil unless /Amazon Elastic Block/.match(map["mn"])
map["sn"].gsub(/^vol/, "vol-")
end
end