Skip to content

Instantly share code, notes, and snippets.

dfg@haio:~/hansible$ sudo lsof | grep /srv/hb/4/sdb8/objects/hec.db/index.db.0 | awk '{print $10}' | sort | uniq -c | sort -n
16 /srv/hb/4/sdb8/objects/hec.db/index.db.00
16 /srv/hb/4/sdb8/objects/hec.db/index.db.00-wal
16 /srv/hb/4/sdb8/objects/hec.db/index.db.01
16 /srv/hb/4/sdb8/objects/hec.db/index.db.01-wal
16 /srv/hb/4/sdb8/objects/hec.db/index.db.02
16 /srv/hb/4/sdb8/objects/hec.db/index.db.02-wal
16 /srv/hb/4/sdb8/objects/hec.db/index.db.03
16 /srv/hb/4/sdb8/objects/hec.db/index.db.03-wal
16 /srv/hb/4/sdb8/objects/hec.db/index.db.04
func TestSwiftObjectRoundtrip(t *testing.T) {
driveRoot, err := ioutil.TempDir("", "")
require.Nil(t, err)
defer os.RemoveAll(driveRoot)
testSwiftObjectRoundtrip(&SwiftEngine{driveRoot: driveRoot, hashPathPrefix: "prefix", hashPathSuffix: "suffix"}, t)
}
func TestNurseryObjectRoundtrip(t *testing.T) {
driveRoot, err := ioutil.TempDir("", "")
require.Nil(t, err)
[DEFAULT]
bind_ip = 127.0.0.1
bind_port = 8080
workers = 1
user = dfg
log_facility = LOG_LOCAL1
eventlet_debug = true
## FOR KEYSTONE !! tempauth_enabled = false
dfg@saio:~/go/src/github.com/troubling/hummingbird$ time swift-init main restart
Signal proxy-server pid: 8158 signal: 15
Signal container-server pid: 8159 signal: 15
Signal container-server pid: 8160 signal: 15
Signal container-server pid: 8161 signal: 15
Signal container-server pid: 8162 signal: 15
Signal account-server pid: 8163 signal: 15
Signal account-server pid: 8164 signal: 15
Signal account-server pid: 8165 signal: 15
Signal account-server pid: 8166 signal: 15
dfg@saio4:~/hbird-tests$ cat slo-read.py
import httplib
import time
for i in range(30):
c = httplib.HTTPConnection("127.0.0.1:8080")
c.request(
"GET",
"/v1/AUTH_dfg/hat/hugeman",
'',
dfg@saio4:~/go/src/github.com/openstack/swift/go/bench$ hummingbird dbench
Usage: [configuration file]
The configuration file should look something like:
[dbench]
address = http://localhost:6010/
concurrency = 15
object_size = 131072
num_objects = 5000
num_gets = 30000
do_replicates = false
from eventlet import sleep
from time import time
import random
from swift.common.wsgi import WSGIContext
from swift.common.swob import Request
from swift.common.utils import FileLikeIter, json
def slow_iter(req, wsgi_iter, data_to_read, sleep_time):
wsgi_iter = iter(wsgi_iter)
#!/usr/bin/python
import httplib
import json
import sys
if len(sys.argv) < 3:
print 'example: slob_test.py /v1/AUTH_dfg AUTH_tk81f3f8d0c2f34f706c48c'
sys.exit()
reset_conn = False
@dpgoetz
dpgoetz / gist:4046852
Created November 9, 2012 16:59
account OPTIONS call
This allows people to find out if an account is valid in swift (used to always just 401)
dfg@ubuntu:~/swift/swift$ curl -i http://127.0.0.1:8080/v1/AUTH_dfg -X OPTIONS
HTTP/1.1 200 OK
Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE
Content-Length: 0
Date: Fri, 09 Nov 2012 16:55:42 GMT
dfg@ubuntu:~/swift/swift$ curl -i http://127.0.0.1:8080/v1/asdf -X OPTIONS
HTTP/1.1 401 Unauthorized
@dpgoetz
dpgoetz / gist:4019111
Created November 5, 2012 17:52
cors diff
diff --git a/swift/proxy/controllers/base.py b/swift/proxy/controllers/base.py
index 582d007..4234493 100644
--- a/swift/proxy/controllers/base.py
+++ b/swift/proxy/controllers/base.py
@@ -39,7 +39,7 @@ from swift.common.exceptions import ChunkReadTimeout, ConnectionTimeout
from swift.common.http import is_informational, is_success, is_redirection, \
is_server_error, HTTP_OK, HTTP_PARTIAL_CONTENT, HTTP_MULTIPLE_CHOICES, \
HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVICE_UNAVAILABLE, \
- HTTP_INSUFFICIENT_STORAGE
+ HTTP_INSUFFICIENT_STORAGE, HTTP_UNAUTHORIZED