Swift

class playback.swift.Swift(user='ubuntu', hosts=None, key_filename=None, password=None, parallel=True, *args, **kwargs)

Bases: playback.common.Common

Deploy swift proxy node

Parameters:
  • user(str) – the user for remote server to login
  • hosts(list) – this is a second param
  • key_filename(str) – the ssh private key to used, default None
  • password(str) – the password for remote server
  • parallel(bool) – paralleler execute on remote server, default True
Returns:

None

Examples:
# create swift proxy instances
swift_proxy1 = Swift(user='ubuntu', hosts=['controller1'])
swift_proxy2 = Swift(user='ubuntu', hosts=['controller2'])

# create the Identity service credentials(only do this at once)
swift_proxy1.create_service_credentials(
    os_password='changeme',
    os_auth_url='http://192.168.1.1:35357/v3',
    swift_pass='changeme',
    public_endpoint='http://192.168.1.1:8080/v1/AUTH_%\(tenant_id\)s',
    internal_endpoint='http://192.168.1.1:8080/v1/AUTH_%\(tenant_id\)s',
    admin_endpoint='http://192.168.1.1:8080/v1'
)

# install swift proxy
swift_proxy1.install(
    auth_uri='http://192.168.1.1:5000',
    auth_url='http://192.168.1.1:35357',
    swift_pass='changeme'
    memcached_servers='controller1:11211,controller2:11211',
    with_memcached=False # if True install memcached on this node
)
swift_proxy2.install(
    auth_uri='http://192.168.1.1:5000',
    auth_url='http://192.168.1.1:35357',
    swift_pass='changeme'
    memcached_servers='controller1:11211,controller2:11211',
    with_memcached=False # if True install memcached on this node
)

# see swift storage documents for full install of swift
create_service_credentials(*args, **kwargs)

Create the swift service credentials

Parameters:
  • os_password – the password of openstack admin user
  • os_auth_url – keystone endpoint url e.g. http://CONTROLLER_VIP:35357/v3
  • swift_pass – password of swift user
  • public_endpoint – public endpoint for swift service e.g. http://CONTROLLER_VIP:8080/v1/AUTH_%\(tenant_id\)s
  • internal_endpoint – internal endpoint for swift service e.g. http://CONTROLLER_VIP:8080/v1/AUTH_%\(tenant_id\)s
  • admin_endpoint – admin endpoint for swift service e.g. http://CONTROLLER_VIP:8080/v1
Returns:

None

finalize_install(*args, **kwargs)

Finalize swift installation

Parameters:
  • swift_hash_path_suffixswift_hash_path_suffix and swift_hash_path_prefix are used as part of the hashing algorithm when determining data placement in the cluster. These values should remain secret and MUST NOT change once a cluster has been deployed
  • swift_hash_path_prefixswift_hash_path_suffix and swift_hash_path_prefix are used as part of the hashing algorithm when determining data placement in the cluster. These values should remain secret and MUST NOT change once a cluster has been deployed
Returns:

None

install(*args, **kwargs)

Install swift proxy service

Parameters:
  • auth_uri – keystone internal endpoint e.g. http://CONTROLLER_VIP:5000
  • auth_url – keystone admin endpoint e.g. http://CONTROLLER_VIP:35357
  • swift_pass – password of swift user
  • memcached_servers – memcache servers e.g. CONTROLLER1:11211,CONTROLLER2:11211
  • with_memcached – install memcached on remote server, if you have other memcached on the controller node, you can use memcached_serser
Returns:

None