mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
cephfs: subvolumes honor --setmetadata
option
`--setmetadata` is false by default, honoring it will keep the metadata disabled by default Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
cf97e377fa
commit
14d6211d6d
@ -93,6 +93,10 @@ func (s *subVolumeClient) removeMetadata(key string) error {
|
||||
|
||||
// SetAllMetadata set all the metadata from arg parameters on Ssubvolume.
|
||||
func (s *subVolumeClient) SetAllMetadata(parameters map[string]string) error {
|
||||
if !s.enableMetadata {
|
||||
return nil
|
||||
}
|
||||
|
||||
for k, v := range parameters {
|
||||
err := s.setMetadata(k, v)
|
||||
if err != nil {
|
||||
@ -113,6 +117,10 @@ func (s *subVolumeClient) SetAllMetadata(parameters map[string]string) error {
|
||||
|
||||
// UnsetAllMetadata unset all the metadata from arg keys on subvolume.
|
||||
func (s *subVolumeClient) UnsetAllMetadata(keys []string) error {
|
||||
if !s.enableMetadata {
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, key := range keys {
|
||||
err := s.removeMetadata(key)
|
||||
// TODO: replace string comparison with errno.
|
||||
|
@ -81,10 +81,11 @@ type SubVolumeClient interface {
|
||||
|
||||
// subVolumeClient implements SubVolumeClient interface.
|
||||
type subVolumeClient struct {
|
||||
*SubVolume // Embedded SubVolume struct.
|
||||
clusterID string // Cluster ID to check subvolumegroup and resize functionality.
|
||||
clusterName string // Cluster name
|
||||
conn *util.ClusterConnection // Cluster connection.
|
||||
*SubVolume // Embedded SubVolume struct.
|
||||
clusterID string // Cluster ID to check subvolumegroup and resize functionality.
|
||||
clusterName string // Cluster name
|
||||
enableMetadata bool // Set metadata on volume
|
||||
conn *util.ClusterConnection // Cluster connection.
|
||||
}
|
||||
|
||||
// SubVolume holds the information about the subvolume.
|
||||
@ -98,12 +99,19 @@ type SubVolume struct {
|
||||
}
|
||||
|
||||
// NewSubVolume returns a new subvolume client.
|
||||
func NewSubVolume(conn *util.ClusterConnection, vol *SubVolume, clusterID, clusterName string) SubVolumeClient {
|
||||
func NewSubVolume(
|
||||
conn *util.ClusterConnection,
|
||||
vol *SubVolume,
|
||||
clusterID,
|
||||
clusterName string,
|
||||
setMetadata bool,
|
||||
) SubVolumeClient {
|
||||
return &subVolumeClient{
|
||||
SubVolume: vol,
|
||||
clusterID: clusterID,
|
||||
clusterName: clusterName,
|
||||
conn: conn,
|
||||
SubVolume: vol,
|
||||
clusterID: clusterID,
|
||||
clusterName: clusterName,
|
||||
enableMetadata: setMetadata,
|
||||
conn: conn,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user