Skip to content

Commit 78ee620

Browse files
Merge tag 'tags/blobfuse2-2.4.0' into update-to-blobfuse2.4.0
2 parents ea98caf + 4a57c1b commit 78ee620

File tree

83 files changed

+2358
-643
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2358
-643
lines changed

.github/pull_request_template.md

+11-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1+
## ✅ What
12

2-
### What type of Pull Request is this? (check all applicable)
3+
<!-- A brief description of the changes in this PR. -->
34

4-
- [ ] Refactor
5-
- [ ] Feature
6-
- [ ] Bug Fix
7-
- [ ] Optimization
8-
- [ ] Documentation Update
5+
## 🤔 Why
96

10-
### Describe your changes in brief
7+
<!-- A brief description of the reason for these changes. -->
118

12-
### Checklist
9+
## 👩‍🔬 How to validate if applicable
1310

14-
- [ ] Tested locally
15-
- [ ] Added new dependencies
16-
- [ ] Updated documentation
17-
- [ ] Added tests
11+
<!-- Step-by-step instructions for how reviewers can verify these changes work as expected. -->
1812

19-
### Related Issues
13+
## 🔖 Related links
2014

21-
- Related Issue #
22-
- Closes #
15+
- [Issues](<link>)
16+
- [Team thread](<link>)
17+
- [Documents](<link>)
18+
- [Email Subject]

.github/workflows/code-coverage.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ jobs:
537537
run: |
538538
echo 'mode: count' > ./cloudfuse_coverage_raw.rpt
539539
tail -q -n +2 ./*.cov >> ./cloudfuse_coverage_raw.rpt
540-
cat ./cloudfuse_coverage_raw.rpt | grep -v mock_component | grep -v base_component | grep -v loopback | grep -v tools | grep -v "common/log" | grep -v "common/exectime" | grep -v "common/types.go" | grep -v "internal/stats_manager" | grep -v "main.go" | grep -v "component/azstorage/azauthmsi.go" | grep -v "component/azstorage/azauthspn.go" | grep -v "component/stream" | grep -v "component/azstorage/azauthcli.go" > ./cloudfuse_coverage.rpt
540+
cat ./cloudfuse_coverage_raw.rpt | grep -v mock_component | grep -v base_component | grep -v loopback | grep -v tools | grep -v "common/log" | grep -v "common/exectime" | grep -v "common/types.go" | grep -v "internal/stats_manager" | grep -v "main.go" | grep -v "component/azstorage/azauthmsi.go" | grep -v "component/azstorage/azauthspn.go" | grep -v "component/stream" | grep -v "component/custom" | grep -v "component/azstorage/azauthcli.go" | grep -v "exported/exported.go" | grep -v "component/block_cache/stream.go" > ./cloudfuse_coverage.rpt
541541
go tool cover -func cloudfuse_coverage.rpt > ./cloudfuse_func_cover.rpt
542542
go tool cover -html=./cloudfuse_coverage.rpt -o ./cloudfuse_coverage.html
543543
go tool cover -html=./cloudfuse_ut.cov -o ./cloudfuse_ut.html
@@ -1052,7 +1052,7 @@ jobs:
10521052
run: |
10531053
echo 'mode: count' > ./cloudfuse_coverage_raw.rpt
10541054
tail -q -n +2 ./*.cov >> ./cloudfuse_coverage_raw.rpt
1055-
cat ./cloudfuse_coverage_raw.rpt | grep -v mock_component | grep -v base_component | grep -v loopback | grep -v tools | grep -v "common/log" | grep -v "common/exectime" | grep -v "common/types.go" | grep -v "internal/stats_manager" | grep -v "main.go" | grep -v "component/azstorage/azauthmsi.go" | grep -v "component/azstorage/azauthspn.go" | grep -v "component/stream" | grep -v "component/azstorage/azauthcli.go" > ./cloudfuse_coverage.rpt
1055+
cat ./cloudfuse_coverage_raw.rpt | grep -v mock_component | grep -v base_component | grep -v loopback | grep -v tools | grep -v "common/log" | grep -v "common/exectime" | grep -v "common/types.go" | grep -v "internal/stats_manager" | grep -v "main.go" | grep -v "component/azstorage/azauthmsi.go" | grep -v "component/azstorage/azauthspn.go" | grep -v "component/stream" | grep -v "component/custom" | grep -v "component/azstorage/azauthcli.go" | grep -v "exported/exported.go" | grep -v "component/block_cache/stream.go" > ./cloudfuse_coverage.rpt
10561056
go tool cover -func cloudfuse_coverage.rpt > ./cloudfuse_func_cover.rpt
10571057
go tool cover -html=./cloudfuse_coverage.rpt -o ./cloudfuse_coverage.html
10581058
go tool cover -html=./cloudfuse_ut.cov -o ./cloudfuse_ut.html

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ adlsgen1fuse
1313
missing_log.lst
1414
venv/
1515
*.backup
16-
__debug_bin
16+
__debug_bin*
1717
.env
1818
**/var.ps1
1919
*.prof
@@ -38,3 +38,4 @@ dist/
3838
/build/winfsp-*
3939
manpages/
4040
changelog.yml
41+
component/azstorage/logfile.txt

NOTICE

+1-1
Original file line numberDiff line numberDiff line change
@@ -9290,7 +9290,7 @@ recommend that a file or class name and description of purpose be included on
92909290
the same "printed page" as the copyright notice for easier identification within
92919291
third-party archives.
92929292

9293-
Copyright 2014 Unknown
9293+
Copyright 2014 Unknwon
92949294

92959295
Licensed under the Apache License, Version 2.0 (the "License");
92969296
you may not use this file except in compliance with the License.

cmd/config-gen_test.go

-168
This file was deleted.

