1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-03 01:17:41 +03:00

B #5340 instance_types scripts now work properly (#442)

This commit is contained in:
Sergio Semedi Barranco 2017-09-05 14:29:23 +02:00 committed by Tino Vázquez
parent 871ceee91d
commit 936ef46d03
4 changed files with 152 additions and 11 deletions

View File

@ -9,12 +9,22 @@ doc = Nokogiri::HTML(content)
types = {}
doc.root.css("table tbody tr").each do |tr|
instanceType = tr.at_css("td[1]").text
first = true
doc.root.css("table").each do |table|
if first
first = false
next
end
table.css("tbody tr").each do |tr|
instanceType = tr.at_css("td[1]").text.gsub(/[^a-zA-Z0-9_.]/,"")
cpu = tr.at_css("td[2]").text.to_i
memory = tr.at_css("td[3]").text.split[0].to_f rescue nil
types[instanceType] = {"cpu" => cpu, "memory" => memory}
end
end
puts ({"instance_types" => types}).to_yaml(:indentation=>4)
puts "proxy_uri:"
puts ({"instance_types" => types}).to_yaml(:indentation=>4).gsub("---\n", '')

View File

@ -5,8 +5,8 @@ require 'pp'
require 'yaml'
require 'open-uri'
puts "Very slow script... hold on tight for a couple of minutes..."
puts
$stderr.reopen("/tmp/ec2_err", "w")
STDERR.puts "Very slow script... hold on tight for a couple of minutes..."
content = open('https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json').read
content = JSON.parse(content)
@ -14,12 +14,17 @@ content = JSON.parse(content)
types = {}
content["products"].each do |k,v|
instanceType = v["attributes"]["instanceType"]
next unless v["attributes"]["servicecode"] == "AmazonEC2"
memory = v["attributes"]["memory"].split[0].to_f rescue nil
cpu = v["attributes"]["vcpu"].to_i
if types[instanceType].nil? && instanceType && memory && cpu
types[instanceType] = {"cpu" => cpu, "memory" => memory}
types[instanceType] = {"cpu" => cpu, "memory" => memory} if instanceType.include?(".")
end
end
puts ({"instance_types" => types.sort.to_h}).to_yaml(:indentation=>4)
puts "proxy_uri:"
puts "state_wait_timeout_seconds: 300"
puts (({"instance_types" => types.sort.to_h}).to_yaml(:indentation=>4)).gsub("---\n", '')

View File

@ -2,7 +2,7 @@ proxy_uri:
instance_types:
ExtraSmall:
cpu: 1
memory: 0.75
memory: 0.768
Small:
cpu: 1
memory: 1.75
@ -36,6 +36,27 @@ instance_types:
A11:
cpu: 16
memory: 112.0
Standard_A1_v2:
cpu: 1
memory: 2.0
Standard_A2_v2:
cpu: 2
memory: 4.0
Standard_A4_v2:
cpu: 4
memory: 8.0
Standard_A8_v2:
cpu: 8
memory: 16.0
Standard_A2m_v2:
cpu: 2
memory: 16.0
Standard_A4m_v2:
cpu: 4
memory: 32.0
Standard_A8m_v2:
cpu: 8
memory: 64.0
Standard_D1:
cpu: 1
memory: 3.5
@ -90,3 +111,36 @@ instance_types:
Standard_D15_v2:
cpu: 20
memory: 140.0
Standard_G1:
cpu: 2
memory: 28.0
Standard_G2:
cpu: 4
memory: 56.0
Standard_G3:
cpu: 8
memory: 112.0
Standard_G4:
cpu: 16
memory: 224.0
Standard_G5:
cpu: 32
memory: 448.0
Standard_H8:
cpu: 8
memory: 56.0
Standard_H16:
cpu: 16
memory: 112.0
Standard_H8m:
cpu: 8
memory: 112.0
Standard_H16m:
cpu: 16
memory: 224.0
Standard_H16r:
cpu: 16
memory: 112.0
Standard_H16mr:
cpu: 16
memory: 224.0

View File

@ -61,12 +61,27 @@ instance_types:
d2.xlarge:
cpu: 4
memory: 30.5
f1.16xlarge:
cpu: 64
memory: 976.0
f1.2xlarge:
cpu: 8
memory: 122.0
g2.2xlarge:
cpu: 8
memory: 15.0
g2.8xlarge:
cpu: 32
memory: 60.0
g3.16xlarge:
cpu: 64
memory: 488.0
g3.4xlarge:
cpu: 16
memory: 122.0
g3.8xlarge:
cpu: 32
memory: 244.0
hi1.4xlarge:
cpu: 16
memory: 60.5
@ -85,6 +100,24 @@ instance_types:
i2.xlarge:
cpu: 4
memory: 30.5
i3.16xlarge:
cpu: 64
memory: 488.0
i3.2xlarge:
cpu: 8
memory: 61.0
i3.4xlarge:
cpu: 16
memory: 122.0
i3.8xlarge:
cpu: 32
memory: 244.0
i3.large:
cpu: 2
memory: 15.25
i3.xlarge:
cpu: 4
memory: 30.5
m1.large:
cpu: 2
memory: 7.5
@ -121,6 +154,9 @@ instance_types:
m4.10xlarge:
cpu: 40
memory: 160.0
m4.16xlarge:
cpu: 64
memory: 256.0
m4.2xlarge:
cpu: 8
memory: 32.0
@ -133,6 +169,15 @@ instance_types:
m4.xlarge:
cpu: 4
memory: 16.0
p2.16xlarge:
cpu: 64
memory: 768.0
p2.8xlarge:
cpu: 32
memory: 488.0
p2.xlarge:
cpu: 4
memory: 61.0
r3.2xlarge:
cpu: 8
memory: 61.0
@ -148,9 +193,30 @@ instance_types:
r3.xlarge:
cpu: 4
memory: 30.5
r4.16xlarge:
cpu: 64
memory: 488.0
r4.2xlarge:
cpu: 8
memory: 61.0
r4.4xlarge:
cpu: 16
memory: 122.0
r4.8xlarge:
cpu: 32
memory: 244.0
r4.large:
cpu: 2
memory: 15.25
r4.xlarge:
cpu: 4
memory: 30.5
t1.micro:
cpu: 1
memory: 0.613
t2.2xlarge:
cpu: 8
memory: 32.0
t2.large:
cpu: 2
memory: 8.0
@ -166,6 +232,12 @@ instance_types:
t2.small:
cpu: 1
memory: 2.0
t2.xlarge:
cpu: 4
memory: 16.0
x1.16xlarge:
cpu: 64
memory: 976.0
x1.32xlarge:
cpu: 128
memory: 1.0