Skip to content

Instantly share code, notes, and snippets.

Created December 19, 2012 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/4336558 to your computer and use it in GitHub Desktop.
Save anonymous/4336558 to your computer and use it in GitHub Desktop.
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