Skip to content

Commit 712c6d0

Browse files
authored
fix(region): optimized zettakit (#21673)
1 parent 292cbaf commit 712c6d0

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2019 Yunion
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package providerdriver
16+
17+
import (
18+
api "yunion.io/x/onecloud/pkg/apis/compute"
19+
)
20+
21+
type ZettaKitCollect struct {
22+
SCollectByResourceIdDriver
23+
}
24+
25+
func (self *ZettaKitCollect) GetProvider() string {
26+
return api.CLOUD_PROVIDER_ZETTAKIT
27+
}
28+
29+
func (self *ZettaKitCollect) IsSupportMetrics() bool {
30+
return true
31+
}
32+
33+
func init() {
34+
Register(&ZettaKitCollect{})
35+
}

pkg/compute/regiondrivers/zettakit.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
package regiondrivers
1616

1717
import (
18+
"yunion.io/x/sqlchemy"
19+
1820
api "yunion.io/x/onecloud/pkg/apis/compute"
1921
"yunion.io/x/onecloud/pkg/compute/models"
2022
)
@@ -39,3 +41,9 @@ func (self *SZettaKitRegionDriver) IsSupportedElasticcacheSecgroup() bool {
3941
func (self *SZettaKitRegionDriver) GetMaxElasticcacheSecurityGroupCount() int {
4042
return 1
4143
}
44+
45+
func (self *SZettaKitRegionDriver) GetSecurityGroupFilter(vpc *models.SVpc) (func(q *sqlchemy.SQuery) *sqlchemy.SQuery, error) {
46+
return func(q *sqlchemy.SQuery) *sqlchemy.SQuery {
47+
return q.Equals("cloudregion_id", vpc.CloudregionId).Equals("manager_id", vpc.ManagerId)
48+
}, nil
49+
}

0 commit comments

Comments
 (0)