Skip to content

Instantly share code, notes, and snippets.

(venv) root@developer:~/swift-s3-sync# ./venv/bin/nosetests ./test/integration
....EEEE
======================================================================
ERROR: test_swift_archive (test_s3_sync.TestCloudSync)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/swift-s3-sync/test/integration/test_s3_sync.py", line 331, in test_swift_archive
expected_location)
File "/root/swift-s3-sync/test/integration/test_s3_sync.py", line 237, in _test_archive
swift_hdrs, listing = wait_for_condition(5, _check_expired)
@chianingwang
chianingwang / GIF-Screencast-OSX.md
Created December 11, 2017 20:40 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

===proxy.conf===
pipeline = healthcheck proxy-logging cache swift3 bulk tempurl tempauth cloud_sync_shunt authtoken keystoneauth slo dlo proxy-logging proxy-server
[filter:keystoneauth]
use = egg:swift#keystoneauth
operator_roles = admin, swiftoperator
reseller_prefix = KEY_
reseller_admin_role = ResellerAdmin
@chianingwang
chianingwang / comparison.py
Last active January 10, 2018 22:42
find out source and destination cluster account - container conflict or account - container - object confliction
#!/usr/bin/python
import swiftclient
import pprint
import Queue
import threading
import time
import timeit
import keystoneclient
import ConfigParser
### after run proxy container###
$ apt install -y git curl
$ curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
$ python get-pip.py
$ pip install boto3
$ git clone https://github.com/swiftstack/swift-redirector.git
Mar 13 04:15:17 paco_test proxy-server: Calling Swift3 Middleware (txn: txe400ed7bb12349ac88f20-005aa75055)
Mar 13 04:15:17 paco_test proxy-server: {'access_key': 'test:tester', 'container_name': 'testbucket', '_timestamp': 1520914517.00000_0000000000000000, 'user_id': None, 'slo_enabled': True, '_signed_headers': set(['x-amz-content-sha256', 'host', 'x-amz-date']), 'string_to_sign': 'AWS4-HMAC-SHA256\n20180313T041517Z\n20180313/US/s3/aws4_request\n724c67ee09138d126844fc790130b610de66698b2c109b5ede8f8fcd0e974c4f', '_params_cache': {'delimiter': '/'}, 'headers': <swift.common.swob.HeaderEnvironProxy object at 0x7f18940990d0>, 'object_name': '', 'bucket_in_host': None, 'environ': {'HTTP_AUTHORIZATION': 'AWS test:tester:573710da5f8d6bf7ffa7ff9fac2465966d5b41881706db18bdc65c9f5a0e6baf', 'SCRIPT_NAME': '', 'swift.proxy_access_log_made': True, 'REQUEST_METHOD': 'GET', 'HTTP_X_AMZ_DATE': '20180313T041517Z', 'PATH_INFO': '/testbucket/', 'SERVER_PROTOCOL': 'HTTP/1.0', 'QUERY_STRING': 'delimiter=/', 'REMOTE_ADDR': '127
```
# /opt/ss/bin/python add_migrator_by_account_list.py -h
usage: add_migrator_by_account_list.py [-h] cluster accounts credential
positional arguments:
cluster name of the cluster
accounts file containing the account to use for migration
credential name of the credentials
optional arguments:
$ python range-read-object.py
0-104857599
{u'content-length': u'104857600', u'x-object-meta-mtime': u'1527050074.452', u'accept-ranges': u'bytes', u'last-modified': u'Mon, 16 Jul 2018 16:30:52 GMT', u'content-range': u'bytes 0-104857599/104857600', u'etag': u'978fe39760e4d83e05c41579c35c3596', u'x-timestamp': u'1531758651.12702', u'x-trans-id': u'tx24837f8789844924b69e7-005b4ce038', u'date': u'Mon, 16 Jul 2018 18:13:12 GMT', u'content-type': u'application/octet-stream', u'x-openstack-request-id': u'tx24837f8789844924b69e7-005b4ce038'}
Exiting Main Thread, Time Cost: 32.0516409874
$ cp read_list_2.csv read_list.csv
$ python range-read-object.py
52428800-1048575990-52428799
{u'content-length': u'52428800', u'x-object-meta-mtime': u'1527050074.452', u'accept-ranges': u'bytes', u'last-modified': u'Mon, 16 Jul 2018 16:30:52 GMT', u'content-range': u'bytes 52428800-104857599/104857600', u'etag': u'978fe39760e4d83e05c41579c35c3596', u'x-timestamp': u'1531758651.12702', u'x-trans-id': u'tx6c785c7ae7a74aa5a44dd-005b
$ cat read_list_1.csv
0-104857599
$ cat read_list_2.csv
0-52428799
52428800-104857599
$ cat read_list_10.csv
0-10485759
10485760-20971519
import hashlib
import itertools
import os
import swiftclient
import time
import logging
def copy_to_swift():
logger = logging.getLogger('swiftclient')
logger.setLevel('DEBUG')