-
-
Save rubiojr/4336571 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
require 'fog' | |
require 'pp' | |
require 'benchmark' | |
conn = nil | |
Benchmark.bm do |x| | |
x.report 'connection:'.ljust(15) do | |
conn = Fog::Image.new({ | |
:provider => 'OpenStack', | |
:openstack_api_key => ENV['OS_PASSWORD'], | |
:openstack_username => ENV["OS_USERNAME"], | |
:openstack_auth_url => ENV["OS_AUTH_URL"] + "/tokens", | |
:openstack_tenant => ENV["OS_TENANT_NAME"], | |
:connection_options => { :ssl_verify_peer => false }, | |
}) | |
end | |
x.report 'create 10 images:'.ljust(15) do | |
10.times do | |
img = conn.create_image :name => 'test-img', | |
:disk_format => 'qcow2', | |
:container_format => 'bare', | |
:location => 'fake-img.img' | |
end | |
end | |
x.report 'list images:'.ljust(15) do | |
conn.images | |
end | |
x.report 'destroy images:'.ljust(15) do | |
conn.images.each { |img| img.destroy } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment