Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added QAT configs with experimental flag. #442

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions microceph/ceph/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ import (
type ClusterConfigPermission string

const (
ClusterConfigRO ClusterConfigPermission = "read_only"
ClusterConfigRW ClusterConfigPermission = "read_write"
ClusterConfigRO ClusterConfigPermission = "read_only" // Read Only
ClusterConfigRW ClusterConfigPermission = "read_write" // Read/ Write
ClusterConfigEXPRW ClusterConfigPermission = "exp_read_write" // Read/ Write but experimental features
)

type ClusterConfigDefinition struct {
Expand Down Expand Up @@ -84,6 +85,10 @@ func GetConstConfigTable() ConfigTable {
"rgw_swift_versioning_enabled": {"global", ClusterConfigRW, []string{"rgw"}},
"rgw_swift_enforce_content_length": {"global", ClusterConfigRW, []string{"rgw"}},
"rgw_swift_custom_header": {"global", ClusterConfigRW, []string{"rgw"}},
// RGW QAT config keys
"qat_compressor_enabled": {"client.radosgw.gateway", ClusterConfigEXPRW, []string{"rgw"}},
"openssl_engine_opts": {"client.radosgw.gateway", ClusterConfigEXPRW, []string{"rgw"}},
"plugin_crypto_accelerator": {"client.radosgw.gateway", ClusterConfigEXPRW, []string{"rgw"}},
}
}

Expand Down Expand Up @@ -160,10 +165,11 @@ func RemoveConfigItem(c types.Config) error {
return err
}

config := GetConstConfigTable()[c.Key]
args := []string{
"config",
"rm",
GetConstConfigTable()[c.Key].Who,
config.Who,
c.Key,
}

Expand All @@ -172,6 +178,12 @@ func RemoveConfigItem(c types.Config) error {
return err
}

if config.Permission == ClusterConfigEXPRW {
err := fmt.Errorf(constants.ExperimentalConfigErrTemplate, "reset", c.Key)
logger.Warn(err.Error())
return err
}

return nil
}

Expand Down Expand Up @@ -207,10 +219,11 @@ func ListConfigs() (types.Configs, error) {

// ****** Helper Functions ******//
func setConfigItem(c types.Config) error {
config := GetConstConfigTable()[c.Key]
args := []string{
"config",
"set",
GetConstConfigTable()[c.Key].Who,
config.Who,
c.Key,
c.Value,
"-f",
Expand All @@ -222,6 +235,12 @@ func setConfigItem(c types.Config) error {
return err
}

if config.Permission == ClusterConfigEXPRW {
err := fmt.Errorf(constants.ExperimentalConfigErrTemplate, "set", c.Key)
logger.Warn(err.Error())
return err
}

return nil
}

Expand All @@ -233,7 +252,8 @@ func canSetConfig(key string) (bool, error) {
return false, err
}

if config.Permission != ClusterConfigRW {
// check if write operation is permitted.
if !strings.Contains(string(config.Permission), "write") {
err := fmt.Errorf("requested key %s does not support write operation", key)
logger.Warnf(err.Error())
return false, err
Expand Down
5 changes: 5 additions & 0 deletions microceph/cmd/microceph/cluster_config_reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"context"
"fmt"
"strings"

"github.com/canonical/microcluster/v2/microcluster"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -55,6 +56,10 @@ func (c *cmdClusterConfigReset) Run(cmd *cobra.Command, args []string) error {

err = client.ClearConfig(context.Background(), cli, req)
if err != nil {
if strings.Contains(err.Error(), "performed on experimental config") {
fmt.Println(err.Error())
return nil
}
return err
}

Expand Down
5 changes: 5 additions & 0 deletions microceph/cmd/microceph/cluster_config_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"context"
"fmt"
"strings"

"github.com/canonical/microcluster/v2/microcluster"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -56,6 +57,10 @@ func (c *cmdClusterConfigSet) Run(cmd *cobra.Command, args []string) error {

err = client.SetConfig(context.Background(), cli, req)
if err != nil {
if strings.Contains(err.Error(), "performed on experimental config") {
fmt.Println(err.Error())
return nil
}
return err
}

Expand Down
1 change: 1 addition & 0 deletions microceph/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const LoopSpecId = "loop,"
const DevicePathPrefix = "/dev/disk/by-id/"
const RgwSockPattern = "client.radosgw.gateway"
const CliForcePrompt = "If you understand the *RISK* and you're *ABSOLUTELY CERTAIN* that is what you want, pass --yes-i-really-mean-it."
const ExperimentalConfigErrTemplate = "WARNING: An operation (%s) was performed on experimental config (%s)"

// Path and filename constants

Expand Down
6 changes: 6 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ description: |-

confinement: strict

package-repositories:
- type: apt
ppa: lmlogiudice/ceph-1920-qatsys
priority: always

plugs:
load-rbd:
interface: kernel-module-load
Expand Down Expand Up @@ -212,6 +217,7 @@ parts:
- lib/*/libboost_program_options.so*
- lib/*/libboost_python312.so*
- lib/*/libboost_thread.so*
- lib/*/libboost_url.so*
- lib/*/libcephfs.so*
- lib/*/libcephsqlite.so*
- lib/*/libcurl-gnutls.so*
Expand Down
Loading