mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-08-30 17:13:08 +08:00
Merge branch 'master' into hotfix/scheduler-forecast-with-candidates
This commit is contained in:
@@ -117,6 +117,9 @@ type NetworkListInput struct {
|
||||
|
||||
// filter by Host schedtag
|
||||
HostSchedtagId string `json:"host_schedtag_id"`
|
||||
|
||||
// filter by BGP types
|
||||
BgpType []string `json:"bgp_type"`
|
||||
}
|
||||
|
||||
type NetworkResourceInfoBase struct {
|
||||
|
||||
@@ -698,34 +698,34 @@ func (factory *SPremiseBaseProviderFactory) NeedSyncSkuFromCloud() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
type SPublicCloudBaseProviderFactor struct {
|
||||
type SPublicCloudBaseProviderFactory struct {
|
||||
baseProviderFactory
|
||||
}
|
||||
|
||||
func (factory *SPublicCloudBaseProviderFactor) IsPublicCloud() bool {
|
||||
func (factory *SPublicCloudBaseProviderFactory) IsPublicCloud() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (factory *SPublicCloudBaseProviderFactor) IsSupportPrepaidResources() bool {
|
||||
func (factory *SPublicCloudBaseProviderFactory) IsSupportPrepaidResources() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (factory *SPublicCloudBaseProviderFactor) NeedSyncSkuFromCloud() bool {
|
||||
func (factory *SPublicCloudBaseProviderFactory) NeedSyncSkuFromCloud() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
type SPrivateCloudBaseProviderFactor struct {
|
||||
type SPrivateCloudBaseProviderFactory struct {
|
||||
baseProviderFactory
|
||||
}
|
||||
|
||||
func (factory *SPrivateCloudBaseProviderFactor) IsPublicCloud() bool {
|
||||
func (factory *SPrivateCloudBaseProviderFactory) IsPublicCloud() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (factory *SPrivateCloudBaseProviderFactor) IsSupportPrepaidResources() bool {
|
||||
func (factory *SPrivateCloudBaseProviderFactory) IsSupportPrepaidResources() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (factory *SPrivateCloudBaseProviderFactor) NeedSyncSkuFromCloud() bool {
|
||||
func (factory *SPrivateCloudBaseProviderFactory) NeedSyncSkuFromCloud() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/tristate"
|
||||
"yunion.io/x/pkg/util/regutils"
|
||||
"yunion.io/x/pkg/utils"
|
||||
"yunion.io/x/sqlchemy"
|
||||
|
||||
@@ -120,6 +121,11 @@ func (manager *SDnsRecordSetManager) ValidateCreateData(ctx context.Context, use
|
||||
return input, err
|
||||
}
|
||||
input.Name = strings.ToLower(input.Name)
|
||||
if input.Name != "*" && input.Name != "@" {
|
||||
if !regutils.MatchDomainName(input.Name) {
|
||||
return input, httperrors.NewInputParameterError("invalid domain name %s", input.Name)
|
||||
}
|
||||
}
|
||||
if len(input.DnsZoneId) == 0 {
|
||||
return input, httperrors.NewMissingParameterError("dns_zone_id")
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ type SNetwork struct {
|
||||
IsAutoAlloc tristate.TriState `nullable:"true" list:"user" get:"user" update:"user" create:"optional"`
|
||||
|
||||
// 线路类型
|
||||
BgpType string `width:"64" charset:"utf8" nullable:"false" get:"user" update:"user" create:"optional"`
|
||||
BgpType string `width:"64" charset:"utf8" nullable:"false" list:"user" get:"user" update:"user" create:"optional"`
|
||||
}
|
||||
|
||||
func (manager *SNetworkManager) GetContextManagers() [][]db.IModelManager {
|
||||
@@ -2018,6 +2018,9 @@ func (manager *SNetworkManager) ListItemFilter(
|
||||
if len(input.AllocPolicy) > 0 {
|
||||
q = q.In("alloc_policy", input.AllocPolicy)
|
||||
}
|
||||
if len(input.BgpType) > 0 {
|
||||
q = q.In("bgp_type", input.BgpType)
|
||||
}
|
||||
|
||||
if input.IsAutoAlloc != nil {
|
||||
if *input.IsAutoAlloc {
|
||||
|
||||
@@ -43,6 +43,8 @@ type NetworkListOptions struct {
|
||||
|
||||
GuestIpStart []string `help:"search by guest_ip_start"`
|
||||
GuestIpEnd []string `help:"search by guest_ip_end"`
|
||||
|
||||
BgpType []string `help:"filter by bgp_type"`
|
||||
}
|
||||
|
||||
func (opts *NetworkListOptions) GetContextId() string {
|
||||
|
||||
@@ -436,8 +436,8 @@ func (manager *SMetricMeasurementManager) reloadCache() error {
|
||||
if err := db.FetchModelObjects(manager, q, &objs); err != nil {
|
||||
return errors.Wrap(err, "Fetch all measurements")
|
||||
}
|
||||
for _, obj := range objs {
|
||||
manager.measurementsCache.set(obj.Name, &obj)
|
||||
for i, obj := range objs {
|
||||
manager.measurementsCache.set(obj.Name, &objs[i])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ func setDefaultValue(query *monitor.AlertQuery, inputQuery *monitor.MetricInputQ
|
||||
})
|
||||
}
|
||||
}
|
||||
if metricMeasurement.ResType == hostconsts.TELEGRAF_TAG_ONECLOUD_RES_TYPE {
|
||||
if metricMeasurement != nil && metricMeasurement.ResType == hostconsts.TELEGRAF_TAG_ONECLOUD_RES_TYPE {
|
||||
query.Model.Tags = append(query.Model.Tags, monitor.MetricQueryTag{
|
||||
Key: hostconsts.TELEGRAF_TAG_KEY_RES_TYPE,
|
||||
Operator: "=",
|
||||
|
||||
@@ -249,6 +249,9 @@ func (self *SDomain) GetId() string {
|
||||
}
|
||||
|
||||
func (self *SDomain) GetName() string {
|
||||
if len(self.PunyCode) > 0 {
|
||||
return self.PunyCode
|
||||
}
|
||||
return self.DomainName
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
)
|
||||
|
||||
type SAliyunProviderFactory struct {
|
||||
cloudprovider.SPublicCloudBaseProviderFactor
|
||||
cloudprovider.SPublicCloudBaseProviderFactory
|
||||
}
|
||||
|
||||
func (self *SAliyunProviderFactory) GetId() string {
|
||||
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
)
|
||||
|
||||
type SAwsProviderFactory struct {
|
||||
cloudprovider.SPublicCloudBaseProviderFactor
|
||||
cloudprovider.SPublicCloudBaseProviderFactory
|
||||
}
|
||||
|
||||
func (self *SAwsProviderFactory) GetId() string {
|
||||
|
||||
@@ -31,7 +31,7 @@ import (
|
||||
)
|
||||
|
||||
type SAzureProviderFactory struct {
|
||||
cloudprovider.SPublicCloudBaseProviderFactor
|
||||
cloudprovider.SPublicCloudBaseProviderFactory
|
||||
}
|
||||
|
||||
func (self *SAzureProviderFactory) GetId() string {
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
)
|
||||
|
||||
type SCtyunProviderFactory struct {
|
||||
cloudprovider.SPublicCloudBaseProviderFactor
|
||||
cloudprovider.SPublicCloudBaseProviderFactory
|
||||
}
|
||||
|
||||
func (self *SCtyunProviderFactory) GetId() string {
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
)
|
||||
|
||||
type SGoogleProviderFactory struct {
|
||||
cloudprovider.SPublicCloudBaseProviderFactor
|
||||
cloudprovider.SPublicCloudBaseProviderFactory
|
||||
}
|
||||
|
||||
func (self *SGoogleProviderFactory) GetId() string {
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
)
|
||||
|
||||
type SHuaweiProviderFactory struct {
|
||||
cloudprovider.SPublicCloudBaseProviderFactor
|
||||
cloudprovider.SPublicCloudBaseProviderFactory
|
||||
}
|
||||
|
||||
func (self *SHuaweiProviderFactory) GetId() string {
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
)
|
||||
|
||||
type SOpenStackProviderFactory struct {
|
||||
cloudprovider.SPrivateCloudBaseProviderFactor
|
||||
cloudprovider.SPrivateCloudBaseProviderFactory
|
||||
}
|
||||
|
||||
var EndpointTypes = []string{"admin", "internal", "public"}
|
||||
|
||||
@@ -173,6 +173,9 @@ func (self *SDomian) GetId() string {
|
||||
}
|
||||
|
||||
func (self *SDomian) GetName() string {
|
||||
if len(self.Punycode) > 0 {
|
||||
return self.Punycode
|
||||
}
|
||||
return self.Name
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import (
|
||||
)
|
||||
|
||||
type SQcloudProviderFactory struct {
|
||||
cloudprovider.SPublicCloudBaseProviderFactor
|
||||
cloudprovider.SPublicCloudBaseProviderFactory
|
||||
}
|
||||
|
||||
func (self *SQcloudProviderFactory) GetId() string {
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
|
||||
// tag:finished
|
||||
type SUcloudProviderFactory struct {
|
||||
cloudprovider.SPublicCloudBaseProviderFactor
|
||||
cloudprovider.SPublicCloudBaseProviderFactory
|
||||
}
|
||||
|
||||
func (self *SUcloudProviderFactory) GetId() string {
|
||||
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
)
|
||||
|
||||
type SZStackProviderFactory struct {
|
||||
cloudprovider.SPrivateCloudBaseProviderFactor
|
||||
cloudprovider.SPrivateCloudBaseProviderFactory
|
||||
}
|
||||
|
||||
func (self *SZStackProviderFactory) GetId() string {
|
||||
|
||||
Reference in New Issue
Block a user