Juju Charm - Swift storage
Go to file
Corey Bryant 9671fa85e0 Mock datetime instead of redefining standard library
This fixes up the test to mock the datetime calls specifically in
the test that needs to mock them, rather than the prior approach
which was redefining the behavior of the standard library function
globally.

This change also pins openstacksdk to fix python 3.6 unit tests.
Commit b34de32a in openstacksdk replaced the appdirs library with
the platformdirs library. The platformdirs library is not python 3.6
compatible and causes some challenges. Pin the openstacksdk to a
lower version. Thanks to Billy Olsen for this patch. Taken from:
https://review.opendev.org/c/openstack/charm-neutron-api/+/902607

Closes-Bug: #2045588
Change-Id: I9c585c91c5527a61e4a8dbcba0a8a01108cd9b2e
(cherry picked from commit 72e22a94ed)
2023-12-12 16:01:14 -05:00
actions 21.10 - Stable cut of charms for testing period 2021-10-14 17:38:45 +01:00
charmhelpers Add xena bundles 2021-09-29 21:04:42 +00:00
files Add monitoring for object-replicator logs disappearing 2020-07-21 15:31:06 -05:00
hooks Monitor Swift Object/Container/Account API availability 2020-08-28 10:13:01 +10:00
lib Fix swift replication errors 2021-01-05 11:19:13 -03:00
templates Fix swift replication errors 2021-01-05 11:19:13 -03:00
tests Update the bundles to use the stable track, edge risk for xena 2022-07-11 10:40:09 +01:00
unit_tests Mock datetime instead of redefining standard library 2023-12-12 16:01:14 -05:00
.gitignore Update to build using charmcraft - xena batch 2022-03-16 13:49:37 +00:00
.gitreview Update to build using charmcraft - xena batch 2022-03-16 13:49:37 +00:00
.project Resynced helpers 2014-03-20 13:47:54 +00:00
.pydevproject Enable xenial/queens amulet testing 2018-03-12 09:34:00 +00:00
.stestr.conf Replace ostestr with stestr in testing framework. 2019-03-07 17:13:16 -05:00
.zuul.yaml Update to build using charmcraft - xena batch 2022-03-16 13:49:37 +00:00
LICENSE Re-license charm as Apache-2.0 2016-07-01 18:15:00 +01:00
Makefile Sync helpers for 20.05 2020-05-18 14:50:38 +02:00
README.md Review and improve README 2020-02-24 22:08:42 -05:00
actions.yaml Action Managed Upgrades 2015-09-22 15:58:18 -07:00
build-requirements.txt Update to build using charmcraft - xena batch 2022-03-16 13:49:37 +00:00
charm-helpers-hooks.yaml Update to build using charmcraft - xena batch 2022-03-16 13:49:37 +00:00
charmcraft.yaml Update the charmcraft.yaml for xena (no 22.04 base) 2022-05-16 18:50:59 +01:00
config.yaml Set openstack origin default to cloud:focal-xena 2022-03-23 18:44:12 +00:00
copyright Re-license charm as Apache-2.0 2016-07-01 18:15:00 +01:00
hardening.yaml Add hardening support 2016-03-24 11:11:58 +00:00
icon.svg Update charm icon 2017-08-02 17:25:40 +01:00
metadata.yaml Update to build using charmcraft - xena batch 2022-03-16 13:49:37 +00:00
osci.yaml Update to build using charmcraft - xena batch 2022-03-16 13:49:37 +00:00
pip.sh Add xena bundles 2021-09-29 21:04:42 +00:00
rename.sh Update to build using charmcraft - xena batch 2022-03-16 13:49:37 +00:00
requirements.txt Sync release-tools 2021-07-27 10:17:10 +01:00
revision Remove debug. 2013-07-19 14:13:59 -07:00
setup.cfg Add Python 3 Train unit tests 2019-07-30 10:18:23 -04:00
test-requirements.txt Mock datetime instead of redefining standard library 2023-12-12 16:01:14 -05:00
tox.ini Pin tox to < 4.0.0 2023-01-13 15:09:09 -05:00

README.md

Overview

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.

Usage

Configuration

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

zone

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

block-device

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.

storage-region

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

Deployment

Let file swift.yaml contain the deployment configuration:

    swift-proxy:
        zone-assignment: manual
        replicas: 3
    swift-storage-zone1:
        zone: 1
        block-device: /dev/sdb
    swift-storage-zone2:
        zone: 2
        block-device: /dev/sdb
    swift-storage-zone3:
        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.

Actions

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.

Bugs

Please report bugs on Launchpad.

For general charm questions refer to the OpenStack Charm Guide.