X Tutup
Skip to content

allow specifying available space for objectstorages#40389

Merged
mrow4a merged 4 commits intomasterfrom
feature/objectstore-free-space
Sep 30, 2022
Merged

allow specifying available space for objectstorages#40389
mrow4a merged 4 commits intomasterfrom
feature/objectstore-free-space

Conversation

@mrow4a
Copy link
Contributor

@mrow4a mrow4a commented Sep 28, 2022

Description

Feature: Allow specifying available space for objectstorages

Before this change, objectstorages were reporting only infinite storage space. This could have caused problems in other apps that rely on this storage method, e.g. metrics app that monitors available space

Related Issue

How Has This Been Tested?

  • manually in the developer instance
  • unit/acceptance tests

Add configurations for files primary s3 being ceph, specifying availableStorage

<?php
$CONFIG = [
	'objectstore' => [
		'class' => 'OCA\Files_Primary_S3\S3Storage',
		'arguments' => [
			// replace with your bucket
			'bucket' => 'owncloud',
			// uncomment to indicate to owncloud available storage size in bytes (in this example 1TB)
			'availableStorage' => 1099511627776,
			// uncomment to enable server side encryption
			//'serversideencryption' => 'AES256',
			'options' => [
				// version and region are required
				'version' => '2006-03-01',
				'region'  => 'us-central-1',
				'credentials' => [
					// replace key and secret with your credentials
					'key' => 'owncloud123456',
					'secret' => 'secret123456',
				],
				'use_path_style_endpoint' => true,
				'endpoint' => 'http://ceph:8009/',
			],
		],
	],
];

Start ceph additionaly with owncloud instance

  ceph:
    image: ceph/daemon:master-dba849b-pacific-centos-8-aarch64
    command: demo
    restart: always
    environment:
      - NETWORK_AUTO_DETECT=4
      - RGW_NAME=ceph
      - CEPH_DEMO_UID=owncloud
      - CEPH_DEMO_ACCESS_KEY=owncloud123456
      - CEPH_DEMO_SECRET_KEY=secret123456
      - CEPH_DEMO_BUCKET=owncloud
    ports:
      - ${OWNCLOUD_S3_PORT}:8080
      - ${OWNCLOUD_S3_REST_PORT}:5000

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • Base code changes
  • Unit tests added
  • Acceptance tests added
  • Changelog item, see TEMPLATE

Example

Example use-case: metrics app

Now metric is correctly reported in the app
Screenshot 2022-09-27 at 23 37 12

@mrow4a mrow4a self-assigned this Sep 28, 2022
@jvillafanez
Copy link
Member

Maybe "availableStorageHint" makes more sense taking into account we aren't enforcing that limit. It seems more clear that the storage could have more or even less space available.

You can also check https://github.com/owncloud/core/blob/master/lib/private/legacy/helper.php#L141 so the admin can use "1GB" instead of the actual number of bytes.

Other than that, it looks good.

@mrow4a mrow4a force-pushed the feature/objectstore-free-space branch from 90f9431 to 909f125 Compare September 28, 2022 18:07
mrow4a added a commit to owncloud/docs-server that referenced this pull request Sep 28, 2022
@mrow4a mrow4a force-pushed the feature/objectstore-free-space branch 2 times, most recently from 52bd8b0 to 1a5c8a0 Compare September 28, 2022 20:06
@owncloud owncloud deleted a comment from update-docs bot Sep 29, 2022
@mrow4a
Copy link
Contributor Author

mrow4a commented Sep 29, 2022

@DeepDiver1975 needed to adjust the class so that I could add test coverage (due to static functions with Filesystem::X). if you could quickly revisit

mmattel added a commit to owncloud/docs-server that referenced this pull request Sep 29, 2022
mmattel pushed a commit to owncloud/docs-server that referenced this pull request Sep 29, 2022
mmattel pushed a commit to owncloud/docs-server that referenced this pull request Sep 29, 2022
mmattel pushed a commit to owncloud/docs-server that referenced this pull request Sep 29, 2022
mmattel pushed a commit to owncloud/docs-server that referenced this pull request Sep 29, 2022
mmattel added a commit to owncloud/docs-server that referenced this pull request Sep 29, 2022
mmattel added a commit to owncloud/docs-server that referenced this pull request Sep 29, 2022
@mrow4a mrow4a force-pushed the feature/objectstore-free-space branch from 3e8b67c to a974604 Compare September 30, 2022 12:29
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

80.0% 80.0% Coverage
0.0% 0.0% Duplication

@mrow4a mrow4a merged commit 04c3c9d into master Sep 30, 2022
@delete-merged-branch delete-merged-branch bot deleted the feature/objectstore-free-space branch September 30, 2022 13:56
mmattel added a commit to owncloud/docs-server that referenced this pull request Oct 4, 2022
mmattel added a commit to owncloud/docs-server that referenced this pull request Oct 4, 2022
EParzefall added a commit to owncloud/docs-server that referenced this pull request Oct 4, 2022
EParzefall added a commit to owncloud/docs-server that referenced this pull request Oct 4, 2022
@jnweiger
Copy link
Contributor

jnweiger commented Mar 3, 2023

Confirmed in 10.12.0-rc.2 with scality s3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

X Tutup