swift storage #395

Supports: bionic focal groovy hirsute impish


OpenStack Object Storage (code-named Swift) is open source software for creating redundant, scalable object storage using clusters of standardized servers to store petabytes of accessible data. It is not a file system or real-time data storage system, but rather a long-term storage system for a more permanent type of static data that can be retrieved, leveraged, and then updated if necessary. Primary examples of data that best fit this type of storage model are virtual machine images, photo storage, email storage and backup archiving. Having no central "brain" or master point of control provides greater scalability, redundancy and permanence. . This charm deploys the Swift storage service, supporting HTTP based access via Swift proxy services.


OpenStack Swift is a highly available, distributed, eventually consistent object/blob store.

The swift-storage charm deploys Swift's storage component. The charm's basic function is to initialise storage devices and manage the container, object, and account services. It works in tandem with the swift-proxy charm, which is used to add proxy nodes.



This section covers common configuration options. See file config.yaml for the full list of options, along with their descriptions and default values.


The zone option assigns a storage zone (an integer) to a storage node. A zone is associated with data replicas.


The block-device option specifies the device(s) that will be used on all machines associated with the application. Value types include:

  • an actual block device (e.g. 'sdb' or '/dev/sdb'). A space-separated list is used for multiple devices.
  • a path to a local file with the size appended after a pipe (e.g. '/etc/swift/storagedev1.img|5G'). The file will be created if necessary and be mapped to a loopback device. This is intended for development and testing purposes.

The resulting block device(s) will be XFS-formatted and use /srv/node/<device-name> as a mount point.


The storage-region option specifies a storage region (an integer). It is used only for multi-region (global) clusters.


Let file swift.yaml contain the deployment configuration:

        zone-assignment: manual
        replicas: 3
        zone: 1
        block-device: /dev/sdb
        zone: 2
        block-device: /dev/sdb
        zone: 3
        block-device: /dev/sdb

Deploy the proxy and storage nodes:

juju deploy --config swift.yaml swift-proxy
juju deploy --config swift.yaml swift-storage swift-storage-zone1
juju deploy --config swift.yaml swift-storage swift-storage-zone2
juju deploy --config swift.yaml swift-storage swift-storage-zone3

Add relations between the proxy node and all storage nodes:

juju add-relation swift-proxy:swift-storage swift-storage-zone1:swift-storage
juju add-relation swift-proxy:swift-storage swift-storage-zone2:swift-storage
juju add-relation swift-proxy:swift-storage swift-storage-zone3:swift-storage

This will result in a three-zone cluster, with each zone consisting of a single storage node, thereby satisfying the replica requirement of three.

Storage capacity is increased by adding swift-storage units to a zone. For example, to add two storage nodes to zone '3':

juju add-unit -n 2 swift-storage-zone3

Note: When scaling out ensure the candidate machines are equipped with the block devices currently configured for the associated application.

This charm will not balance the storage ring until there are enough storage zones to meet its minimum replica requirement, in this case three.

Appendix Swift usage in the OpenStack Charms Deployment Guide offers in-depth guidance for deploying Swift with charms. In particular, it shows how to set up a multi-region (global) cluster.


This section covers Juju actions supported by the charm. Actions allow specific operations to be performed on a per-unit basis.

  • openstack-upgrade
  • pause
  • resume

To display action descriptions run juju actions swift-storage.


Please report bugs on Launchpad.

For general charm questions refer to the OpenStack Charm Guide.


