def _set_pool_values(self, pool, application_metadata, flags, update_existing, kwargs):
update_name = False
- if update_existing:
- current_pool = self._get(pool)
- self._handle_update_compression_args(current_pool.get('options'), kwargs)
+ current_pool = self._get(pool)
+ if update_existing and kwargs.get('compression_mode') == 'unset':
+ self._prepare_compression_removal(current_pool.get('options'), kwargs)
if flags and 'ec_overwrites' in flags:
CephService.send_command('mon', 'osd pool set', pool=pool, var='allow_ec_overwrites',
val='true')
CephService.send_command('mon', 'osd pool set-quota',
pool=pool, field=field, val=str(value))
- def _handle_update_compression_args(self, options, kwargs):
- if kwargs.get('compression_mode') == 'unset' and options is not None:
+ def _prepare_compression_removal(self, options, kwargs):
+ """
+ Presets payload with values to remove compression attributes in case they are not
+ needed anymore.
+
+ In case compression is not needed the dashboard will send 'compression_mode' with the
+ value 'unset'.
+
+ :param options: All set options for the current pool.
+ :param kwargs: Payload of the PUT / POST call
+ """
+ if options is not None:
def reset_arg(arg, value):
if options.get(arg):
kwargs[arg] = value
private initInfo(info: PoolFormInfo) {
this.form.silentSet('algorithm', info.bluestore_compression_algorithm);
- info.compression_modes.push('unset');
this.info = info;
}
externalFieldName: 'compression_mode',
formControlName: 'mode',
editable: true,
- replaceFn: () => 'unset'
+ replaceFn: () => 'unset' // Is used if no compression is set
},
{
externalFieldName: 'srcpool',