Skip to content

Instantly share code, notes, and snippets.

---
- name: Stop ssnoded
service: name=ssnoded state=stopped
- name: Stop swift services (Ubuntu or CentOS 6.x)
service: name=ssstop state=started
when: (ansible_distribution == 'CentOS' and ansible_distribution_major_version == '6')
or ansible_distribution == 'Ubuntu'
- name: Stop swift services (RHEL/CentOS 7.x)
# Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
=== create swift-paco-gowf ===
# create swift-paco-gowf docker container
$ docker run -i -t -d --net=host --hostname="swift-paco-gowf-test" --name="swift-paco-gowf-test" -v /srv/node/sdb1:/srv/node/sdb1:rw registry.swiftstack.com/swift-paco-gowf:queens-ss
# double check swift
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test stat -v
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list
=== create c7_systemd_gowf ===
import argparse
import os
import sys
def parse_args():
parser = argparse.ArgumentParser(
description='Given a list of migrations, add/edit/delete them.')
parser.add_argument('-a', '--action', required=True,
choices=['create', 'edit', 'delete'],
$ python test_conn.py
/tmp/test
REQ: curl -i https://test.swiftstack.org/auth/v1.0 -X GET
RESP STATUS: 200 OK
RESP HEADERS: {u'Content-Length': u'0', u'Set-Cookie': u'X-Auth-Token=AUT...', u'X-Trans-Id': u'tx2243b14f9d3141b08a9cc-005b5260dd', u'X-Auth-Token': u'AUTH_tk5f01bb73e...', u'X-Storage-Token': u'AUTH_tk5f01bb73e...', u'Date': u'Fri, 20 Jul 2018 22:23:25 GMT', u'X-Storage-Url': u'https://test.swiftstack.org/v1/AUTH_test', u'Content-Type': u'text/plain; charset=UTF-8', u'X-Openstack-Request-Id': u'tx2243b14f9d3141b08a9cc-005b5260dd'}
REQ: curl -i https://test.swiftstack.org/v1/AUTH_test/conn_test/test1.txt -X PUT -H "if-none-match: *" -H "X-Auth-Token: AUTH_tk5f01bb73e..."
RESP STATUS: 201 Created
RESP HEADERS: {u'Content-Length': u'0', u'Last-Modified': u'Fri, 20 Jul 2018 22:23:26 GMT', u'Etag': u'ed3dd25f7a5c84bf2a5adab19b982627', u'X-Trans-Id': u'tx4a1495b95ba045929ffe6-005b5260dd', u'Date': u'Fri, 20 Jul 2018 22:23:28 GMT', u'Content-Type': u'text/html; charset=UTF-8', u'X-Openstack-Request-Id': u'
import hashlib
import itertools
import os
import swiftclient
import time
import logging
def copy_to_swift():
logger = logging.getLogger('swiftclient')
logger.setLevel('DEBUG')
$ 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
$ 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
```
# /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:
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