(int) Number of connections allowed to the account rsync stanza.
(int) Listening port of the swift-account-server.
(int) Listening port of the swift-account-replicator server.
(boolean) If True enables openstack upgrades for this charm via juju actions. You will still need to set openstack-origin to the new repository but instead of an upgrade running automatically across all units, it will wait for you to execute the openstack-upgrade action for this charm on each unit. If False it will revert to existing behavior of upgrading all units on config change.
(boolean) When this option is set to True the charm will disable the IPv6 support in ufw in case ip6tables couldn't be activated, situations where this could happen is in a LXC container running on top of a host that doesn't have loaded the ip6_tables. If this option is False (the default) and ip6_tables module couldn't be loaded, the charm will fail to install.
(string) Device to be used to back Swift storage. May be any valid block device or a path and size to a local file (/path/to/file.img|$sizeG), which will be created and used as a loopback device (for testing only). Multiple devices may be specified as a space-separated list of devices. If set to "guess", the charm will attempt to format and mount all extra block devices (this is currently experimental and potentially dangerous).
(int) Number of connections allowed to the container rsync stanza.
(int) Listening port of the swift-container-server.
(int) Listening port of the swift-container-replicator server.
(boolean) By default the swift-storage charm will use the UFW firewall to protect storage daemons. This option allows the administrator to disable this feature.
(boolean) Encrypt block devices used by swift using dm-crypt, making use of vault for encryption key management; requires a relation to vault.
(string) Cloud instances provide ephermeral storage which is normally mounted on /mnt. . Setting this option to the path of the ephemeral mountpoint will force an unmount of the corresponding device so that it can be used as a swift storage device. This is useful for testing purposes (cloud deployment is not a typical use case).
(int) Set the reserve space for the swift filesystem mounts. If a disk has less than this amount of space (in bytes) free, writes will be handed off to another disk in the ring.
(string) Apply system hardening. Supports a space-delimited list of modules to run. Supported modules currently include os, ssh, apache and mysql.
(string) String appended to nagios check
-m -r 60 180 10 20
(string) Space delimited parameters for check_swift_replicator_logs.sh. search_pattern interval_in_minutes minimum_hits_before_warning minimum_hits_before_critical Default of "replicated 15 2 1" leads to warning alert when there have not been at least 2 lines matching "replicated" in the last 15 minutes, and critical if there have been no matching lines in the last 15 minutes. Set to blank string "" to disable the check.
replicated 15 2 1
(string) Used by the nrpe-external-master subordinate charm. A string that will be prepended to instance name to set the host name in nagios. So for instance the hostname would be something like: juju-myservice-0 If you're running multiple environments with the same services in them this allows you to differentiate between them.
(string) A comma-separated list of nagios servicegroups. If left empty, the nagios_context will be used as the servicegroup
(int) Timeout value used when copying account/container/object data between nodes.
(boolean) If set to True, partitions that are not supposed to be on the node will be replicated first. The default setting should not be changed, except for extreme situations.
(int) Attempt to kill all workers if nothing replicates for this amount of seconds Note: this will always be set to no less than 2*object-rsync-timeout.
(int) Number of connections allowed to the object rsync stanza.
(int) Number of replication workers to spawn.
(int) Max duration of a partition rsync (in seconds).
(int) Listening port of the swift-object-server.
(int) Listening port of the swift-object-replicator server.
(int) Size of the per-disk thread pool used for performing disk I/O. 0 means to not use a per-disk thread pool. It is recommended to keep this value small, as large values can result in high read latencies due to large queue depths. A good starting point is 4 threads per disk.
(string) Repository from which to install. May be one of the following: distro (default), ppa:somecustom/ppa, a deb url sources entry, or a supported Ubuntu Cloud Archive release pocket. Supported Ubuntu Cloud Archive sources include: cloud:<series>-<openstack-release> cloud:<series>-<openstack-release>/updates cloud:<series>-<openstack-release>/staging cloud:<series>-<openstack-release>/proposed NOTE: updating this setting to a source that is known to provide a later version of OpenStack will trigger a software upgrade unless the action-managed-upgrade configuration option is in play.
(string) If true, charm will attempt to unmount and overwrite existing and in-use block-devices (WARNING).
(boolean) If True enables IPv6 support. The charm will expect network interfaces to be configured with an IPv6 address. If set to False (default) IPv4 is expected. NOTE: these charms do not currently support IPv6 privacy extension. In order for this charm to function correctly, the privacy extension must be disabled and a non-temporary address must be configured/available on your network interface.
(string) Enable statsd metrics to be sent to the specified host. If this value is empty, statsd logging will be disabled.
(int) Destination port on the provided statsd host to send samples to. Only takes effect if statsd-host is set.
(float) Sample rate determines what percentage of the metric points a client should send to the server. Only takes effect if statsd-host is set.
(int) Swift storage region to request membership. Relevant only when the swift-proxy charm has been configured with the Swift Global Cluster feature.
(string) YAML formatted associative array of sysctl values, e.g.: '{ kernel.pid_max : 4194303 }'
(float) The CPU multiplier to use when configuring worker processes for the account, container and object server processes.
(int) XFS inode size to use for block devices.
(int) Swift storage zone to request membership. Relevant only when the swift-proxy charm has been configured for manual zone assignment (the default). This should be changed for every service unit.