I am getting error while creating snapshots.
volumes = conn.volumes.all().to_json
js = JSON.parse( volumes )
js.each { |k,v|
key = k
value = v
volumesid = key['id']
serverid = key['server_id']
if serverid == "#{instanceid}"
# getting the instance name
instance = conn.servers.get("#{instanceid}")
snapshot = conn.snapshots.new
snapshot.description = "Autosnap instance name: instance id: #{serverid} of volume id: #{volumesid}"
snapshot.volume_id = "#{volumesid}"
snapshot.save
conn.tags.create(:resource_id =>
snapshot.id, :key => "saas", :value => "snapshot", :key => "customername", :value => "#{instancename}" )