Set ignore-open-flags to true by default (#1029)
* Making ignore-open-flags as true
This commit is contained in:
Родитель
399ad95fb1
Коммит
855b27c9f1
|
@ -5,6 +5,7 @@
|
|||
- [#1006](https://github.com/Azure/azure-storage-fuse/issues/1006) Remove user and group config from logrotate file.
|
||||
- [csi-driver #809](https://github.com/kubernetes-sigs/blob-csi-driver/issues/809) Fail to mount when uid/gid are provided on command line.
|
||||
- [#1032](https://github.com/Azure/azure-storage-fuse/issues/1032) `mount all` CLI params parsing fix when no `config-file` and `tmp-path` is provided.
|
||||
- [#1015](https://github.com/Azure/azure-storage-fuse/issues/1015) Default value of `ignore-open-flags` config parameter changed to `true`
|
||||
|
||||
## 2.0.1 (2022-12-02)
|
||||
- Copy of GA release of Blobfuse2. This release was necessary to ensure the GA version resolves ahead of the preview versions.
|
||||
|
|
|
@ -10,6 +10,8 @@ parameters:
|
|||
- name: idstring
|
||||
type: string
|
||||
default: ''
|
||||
- name: tags
|
||||
type: string
|
||||
|
||||
steps:
|
||||
|
||||
|
@ -24,7 +26,7 @@ steps:
|
|||
- task: Go@0
|
||||
inputs:
|
||||
command: 'test'
|
||||
arguments: '-timeout=120m -p 1 -v test/mount_test/mount_test.go -args -working-dir=${{ parameters.working_dir }} -mnt-path=${{ parameters.mount_dir }} -config-file=${{parameters.config}}'
|
||||
arguments: '-timeout=120m -p 1 -v test/mount_test/mount_test.go -args -working-dir=${{ parameters.working_dir }} -mnt-path=${{ parameters.mount_dir }} -config-file=${{parameters.config}} -tags=${{ parameters.tags }}'
|
||||
workingDirectory: ${{ parameters.working_dir }}
|
||||
displayName: 'MountTest: ${{ parameters.idstring }}'
|
||||
timeoutInMinutes: 120
|
||||
|
|
|
@ -68,6 +68,8 @@ parameters:
|
|||
default: "true"
|
||||
- name: verbose_log
|
||||
type: boolean
|
||||
- name: tags
|
||||
type: string
|
||||
|
||||
#--------------------------------------- Setup: End to end tests with different Storage configurations ------------------------------------------
|
||||
# Create key credential config file if we need to test it
|
||||
|
@ -382,6 +384,7 @@ steps:
|
|||
temp_dir: ${{ parameters.temp_dir }}
|
||||
config: ${{ parameters.config }}
|
||||
idstring: ${{ parameters.service }} Mount Test
|
||||
tags: $(tags)
|
||||
|
||||
- template: stress-test.yml
|
||||
parameters:
|
||||
|
|
|
@ -190,6 +190,7 @@ stages:
|
|||
azurite_config: $(BLOBFUSE2_AZURITE_CFG)
|
||||
distro_name: $(imageName)
|
||||
verbose_log: ${{ parameters.verbose_log }}
|
||||
tags: $(tags)
|
||||
|
||||
- template: azure-pipeline-templates/cleanup.yml
|
||||
parameters:
|
||||
|
@ -321,6 +322,7 @@ stages:
|
|||
azurite_config: $(BLOBFUSE2_AZURITE_CFG)
|
||||
distro_name: $(imageName)
|
||||
verbose_log: ${{ parameters.verbose_log }}
|
||||
tags: $(tags)
|
||||
|
||||
- template: azure-pipeline-templates/cleanup.yml
|
||||
parameters:
|
||||
|
|
|
@ -220,7 +220,7 @@ func (lf *Libfuse) Configure(_ bool) error {
|
|||
log.Trace("Libfuse::Configure : %s", lf.Name())
|
||||
|
||||
// >> If you do not need any config parameters remove below code and return nil
|
||||
conf := LibfuseOptions{}
|
||||
conf := LibfuseOptions{IgnoreOpenFlags: true}
|
||||
err := config.UnmarshalKey(lf.Name(), &conf)
|
||||
if err != nil {
|
||||
log.Err("Libfuse::Configure : config error [invalid config attributes]")
|
||||
|
@ -300,6 +300,6 @@ func init() {
|
|||
config.BindPFlag(compName+".fuse-trace", debug)
|
||||
debug.Hidden = true
|
||||
|
||||
ignoreOpenFlags := config.AddBoolFlag("ignore-open-flags", false, "Ignore unsupported open flags (APPEND, WRONLY) by blobfuse when writeback caching is enabled.")
|
||||
ignoreOpenFlags := config.AddBoolFlag("ignore-open-flags", true, "Ignore unsupported open flags (APPEND, WRONLY) by blobfuse when writeback caching is enabled.")
|
||||
config.BindPFlag(compName+".ignore-open-flags", ignoreOpenFlags)
|
||||
}
|
||||
|
|
|
@ -56,13 +56,13 @@ func (suite *libfuseTestSuite) TestDefault() {
|
|||
suite.assert.Equal(suite.libfuse.attributeExpiration, uint32(120))
|
||||
suite.assert.Equal(suite.libfuse.negativeTimeout, uint32(120))
|
||||
suite.assert.False(suite.libfuse.disableWritebackCache)
|
||||
suite.assert.False(suite.libfuse.ignoreOpenFlags)
|
||||
suite.assert.True(suite.libfuse.ignoreOpenFlags)
|
||||
}
|
||||
|
||||
func (suite *libfuseTestSuite) TestConfig() {
|
||||
defer suite.cleanupTest()
|
||||
suite.cleanupTest() // clean up the default libfuse generated
|
||||
config := "allow-other: true\nread-only: true\nlibfuse:\n attribute-expiration-sec: 60\n entry-expiration-sec: 60\n negative-entry-expiration-sec: 60\n fuse-trace: true\n disable-writeback-cache: true\n ignore-open-flags: true\n"
|
||||
config := "allow-other: true\nread-only: true\nlibfuse:\n attribute-expiration-sec: 60\n entry-expiration-sec: 60\n negative-entry-expiration-sec: 60\n fuse-trace: true\n disable-writeback-cache: true\n ignore-open-flags: false\n"
|
||||
suite.setupTestHelper(config) // setup a new libfuse with a custom config (clean up will occur after the test as usual)
|
||||
|
||||
suite.assert.Equal(suite.libfuse.Name(), "libfuse")
|
||||
|
@ -70,7 +70,7 @@ func (suite *libfuseTestSuite) TestConfig() {
|
|||
suite.assert.True(suite.libfuse.readOnly)
|
||||
suite.assert.True(suite.libfuse.traceEnable)
|
||||
suite.assert.True(suite.libfuse.disableWritebackCache)
|
||||
suite.assert.True(suite.libfuse.ignoreOpenFlags)
|
||||
suite.assert.False(suite.libfuse.ignoreOpenFlags)
|
||||
suite.assert.True(suite.libfuse.allowOther)
|
||||
suite.assert.Equal(suite.libfuse.dirPermission, uint(fs.FileMode(0777)))
|
||||
suite.assert.Equal(suite.libfuse.filePermission, uint(fs.FileMode(0777)))
|
||||
|
@ -132,17 +132,17 @@ func (suite *libfuseTestSuite) TestDisableWritebackCache() {
|
|||
|
||||
func (suite *libfuseTestSuite) TestIgnoreAppendFlag() {
|
||||
defer suite.cleanupTest()
|
||||
suite.assert.False(suite.libfuse.ignoreOpenFlags)
|
||||
|
||||
suite.cleanupTest() // clean up the default libfuse generated
|
||||
config := "libfuse:\n ignore-open-flags: true\n"
|
||||
suite.setupTestHelper(config) // setup a new libfuse with a custom config (clean up will occur after the test as usual)
|
||||
suite.assert.True(suite.libfuse.ignoreOpenFlags)
|
||||
|
||||
suite.cleanupTest() // clean up the default libfuse generated
|
||||
config = "libfuse:\n ignore-open-flags: false\n"
|
||||
config := "libfuse:\n ignore-open-flags: false\n"
|
||||
suite.setupTestHelper(config) // setup a new libfuse with a custom config (clean up will occur after the test as usual)
|
||||
suite.assert.False(suite.libfuse.ignoreOpenFlags)
|
||||
|
||||
suite.cleanupTest() // clean up the default libfuse generated
|
||||
config = "libfuse:\n ignore-open-flags: true\n"
|
||||
suite.setupTestHelper(config) // setup a new libfuse with a custom config (clean up will occur after the test as usual)
|
||||
suite.assert.True(suite.libfuse.ignoreOpenFlags)
|
||||
}
|
||||
|
||||
// getattr
|
||||
|
|
|
@ -236,9 +236,11 @@ func testOpenSyncDirectFlag(suite *libfuseTestSuite) {
|
|||
suite.assert.Equal(C.int(0), info.flags&C.__O_DIRECT)
|
||||
}
|
||||
|
||||
// WriteBack caching enabled by default
|
||||
// WriteBack caching and ignore-open-flags enabled by default
|
||||
func testOpenAppendFlagDefault(suite *libfuseTestSuite) {
|
||||
defer suite.cleanupTest()
|
||||
suite.libfuse.ignoreOpenFlags = false
|
||||
|
||||
name := "path"
|
||||
path := C.CString("/" + name)
|
||||
defer C.free(unsafe.Pointer(path))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# MUST READ :
|
||||
# If you are creating a blobfuse2 config file using this kindly take care of below points
|
||||
# 1. All boolean configs (true|false config) are set to 'false' by default.
|
||||
# 1. All boolean configs (true|false config) (except ignore-open-flags) are set to 'false' by default.
|
||||
# No need to mention them in your config file unless you are setting them to true.
|
||||
# 2. 'loopbackfs' is purely for testing and shall not be used in production configuration.
|
||||
# 3. 'stream' and 'file_cache' can not co-exist and config file shall have only one of them based on your use case.
|
||||
|
@ -62,8 +62,8 @@ libfuse:
|
|||
negative-entry-expiration-sec: <time kernel can cache attributes of non existent paths (in sec). Default - 120 sec>
|
||||
fuse-trace: true|false <enable libfuse api trace logs for debugging>
|
||||
extension: <physical path to extension library>
|
||||
disable-writeback-cache: true|false <disallow libfuse to buffer write requests if you must strictly open files in O_WRONLY or O_APPEND mode. alternatively, you can ignore-open-flags.>
|
||||
ignore-open-flags: true|false <ignore the append and write only flag since O_APPEND and O_WRONLY is not supported with writeback caching. alternatively, you can disable-writeback-cache.>
|
||||
disable-writeback-cache: true|false <disallow libfuse to buffer write requests if you must strictly open files in O_WRONLY or O_APPEND mode. alternatively, you can set ignore-open-flags.>
|
||||
ignore-open-flags: true|false <ignore the append and write only flag since O_APPEND and O_WRONLY is not supported with writeback caching. alternatively, you can disable-writeback-cache. Default value is true>
|
||||
|
||||
# Streaming configuration
|
||||
stream:
|
||||
|
|
|
@ -37,8 +37,10 @@ package mount_test
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/rand"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
|
@ -51,7 +53,7 @@ import (
|
|||
|
||||
var blobfuseBinary string = "blobfuse2"
|
||||
var mntDir string = "mntdir"
|
||||
var configFile string
|
||||
var configFile, tags string
|
||||
|
||||
type mountSuite struct {
|
||||
suite.Suite
|
||||
|
@ -387,6 +389,78 @@ func (suite *mountSuite) TestEnvVarMount() {
|
|||
// os.Unsetenv("AZURE_STORAGE_ACCOUNT_TYPE")
|
||||
// }
|
||||
|
||||
func mountAndValidate(suite *mountSuite, args ...string) {
|
||||
// run mount command
|
||||
args = append([]string{"mount", mntDir, "--config-file=" + configFile}, args...)
|
||||
mountCmd := exec.Command(blobfuseBinary, args...)
|
||||
cliOut, err := mountCmd.Output()
|
||||
fmt.Println(string(cliOut))
|
||||
suite.Equal(0, len(cliOut))
|
||||
suite.Equal(nil, err)
|
||||
|
||||
// wait for mount
|
||||
time.Sleep(10 * time.Second)
|
||||
|
||||
// validate mount
|
||||
cliOut = listBlobfuseMounts(suite)
|
||||
suite.NotEqual(0, len(cliOut))
|
||||
suite.Contains(string(cliOut), mntDir)
|
||||
}
|
||||
|
||||
func (suite *mountSuite) TestWriteBackCacheAndIgnoreOpenFlags() {
|
||||
if tags != "fuse3" {
|
||||
return
|
||||
}
|
||||
|
||||
mountAndValidate(suite)
|
||||
|
||||
fileName := "testFile"
|
||||
remoteFilePath := mntDir + "/" + fileName
|
||||
|
||||
// write to file in the local directory
|
||||
buff := make([]byte, 200)
|
||||
rand.Read(buff)
|
||||
err := ioutil.WriteFile(remoteFilePath, buff, 0777)
|
||||
suite.Nil(err)
|
||||
|
||||
// unmount
|
||||
blobfuseUnmount(suite, mntDir)
|
||||
|
||||
mountAndValidate(suite, "--disable-writeback-cache=false", "--ignore-open-flags=false")
|
||||
f, err := os.OpenFile(remoteFilePath, os.O_APPEND, 0777)
|
||||
suite.NotNil(err)
|
||||
suite.Nil(f)
|
||||
blobfuseUnmount(suite, mntDir)
|
||||
|
||||
mountAndValidate(suite, "--disable-writeback-cache=true", "--ignore-open-flags=false")
|
||||
f, err = os.OpenFile(remoteFilePath, os.O_APPEND, 0777)
|
||||
suite.Nil(err)
|
||||
suite.NotNil(f)
|
||||
f.Close()
|
||||
time.Sleep(2 * time.Second)
|
||||
blobfuseUnmount(suite, mntDir)
|
||||
|
||||
mountAndValidate(suite, "--disable-writeback-cache=false", "--ignore-open-flags=true")
|
||||
f, err = os.OpenFile(remoteFilePath, os.O_APPEND, 0777)
|
||||
suite.Nil(err)
|
||||
suite.NotNil(f)
|
||||
f.Close()
|
||||
time.Sleep(2 * time.Second)
|
||||
blobfuseUnmount(suite, mntDir)
|
||||
|
||||
mountAndValidate(suite)
|
||||
f, err = os.OpenFile(remoteFilePath, os.O_APPEND, 0777)
|
||||
suite.Nil(err)
|
||||
suite.NotNil(f)
|
||||
f.Close()
|
||||
time.Sleep(2 * time.Second)
|
||||
|
||||
err = os.RemoveAll(remoteFilePath)
|
||||
suite.Nil(err)
|
||||
|
||||
blobfuseUnmount(suite, mntDir)
|
||||
}
|
||||
|
||||
func TestMountSuite(t *testing.T) {
|
||||
suite.Run(t, new(mountSuite))
|
||||
}
|
||||
|
@ -395,12 +469,14 @@ func TestMain(m *testing.M) {
|
|||
workingDirPtr := flag.String("working-dir", "", "Directory containing the blobfuse binary")
|
||||
pathPtr := flag.String("mnt-path", ".", "Mount Path of Container")
|
||||
configPtr := flag.String("config-file", "", "Config file for mounting")
|
||||
tagsPtr := flag.String("tags", "", "fuse version")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
blobfuseBinary = filepath.Join(*workingDirPtr, blobfuseBinary)
|
||||
mntDir = filepath.Join(*pathPtr, mntDir)
|
||||
configFile = *configPtr
|
||||
tags = *tagsPtr
|
||||
|
||||
err := os.RemoveAll(mntDir)
|
||||
if err != nil {
|
||||
|
|
Загрузка…
Ссылка в новой задаче