cmd/gen-config.go

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
/*
2+
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
3+
4+
Copyright © 2023-2025 Seagate Technology LLC and/or its Affiliates
5+
Copyright © 2020-2024 Microsoft Corporation. All rights reserved.
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in all
15+
copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
SOFTWARE
24+
*/
25+
26+
package cmd
27+
28+
import (
29+
"fmt"
30+
"os"
31+
"strings"
32+
33+
"github.com/Seagate/cloudfuse/common"
34+
"github.com/Seagate/cloudfuse/common/config"
35+
"github.com/Seagate/cloudfuse/internal"
36+
"github.com/spf13/cobra"
37+
)
38+
39+
type genConfigParams struct {
40+
blockCache bool `config:"block-cache" yaml:"block-cache,omitempty"`
41+
directIO bool `config:"direct-io" yaml:"direct-io,omitempty"`
42+
readOnly bool `config:"ro" yaml:"ro,omitempty"`
43+
tmpPath string `config:"tmp-path" yaml:"tmp-path,omitempty"`
44+
outputFile string `config:"o" yaml:"o,omitempty"`
45+
}
46+
47+
var optsGenCfg genConfigParams
48+
49+
var generatedConfig = &cobra.Command{
50+
Use: "gen-config",
51+
Short: "Generate default config file.",
52+
Long: "Generate default config file with the values pre-caculated by cloudfuse.",
53+
SuggestFor: []string{"generate default config", "generate config"},
54+
Hidden: true,
55+
Args: cobra.ExactArgs(0),
56+
FlagErrorHandling: cobra.ExitOnError,
57+
RunE: func(cmd *cobra.Command, args []string) error {
58+
59+
// Check if configTmp is not provided when component is fc
60+
if (!optsGenCfg.blockCache) && optsGenCfg.tmpPath == "" {
61+
return fmt.Errorf("temp path is required for file cache mode. Use flag --tmp-path to provide the path")
62+
}
63+
64+
// Set the configs
65+
if optsGenCfg.readOnly {
66+
config.Set("read-only", "true")
67+
}
68+
69+
if optsGenCfg.directIO {
70+
config.Set("direct-io", "true")
71+
}
72+
73+
config.Set("tmp-path", optsGenCfg.tmpPath)
74+
75+
// Create the pipeline
76+
pipeline := []string{"libfuse"}
77+
if optsGenCfg.blockCache {
78+
pipeline = append(pipeline, "block_cache")
79+
} else {
80+
pipeline = append(pipeline, "file_cache")
81+
}
82+
83+
if !optsGenCfg.directIO {
84+
pipeline = append(pipeline, "attr_cache")
85+
}
86+
pipeline = append(pipeline, "azstorage")
87+
88+
var sb strings.Builder
89+
90+
if optsGenCfg.directIO {
91+
sb.WriteString("direct-io: true\n")
92+
}
93+
94+
if optsGenCfg.readOnly {
95+
sb.WriteString("read-only: true\n\n")
96+
}
97+
98+
sb.WriteString("# Logger configuration\n#logging:\n # type: syslog|silent|base\n # level: log_off|log_crit|log_err|log_warning|log_info|log_trace|log_debug\n")
99+
sb.WriteString(" # file-path: <path where log files shall be stored. Default - '$HOME/.cloudfuse/cloudfuse.log'>\n")
100+
101+
sb.WriteString("\ncomponents:\n")
102+
for _, component := range pipeline {
103+
sb.WriteString(fmt.Sprintf(" - %s\n", component))
104+
}
105+
106+
for _, component := range pipeline {
107+
c := internal.GetComponent(component)
108+
if c == nil {
109+
return fmt.Errorf("generatedConfig:: error getting component [%s]", component)
110+
}
111+
sb.WriteString("\n")
112+
sb.WriteString(c.GenConfig())
113+
}
114+
115+
sb.WriteString("\n#Required\n#azstorage:\n # type: block|adls \n # account-name: <name of the storage account>\n # container: <name of the storage container to be mounted>\n # endpoint: <example - https://account-name.blob.core.windows.net>\n ")
116+
sb.WriteString("# mode: key|sas|spn|msi|azcli \n # account-key: <storage account key>\n # OR\n # sas: <storage account sas>\n # OR\n # appid: <storage account app id / client id for MSI>\n # OR\n # tenantid: <storage account tenant id for SPN")
117+
118+
filePath := ""
119+
if optsGenCfg.outputFile == "" {
120+
filePath = "./cloudfuse.yaml"
121+
} else {
122+
filePath = optsGenCfg.outputFile
123+
}
124+
125+
var err error = nil
126+
if optsGenCfg.outputFile == "console" {
127+
fmt.Println(sb.String())
128+
} else {
129+
err = common.WriteToFile(filePath, sb.String(), common.WriteToFileOptions{Flags: os.O_TRUNC, Permission: 0644})
130+
}
131+
132+
return err
133+
},
134+
}
135+
136+
func init() {
137+
rootCmd.AddCommand(generatedConfig)
138+
139+
generatedConfig.Flags().BoolVar(&optsGenCfg.blockCache, "block-cache", false, "Block-Cache shall be used as caching strategy")
140+
generatedConfig.Flags().BoolVar(&optsGenCfg.directIO, "direct-io", false, "Direct-io mode shall be used")
141+
generatedConfig.Flags().BoolVar(&optsGenCfg.readOnly, "ro", false, "Mount in read-only mode")
142+
generatedConfig.Flags().StringVar(&optsGenCfg.tmpPath, "tmp-path", "", "Temp cache path to be used")
143+
generatedConfig.Flags().StringVar(&optsGenCfg.outputFile, "o", "", "Output file location")
144+
}

0 commit comments

Comments
 (0)