diff --git a/microceph/ceph/config.go b/microceph/ceph/config.go index 6b14092e..765b8d03 100644 --- a/microceph/ceph/config.go +++ b/microceph/ceph/config.go @@ -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 { @@ -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"}}, } } @@ -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, } @@ -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 } @@ -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", @@ -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 } @@ -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 diff --git a/microceph/cmd/microceph/cluster_config_reset.go b/microceph/cmd/microceph/cluster_config_reset.go index c88f5bcd..d27ee2a2 100644 --- a/microceph/cmd/microceph/cluster_config_reset.go +++ b/microceph/cmd/microceph/cluster_config_reset.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "strings" "github.com/canonical/microcluster/v2/microcluster" "github.com/spf13/cobra" @@ -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 } diff --git a/microceph/cmd/microceph/cluster_config_set.go b/microceph/cmd/microceph/cluster_config_set.go index 670f2354..e2414a50 100644 --- a/microceph/cmd/microceph/cluster_config_set.go +++ b/microceph/cmd/microceph/cluster_config_set.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "strings" "github.com/canonical/microcluster/v2/microcluster" "github.com/spf13/cobra" @@ -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 } diff --git a/microceph/constants/constants.go b/microceph/constants/constants.go index 9437fb5c..4dafd9d7 100644 --- a/microceph/constants/constants.go +++ b/microceph/constants/constants.go @@ -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 diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 7a5ab9e8..38b3db0a 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -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 @@ -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*