def instances(credentials, opts=nil)
check_credentials( credentials )
instances = []
Dir[ "#{@storage_root}/instances/*.yml" ].each do |instance_file|
instance = YAML::load_file(instance_file)
if ( instance[:owner_id] == credentials.user )
instance[:id] = File.basename( instance_file, ".yml" )
instance[:actions] = instance_actions_for( instance[:state] )
instances << Instance.new( instance )
end
end
instances = filter_on( instances, :id, opts )
instances = filter_on( instances, :state, opts )
instances
end