4.9 Setting up Swift

Swift provides object-based persistent storage for virtual machines. Swift is disabled by default. In order to use object-based persistent storage, you need to first create Swift rings, then enable Swift in the deployment. The steps in this procedure are to be performed on a master node.

To set up Swift:

  1. Create and rebalance the Swift ring manually.

    You can use the following example configuration scripts as the basis for your Swift ring configuration.

    The scripts create the following required files in the /etc/kolla/config/swift directory on the master node:

    • account.builder

    • account.ring.gz

    • container.builder

    • container.ring.gz

    • object.builder

    • object.ring.gz

    Example 4.1 Swift multinode ring configuration script

    The following script is an example of setting up the Swift ring for a multinode deployment. The example uses a three-node storage array.

    The REGISTRY and TAG variables use the Kolla properties that contain the location and port of your OpenStack Docker registry and the OpenStack release number.

    Set the IP address for each storage node using the node_IP option in the STORAGE array at the start of the script, for example, STORAGE[1]=10.0.0.10.

    #!/usr/bin/env bash
    
    REGISTRY=registry_hostname:registry_port
    TAG=openstack_release
    
    STORAGE[1]=node_IP
    STORAGE[2]=node_IP
    STORAGE[3]=node_IP
    
    # Note: In this example, each storage node is placed in its own zone
    
    # Object ring
    docker run --rm \
      -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
      ${REGISTRY}/oracle/ol-openstack-swift-base:${TAG} \
      swift-ring-builder /etc/kolla/config/swift/object.builder create 10 3 1
    
    for NODE in 1 2 3; do
      echo "object.builder: Adding ${STORAGE[$NODE]} to zone z${NODE}"
      docker run --rm \
        -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
        ${REGISTRY}/oracle/ol-openstack-swift-base:${TAG} swift-ring-builder \
        /etc/kolla/config/swift/object.builder add z${NODE}-${STORAGE[$NODE]}:6000/sdb1 1
    done
    
    # Account ring
    docker run --rm \
      -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
      ${REGISTRY}/oracle/ol-openstack-swift-base:${TAG} \
      swift-ring-builder /etc/kolla/config/swift/account.builder create 10 3 1
    
    for NODE in 1 2 3; do
      echo "account.builder: Adding ${STORAGE[$NODE]} to zone z${NODE}"
      docker run --rm \
        -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
        ${REGISTRY}/oracle/ol-openstack-swift-base:${TAG} swift-ring-builder \
        /etc/kolla/config/swift/account.builder add z${NODE}-${STORAGE[$NODE]}:6001/sdb1 1
    done
    
    # Container ring
    docker run --rm \
      -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
      ${REGISTRY}/oracle/ol-openstack-swift-base:${TAG} \
      swift-ring-builder /etc/kolla/config/swift/container.builder create 10 3 1
    
    for NODE in 1 2 3; do
      echo "container.builder: Adding ${STORAGE[$NODE]} to zone z${NODE}"
      docker run --rm \
        -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
        ${REGISTRY}/oracle/ol-openstack-swift-base:${TAG} swift-ring-builder \
        /etc/kolla/config/swift/container.builder add z${NODE}-${STORAGE[$NODE]}:6002/sdb1 1
    done
    
    for ring in object account container; do
      docker run --rm \
        -v /etc/kolla/config/swift/:/etc/kolla/config/swift/ \
        ${REGISTRY}/oracle/ol-openstack-swift-base:${TAG} swift-ring-builder \
        /etc/kolla/config/swift/${ring}.builder rebalance
    done

  2. Enable the Swift service:

    $ kollacli property set enable_swift yes

For more information on configuring Swift, see the OpenStack Kolla documentation at:

http://docs.openstack.org/developer/kolla/swift-readme.html