declare unsupported vSphere versions for in-tree plugin

This commit is contained in:
Divyen Patel 2022-07-19 13:01:12 -07:00
parent 4885f4d750
commit d4bd81044e
3 changed files with 16 additions and 19 deletions

View File

@ -218,16 +218,12 @@ func (connection *VSphereConnection) NewClient(ctx context.Context) (*vim25.Clie
connection.RoundTripperCount = RoundTripperDefaultCount connection.RoundTripperCount = RoundTripperDefaultCount
} }
client.RoundTripper = vim25.Retry(client.RoundTripper, vim25.TemporaryNetworkError(int(connection.RoundTripperCount))) client.RoundTripper = vim25.Retry(client.RoundTripper, vim25.TemporaryNetworkError(int(connection.RoundTripperCount)))
vcdeprecated, err := isvCenterDeprecated(client.ServiceContent.About.Version, client.ServiceContent.About.ApiVersion) vcNotSupported, err := isvCenterNotSupported(client.ServiceContent.About.Version, client.ServiceContent.About.ApiVersion)
if err != nil { if err != nil {
klog.Errorf("failed to check if vCenter version:%v and api version: %s is deprecated. Error: %v", client.ServiceContent.About.Version, client.ServiceContent.About.ApiVersion, err) klog.Errorf("failed to check if vCenter version:%v and api version: %s is supported. Error: %v", client.ServiceContent.About.Version, client.ServiceContent.About.ApiVersion, err)
} }
if vcdeprecated { if vcNotSupported {
// After this deprecation, vSphere 6.5 support period is extended to October 15, 2022 as klog.Warningf("vCenter version is not supported. version: %s, api verson: %s Please consider upgrading vCenter and ESXi servers to 7.0u2 or higher", client.ServiceContent.About.Version, client.ServiceContent.About.ApiVersion)
// https://blogs.vmware.com/vsphere/2021/03/announcing-limited-extension-of-vmware-vsphere-6-5-general-support-period.html
// In addition, the external vSphere cloud provider does not support vSphere 6.5.
// Please keep vSphere 6.5 support til the period.
klog.Warningf("vCenter is deprecated. version: %s, api verson: %s Please consider upgrading vCenter and ESXi servers to 6.7u3 or higher", client.ServiceContent.About.Version, client.ServiceContent.About.ApiVersion)
} }
return client, nil return client, nil
} }

View File

@ -201,8 +201,9 @@ func VerifyVolumePathsForVMDevices(vmDevices object.VirtualDeviceList, volPaths
} }
// isvCenterDeprecated takes vCenter version and vCenter API version as input and return true if vCenter is deprecated // isvCenterNotSupported takes vCenter version and vCenter API version as input and return true if vCenter is no longer
func isvCenterDeprecated(vCenterVersion string, vCenterAPIVersion string) (bool, error) { // supported by VMware for in-tree vSphere volume plugin
func isvCenterNotSupported(vCenterVersion string, vCenterAPIVersion string) (bool, error) {
var vcversion, vcapiversion, minvcversion vcVersion var vcversion, vcapiversion, minvcversion vcVersion
var err error var err error
err = vcversion.parse(vCenterVersion) err = vcversion.parse(vCenterVersion)

View File

@ -70,11 +70,11 @@ func TestUtils(t *testing.T) {
} }
} }
func TestIsvCenterDeprecated(t *testing.T) { func TestIsvCenterNotSupported(t *testing.T) {
type testsData struct { type testsData struct {
vcVersion string vcVersion string
vcAPIVersion string vcAPIVersion string
isDeprecated bool isNotSupported bool
} }
testdataArray := []testsData{ testdataArray := []testsData{
{"8.0.0", "8.0.0.0", false}, {"8.0.0", "8.0.0.0", false},
@ -90,16 +90,16 @@ func TestIsvCenterDeprecated(t *testing.T) {
} }
for _, test := range testdataArray { for _, test := range testdataArray {
deprecated, err := isvCenterDeprecated(test.vcVersion, test.vcAPIVersion) notsupported, err := isvCenterNotSupported(test.vcVersion, test.vcAPIVersion)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if deprecated != test.isDeprecated { if notsupported != test.isNotSupported {
t.Fatalf("deprecation test failed for vc version: %q and vc API version: %q", t.Fatalf("test failed for vc version: %q and vc API version: %q",
test.vcVersion, test.vcAPIVersion) test.vcVersion, test.vcAPIVersion)
} else { } else {
t.Logf("deprecation test for vc version: %q and vc API version: %q passed. Is Deprecated : %v", t.Logf("test for vc version: %q and vc API version: %q passed. Is Not Supported : %v",
test.vcAPIVersion, test.vcAPIVersion, deprecated) test.vcAPIVersion, test.vcAPIVersion, notsupported)
} }
} }
} }