Skip to content

Commit

Permalink
Merge pull request rockstor#2641 from StephenBrown2/2640_compression_…
Browse files Browse the repository at this point in the history
…cosmetics

Address compression cosmetics rockstor#2640
  • Loading branch information
phillxnet authored Aug 10, 2023
2 parents 387667d + 229b783 commit 7957f8a
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/rockstor/fs/btrfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2333,7 +2333,7 @@ def get_property(mnt_pt, prop_name=None):
properties. But if called with a single property then the value and type
appropriate for that property ie:
string for label (in presented in properties),
string for compression ie: lzo, zlib (if presented in properties), zstd,
string for compression ie: zlib (if presented in properties), lzo, zstd,
and Boolean for prop_name='ro'
If prop_name specified but not found then None is returned.
N.B. compression property for subvol only, vol/pool uses mount option.
Expand Down
2 changes: 1 addition & 1 deletion src/rockstor/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@

CONFROOT = '{}/conf'.format(BASE_DIR)
CERTDIR = '{}/certs'.format(BASE_DIR)
COMPRESSION_TYPES = ('lzo', 'zlib', 'zstd', 'no',)
COMPRESSION_TYPES = ('zlib', 'lzo', 'zstd', 'no',)

SNAP_TS_FORMAT = '%Y%m%d%H%M'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
{{pool.compression}}
{{else}}
<strong>
<a href="#" id="comprOptn" data-type="select" data-title="Pool compression algorithm.<br>
<strong>zlib: </strong>slower than LZO but higher compression ratio.<br>
<strong>lzo:</strong>faster compression and decompression than ZLIB, worse compression ratio, designed to be fast.<br>
<strong>zstd: </strong>compression comparable to ZLIB with higher compression/decompression speeds and different ratio.<br>
Pool level compression applies to all it's Shares.<br>
Alternatively: consider Share level compression.<br>
<a href="#" id="comprOptn" data-type="select" data-title="Pool compression algorithm.<br />
- <strong>zlib:</strong> slower than LZO but higher compression ratio.<br />
- <strong>lzo:</strong> faster compression and decompression than ZLIB, worse compression ratio, designed to be fast.<br />
- <strong>zstd:</strong> compression comparable to ZLIB with higher compression/decompression speeds and different ratio.<br />
<br />
Pool level compression applies to all its Shares.<br />
Alternatively: consider Share level compression.<br />
Unchanged data remains at prior setting until balanced.">
{{pool.compression}}
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@
{{this.compression}}
{{else}}
<strong><a href="#" class="cmpOptns" data-name="cmpOptns" data-type="select" data-mntoptn="{{this.mnt_options}}"
data-value="{{this.compression}}" data-pid="{{this.id}}" data-title="Pool compression algorithm.<br>
<strong>zlib: </strong>slower than LZO but higher compression ratio.<br>
<strong>lzo:</strong>faster compression and decompression than ZLIB, worse compression ratio, designed to be fast.<br>
<strong>zstd: </strong>compression comparable to ZLIB with higher compression/decompression speeds and different ratio.<br>
Pool level compression applies to all it's Shares.<br>
Alternatively: consider Share level compression.<br>
Unchanged data remains at prior setting until balanced.">
data-value="{{this.compression}}" data-pid="{{this.id}}" data-title="Pool compression algorithm.<br />
- <strong>zlib:</strong> slower than LZO but higher compression ratio.<br />
- <strong>lzo:</strong> faster compression and decompression than ZLIB, worse compression ratio, designed to be fast.<br />
- <strong>zstd:</strong> compression comparable to ZLIB with higher compression/decompression speeds and different ratio.<br />
<br />
Pool level compression applies to all its Shares.<br />
Alternatively: consider Share level compression.<br />
Unchanged data remains at prior setting until balanced.">
{{this.compression}}</a></strong>
{{/if}}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,14 @@ AddPoolView = Backbone.View.extend({
this.$('#compression').tooltip({
html: true,
placement: 'right',
title: 'Choose a Pool compression algorithm.<br><strong>zlib: </strong>slower than LZO but higher compression ratio.<br><strong>lzo:</strong>faster compression and decompression than ZLIB, worse compression ratio, designed to be fast.<br><strong>zstd: </strong>compression comparable to ZLIB with higher compression/decompression speeds and different ratio.<br>Pool level compression applies to all its Shares.<br>Alternatively: consider Share level compression.<br>This setting can be changed at any time.'
title: `Choose a Pool compression algorithm.<br />
- <strong>zlib:</strong> slower than LZO but higher compression ratio.<br />
- <strong>lzo:</strong> faster compression and decompression than ZLIB, worse compression ratio, designed to be fast.<br />
- <strong>zstd:</strong> compression comparable to ZLIB with higher compression/decompression speeds and different ratio.<br />
<br />
Pool level compression applies to all its Shares.<br />
Alternatively: consider Share level compression.<br />
This setting can be changed at any time.`
});

$('#add-pool-form').validate({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ AddShareView = Backbone.View.extend({
_this.$('#compression').tooltip({
html: true,
placement: 'right',
title: 'Choose a compression algorithm for this Share. By default, parent pool\'s compression algorithm is applied.<br> If you like to set pool wide compression, don\'t choose anything here. If you want finer control of this particular Share\'s compression algorithm, you can set it here.<br><strong>zlib: </strong>slower than LZO but higher compression ratio.<br><strong>lzo:</strong>faster compression and decompression than ZLIB, worse compression ratio, designed to be fast.<br><strong>zstd: </strong>compression comparable to ZLIB with higher compression/decompression speeds and different ratio.'
title: `Choose a compression algorithm for this Share. By default, parent pool's compression algorithm is applied.<br />
If you like to set pool wide compression, don't choose anything here. If you want finer control of this particular
Share's compression algorithm, you can set it here.<br />
- <strong>zlib:</strong> slower than LZO but higher compression ratio.<br />
- <strong>lzo:</strong> faster compression and decompression than ZLIB, worse compression ratio, designed to be fast.<br />
- <strong>zstd:</strong> compression comparable to ZLIB with higher compression/decompression speeds and different ratio.`
});

$('#add-share-form').validate({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ PoolDetailsLayoutView = RockstorLayoutView.extend({
this.cOpts = {
'no': 'Dont enable compression',
'zlib': 'zlib',
'zstd': 'zstd',
'lzo': 'lzo'
'lzo': 'lzo',
'zstd': 'zstd'
};
this.initHandlebarHelpers();
this.poolShares = new PoolShareCollection([], {
Expand Down Expand Up @@ -156,8 +156,8 @@ PoolDetailsLayoutView = RockstorLayoutView.extend({
source: [
{value: 'no', text: 'no'},
{value: 'zlib', text: 'zlib'},
{value: 'zstd', text: 'zstd'},
{value: 'lzo', text: 'lzo'}
{value: 'lzo', text: 'lzo'},
{value: 'zstd', text: 'zstd'}
],
success: function(response, newCompr) {
$.ajax({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ PoolsView = RockstorLayoutView.extend({
source: [
{value: 'no', text: 'no'},
{value: 'zlib', text: 'zlib'},
{value: 'zstd', text: 'zstd'},
{value: 'lzo', text: 'lzo'}
{value: 'lzo', text: 'lzo'},
{value: 'zstd', text: 'zstd'}
],
success: function(response, newCompr){
//use $(this) to dynamically get pool name from select dropdown.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ ShareDetailsLayoutView = RockstorLayoutView.extend({
this.cOpts = {
'no': 'Dont enable compression',
'zlib': 'zlib',
'zstd': 'zstd',
'lzo': 'lzo'
'lzo': 'lzo',
'zstd': 'zstd'
};
this.cView = this.options.cView;
this.initHandlebarHelpers();
Expand Down Expand Up @@ -349,7 +349,12 @@ ShareDetailsLayoutView = RockstorLayoutView.extend({
this.$('#ph-compression-info #compression').tooltip({
html: true,
placement: 'top',
title: 'Choose a compression algorithm for this Share. By default, parent pool\'s compression algorithm is applied.<br> If you like to set pool wide compression, don\'t choose anything here. If you want finer control of this particular Share\'s compression algorithm, you can set it here.<br><strong>zlib: </strong>slower than LZO but higher compression ratio.<br><strong>lzo:</strong>faster compression and decompression than ZLIB, worse compression ratio, designed to be fast.<br><strong>zstd: </strong>compression comparable to ZLIB with higher compression/decompression speeds and different ratio.'
title: `Choose a compression algorithm for this Share. By default, parent pool's compression algorithm is applied.<br />
If you like to set pool wide compression, don't choose anything here. If you want finer control of this particular
Share's compression algorithm, you can set it here.<br />
- <strong>zlib:</strong> slower than LZO but higher compression ratio.<br />
- <strong>lzo:</strong> faster compression and decompression than ZLIB, worse compression ratio, designed to be fast.<br />
- <strong>zstd:</strong> compression comparable to ZLIB with higher compression/decompression speeds and different ratio.`
});
},

Expand Down
4 changes: 2 additions & 2 deletions src/rockstor/storageadmin/tests/test_pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def test_compression(self):
}
e_msg = (
"Unsupported compression algorithm (derp). "
"Use one of ('lzo', 'zlib', 'zstd', 'no')."
"Use one of ('zlib', 'lzo', 'zstd', 'no')."
)
response = self.client.post(self.BASE_URL, data=data)
self.assertEqual(
Expand Down Expand Up @@ -668,7 +668,7 @@ def test_mount_options(self):

# test invalid compress-force applied via remount command
data2 = {"mnt_options": "compress-force=1"}
e_msg = "compress-force is only allowed with ('lzo', 'zlib', 'zstd', 'no')."
e_msg = "compress-force is only allowed with ('zlib', 'lzo', 'zstd', 'no')."
response = self.client.put(
"{}/{}/remount".format(self.BASE_URL, pId), data=data2
)
Expand Down
4 changes: 2 additions & 2 deletions src/rockstor/storageadmin/tests/test_shares.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def test_create(self):
data["compression"] = "invalid"
e_msg2 = (
"Unsupported compression algorithm (invalid). Use one of "
"('lzo', 'zlib', 'zstd', 'no')."
"('zlib', 'lzo', 'zstd', 'no')."
)
response3 = self.client.post(self.BASE_URL, data=data)
self.assertEqual(
Expand Down Expand Up @@ -459,7 +459,7 @@ def test_compression(self):
}
e_msg = (
"Unsupported compression algorithm (derp). "
"Use one of ('lzo', 'zlib', 'zstd', 'no')."
"Use one of ('zlib', 'lzo', 'zstd', 'no')."
)
response = self.client.post(self.BASE_URL, data=compression_test_share)
self.assertEqual(
Expand Down

0 comments on commit 7957f8a

Please sign in to comment.