Skip to content

Instantly share code, notes, and snippets.

@rubiojr
Forked from anonymous/glance-test.rb
Created December 19, 2012 13:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rubiojr/4336571 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