From 2ac717800eca19a875bc8453cf6dd27504b92e36 Mon Sep 17 00:00:00 2001 From: David Bullado Date: Thu, 13 Feb 2020 10:00:30 +0100 Subject: [PATCH 1/5] Upgrade keystone API v2 to v3 --- cmd/mount.go | 2 +- config/config.go | 1 + svfs/version.go | 2 +- vendor/github.com/xlucas/swift/auth_v3.go | 23 +++++++++++++---------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/cmd/mount.go b/cmd/mount.go index 2590b40..53b73b9 100644 --- a/cmd/mount.go +++ b/cmd/mount.go @@ -288,10 +288,10 @@ func useConfiguration() { svfs.SwiftConnection.AuthToken = viper.GetString("os_auth_token") svfs.SwiftConnection.StorageUrl = viper.GetString("os_storage_url") - svfs.SwiftConnection.AuthUrl = viper.GetString("os_auth_url") svfs.SwiftConnection.Tenant = viper.GetString("os_tenant_name") svfs.SwiftConnection.UserName = viper.GetString("os_username") svfs.SwiftConnection.ApiKey = viper.GetString("os_password") svfs.SwiftConnection.Region = viper.GetString("os_region_name") + svfs.SwiftConnection.DomainId = viper.GetString("os_user_domain_name") } diff --git a/config/config.go b/config/config.go index c0a9490..c2f6ec2 100644 --- a/config/config.go +++ b/config/config.go @@ -15,6 +15,7 @@ func LoadConfig() error { v.BindEnv("os_password") v.BindEnv("os_region_name") v.BindEnv("os_storage_url") + v.BindEnv("os_user_domain_name") v.BindEnv("hubic_auth") v.BindEnv("hubic_token") diff --git a/svfs/version.go b/svfs/version.go index e23c3c1..01dc6e8 100644 --- a/svfs/version.go +++ b/svfs/version.go @@ -1,4 +1,4 @@ package svfs // Version is the current SVFS version -const Version = "0.9.1" +const Version = "0.9.2" diff --git a/vendor/github.com/xlucas/swift/auth_v3.go b/vendor/github.com/xlucas/swift/auth_v3.go index 9a2c601..a2857ae 100644 --- a/vendor/github.com/xlucas/swift/auth_v3.go +++ b/vendor/github.com/xlucas/swift/auth_v3.go @@ -109,10 +109,11 @@ type v3AuthResponse struct { type v3Auth struct { Auth *v3AuthResponse Headers http.Header + Region string } func (auth *v3Auth) Request(c *Connection) (*http.Request, error) { - + auth.Region = c.Region var v3i interface{} v3 := v3AuthRequest{} @@ -197,15 +198,17 @@ func (auth *v3Auth) endpointUrl(Type string, Internal bool) string { for _, catalog := range auth.Auth.Token.Catalog { if catalog.Type == Type { for _, endpoint := range catalog.Endpoints { - if Internal { - if endpoint.Interface == v3InterfaceInternal { - return endpoint.Url - } - } else { - if endpoint.Interface == v3InterfacePublic { - return endpoint.Url - } - } + if auth.Region == "" || (auth.Region == endpoint.Region) { + if Internal { + if endpoint.Interface == v3InterfaceInternal { + return endpoint.Url + } + } else { + if endpoint.Interface == v3InterfacePublic { + return endpoint.Url + } + } + } } } } From e5370b428cc62b2625b45b8f442641591a8984d2 Mon Sep 17 00:00:00 2001 From: David Bullado Date: Thu, 27 Feb 2020 15:31:21 +0100 Subject: [PATCH 2/5] Checkout the release that supports API Keystone V3 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index aa22032..70cae64 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# Checkout the release that supports API Keystone V3 [here](https://github.com/GoldenBees/svfs/releases) + # The Swift Virtual File System [![Release](https://badge.fury.io/gh/ovh%2Fsvfs.svg)](https://github.com/ovh/svfs/releases) From 33d6b6918778200e14398208236912d68279d983 Mon Sep 17 00:00:00 2001 From: CARLI FLORENT Date: Tue, 7 Apr 2020 20:45:15 +0200 Subject: [PATCH 3/5] KeyStone V3 - add CLI/fstab option --- cmd/mount.go | 2 ++ scripts/mount.svfs | 1 + 2 files changed, 3 insertions(+) diff --git a/cmd/mount.go b/cmd/mount.go index 53b73b9..2cfb23a 100644 --- a/cmd/mount.go +++ b/cmd/mount.go @@ -159,6 +159,7 @@ func setFlags() { flags.StringVar(&svfs.SwiftConnection.AuthToken, "os-auth-token", "", "Authentification token") flags.StringVar(&svfs.SwiftConnection.UserName, "os-username", "", "Username") flags.StringVar(&svfs.SwiftConnection.ApiKey, "os-password", "", "User password") + flags.StringVar(&svfs.SwiftConnection.DomainId, "os-user-domain-name", "", "User domain name") flags.StringVar(&svfs.SwiftConnection.Region, "os-region-name", "", "Region name") flags.StringVar(&svfs.SwiftConnection.StorageUrl, "os-storage-url", "", "Storage URL") flags.BoolVar(&svfs.SwiftConnection.Internal, "os-internal-endpoint", false, "Use internal storage URL") @@ -214,6 +215,7 @@ func setFlags() { viper.BindPFlag("os_auth_url", mountCmd.PersistentFlags().Lookup("os-auth-url")) viper.BindPFlag("os_username", mountCmd.PersistentFlags().Lookup("os-username")) viper.BindPFlag("os_password", mountCmd.PersistentFlags().Lookup("os-password")) + viper.BindPFlag("os_user_domain_name", mountCmd.PersistentFlags().Lookup("os-user-domain-name")) viper.BindPFlag("os_tenant_name", mountCmd.PersistentFlags().Lookup("os-tenant-name")) viper.BindPFlag("os_region_name", mountCmd.PersistentFlags().Lookup("os-region-name")) viper.BindPFlag("os_auth_token", mountCmd.PersistentFlags().Lookup("os-auth-token")) diff --git a/scripts/mount.svfs b/scripts/mount.svfs index a011b76..da803a0 100755 --- a/scripts/mount.svfs +++ b/scripts/mount.svfs @@ -33,6 +33,7 @@ OPTIONS = { 'ip' => '--client-ip', 'mode' => '--default-mode', 'password' => '--os-password', + 'user_domain_name' => '--os-user-domain-name', 'profile_addr' => '--profile-bind', 'profile_cpu' => '--profile-cpu', 'profile_ram' => '--profile-ram', From fb966c46e4d227364b0975611d21ff548ae4d96e Mon Sep 17 00:00:00 2001 From: David Bullado Date: Thu, 25 Jun 2020 10:24:38 +0200 Subject: [PATCH 4/5] Update Readme with v3 --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 70cae64..4a3defe 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ SVFS supports reading the following set of environment variables : OS_PASSWORD OS_REGION_NAME OS_TENANT_NAME + OS_USER_DOMAIN_NAME ``` * If you already authenticated to an identity endpoint : ``` @@ -85,10 +86,11 @@ hubic_token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... #### Keystone options -* `auth_url`: keystone URL (default is https://auth.cloud.ovh.net/v2.0). +* `auth_url`: keystone URL (default is https://auth.cloud.ovh.net/v2.0), should be set to `https://auth.cloud.ovh.net/v3/` * `username`: your keystone user name. * `password`: your keystone password. * `tenant`: your project name. +* `user_domain_name`: should be set to `default` (v3.0) * `region`: the region where your tenant is. * `version`: authentication version (`0` means auto-discovery which is the default). * `storage_url`: the storage endpoint holding your data. From 9c2ed181816b7415e82d9460a91dc6d2f571fe9c Mon Sep 17 00:00:00 2001 From: David Bullado Date: Mon, 15 Mar 2021 16:14:41 +0100 Subject: [PATCH 5/5] Push last modifications --- README.md | 4 ++-- cmd/mount.go | 4 ++-- svfs/version.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4a3defe..03c5646 100644 --- a/README.md +++ b/README.md @@ -86,11 +86,11 @@ hubic_token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... #### Keystone options -* `auth_url`: keystone URL (default is https://auth.cloud.ovh.net/v2.0), should be set to `https://auth.cloud.ovh.net/v3/` +* `auth_url`: keystone URL (default is https://auth.cloud.ovh.net/v3/). * `username`: your keystone user name. * `password`: your keystone password. * `tenant`: your project name. -* `user_domain_name`: should be set to `default` (v3.0) +* `user_domain_name`: 'default' * `region`: the region where your tenant is. * `version`: authentication version (`0` means auto-discovery which is the default). * `storage_url`: the storage endpoint holding your data. diff --git a/cmd/mount.go b/cmd/mount.go index 2cfb23a..0467745 100644 --- a/cmd/mount.go +++ b/cmd/mount.go @@ -154,12 +154,12 @@ func setFlags() { flags := mountCmd.PersistentFlags() //Swift options - flags.StringVar(&svfs.SwiftConnection.AuthUrl, "os-auth-url", "https://auth.cloud.ovh.net/v2.0", "Authentification URL") + flags.StringVar(&svfs.SwiftConnection.AuthUrl, "os-auth-url", "https://auth.cloud.ovh.net/v3/", "Authentification URL") flags.StringVar(&svfs.TargetContainer, "os-container-name", "", "Container name") flags.StringVar(&svfs.SwiftConnection.AuthToken, "os-auth-token", "", "Authentification token") flags.StringVar(&svfs.SwiftConnection.UserName, "os-username", "", "Username") flags.StringVar(&svfs.SwiftConnection.ApiKey, "os-password", "", "User password") - flags.StringVar(&svfs.SwiftConnection.DomainId, "os-user-domain-name", "", "User domain name") + flags.StringVar(&svfs.SwiftConnection.DomainId, "os-user-domain-name", "default", "User domain name") flags.StringVar(&svfs.SwiftConnection.Region, "os-region-name", "", "Region name") flags.StringVar(&svfs.SwiftConnection.StorageUrl, "os-storage-url", "", "Storage URL") flags.BoolVar(&svfs.SwiftConnection.Internal, "os-internal-endpoint", false, "Use internal storage URL") diff --git a/svfs/version.go b/svfs/version.go index 01dc6e8..9143ac0 100644 --- a/svfs/version.go +++ b/svfs/version.go @@ -1,4 +1,4 @@ package svfs // Version is the current SVFS version -const Version = "0.9.2" +const Version = "0.9.4"