]> git.openstreetmap.org Git - chef.git/commitdiff
Report correct size for directly connected diaks
authorTom Hughes <tom@compton.nu>
Mon, 30 Nov 2015 17:18:11 +0000 (17:18 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 30 Nov 2015 17:18:11 +0000 (17:18 +0000)
cookbooks/hardware/templates/default/ohai.rb.erb

index 1b08dbfc68e6775dd1774f72547359ec4ea91f36..6a09804abaff1bfe19a024599cb8fb19e5ea3781 100644 (file)
@@ -150,7 +150,7 @@ Ohai.plugin(:Hardware) do
           block = Dir.glob("#{device}/block/*").first
           vendor = read_sysctl_file("#{device}/vendor")
           model = read_sysctl_file("#{device}/model")
-          size = read_sysctl_file("#{block}/size").to_i * 512
+          size = read_sysctl_file("#{block}/size").to_f / 2
 
           if vendor == "ATA" && model =~ /^(\S+)\s+(.*)$/
             vendor = Regexp.last_match(1)