diff --git a/pkg/apis/compute/cloudaccount_const.go b/pkg/apis/compute/cloudaccount_const.go index e6440a691c..d7f54fd138 100644 --- a/pkg/apis/compute/cloudaccount_const.go +++ b/pkg/apis/compute/cloudaccount_const.go @@ -17,6 +17,7 @@ package compute import ( "yunion.io/x/onecloud/pkg/apis" "yunion.io/x/onecloud/pkg/cloudprovider" + "yunion.io/x/onecloud/pkg/util/choices" ) const ( @@ -67,6 +68,12 @@ const ( CLOUD_ACCOUNT_WIRE_LEVEL_CLUSTER = "cluster" ) +var CLOUD_ACCOUNT_WIRE_LEVELS = choices.NewChoices( + CLOUD_ACCOUNT_WIRE_LEVEL_VCENTER, + CLOUD_ACCOUNT_WIRE_LEVEL_DATACENTER, + CLOUD_ACCOUNT_WIRE_LEVEL_CLUSTER, +) + const ( CLOUD_ACCESS_ENV_AWS_GLOBAL = CLOUD_PROVIDER_AWS + "-int" CLOUD_ACCESS_ENV_AWS_CHINA = CLOUD_PROVIDER_AWS diff --git a/pkg/compute/models/cloudaccounts.go b/pkg/compute/models/cloudaccounts.go index 53c7358f7f..8837826f3a 100644 --- a/pkg/compute/models/cloudaccounts.go +++ b/pkg/compute/models/cloudaccounts.go @@ -417,7 +417,7 @@ func (scm *SCloudaccountManager) hostVMIPsPrepareNets(ctx context.Context, clien } } default: - return nil, httperrors.NewInputParameterError("valid wire_level_for_vmware, accept vcenter, datacenter, cluster") + return nil, httperrors.NewInputParameterError("invalid wire_level_for_vmware %q, accept %s", wireLevel, api.CLOUD_ACCOUNT_WIRE_LEVELS) } return ret, nil }