Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tagrecorder] Subscribe ch_os_app_tag #5615

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions server/controller/recorder/pubsub/message/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ type HostFieldsUpdate struct {
Key
Name fieldDetail[string]
IP fieldDetail[string]
UID fieldDetail[string]
HType fieldDetail[int]
VCPUNum fieldDetail[int]
MemTotal fieldDetail[int]
Expand All @@ -210,6 +211,7 @@ type VMFieldsUpdate struct {
LaunchServer fieldDetail[string]
CloudTags fieldDetail[map[string]string]
HostID fieldDetail[int]
UID fieldDetail[string]
Hostname fieldDetail[string]
VPCID fieldDetail[int]
VPCLcuuid fieldDetail[string]
Expand Down Expand Up @@ -442,6 +444,7 @@ type NATGatewayFieldsUpdate struct {
Name fieldDetail[string]
FloatingIPs fieldDetail[string]
RegionLcuuid fieldDetail[string]
UID fieldDetail[string]
}
type NATGatewayUpdate struct {
Fields[NATGatewayFieldsUpdate]
Expand Down Expand Up @@ -473,6 +476,7 @@ type NATVMConnectionUpdate struct {
type LBFieldsUpdate struct {
Key
Name fieldDetail[string]
UID fieldDetail[string]
Model fieldDetail[int]
VIP fieldDetail[string]
RegionLcuuid fieldDetail[string]
Expand Down Expand Up @@ -553,6 +557,7 @@ type CENUpdate struct {
type RDSInstanceFieldsUpdate struct {
Key
Name fieldDetail[string]
UID fieldDetail[string]
State fieldDetail[int]
Series fieldDetail[int]
Model fieldDetail[int]
Expand All @@ -569,6 +574,7 @@ type RDSInstanceUpdate struct {
type RedisInstanceFieldsUpdate struct {
Key
Name fieldDetail[string]
UID fieldDetail[string]
State fieldDetail[int]
PublicHost fieldDetail[string]
AZLcuuid fieldDetail[string]
Expand Down
1 change: 1 addition & 0 deletions server/controller/recorder/updater/pod_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func (p *PodGroup) generateUpdateInfo(diffBase *diffbase.PodGroup, cloudItem *cl
if diffBase.Name != cloudItem.Name {
mapInfo["name"] = cloudItem.Name
structInfo.Name.Set(diffBase.Name, cloudItem.Name)
structInfo.Type.SetNew(cloudItem.Type)
}
if diffBase.Type != cloudItem.Type {
mapInfo["type"] = cloudItem.Type
Expand Down
10 changes: 10 additions & 0 deletions server/controller/tagrecorder/ch_az.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package tagrecorder

import (
"gorm.io/gorm/clause"

"github.com/deepflowio/deepflow/server/controller/common"
"github.com/deepflowio/deepflow/server/controller/db/mysql"
"github.com/deepflowio/deepflow/server/controller/recorder/pubsub/message"
Expand Down Expand Up @@ -78,3 +80,11 @@ func (a *ChAZ) sourceToTarget(az *mysql.AZ) (keys []IDKey, targets []mysql.ChAZ)
})
return
}

// softDeletedTargetsUpdated implements SubscriberDataGenerator
func (a *ChAZ) softDeletedTargetsUpdated(targets []mysql.ChAZ) {
mysql.Db.Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "id"}},
DoUpdates: clause.AssignmentColumns([]string{"name"}),
}).Create(&targets)
}
10 changes: 10 additions & 0 deletions server/controller/tagrecorder/ch_chost.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package tagrecorder

import (
"gorm.io/gorm/clause"

"github.com/deepflowio/deepflow/server/controller/common"
"github.com/deepflowio/deepflow/server/controller/db/mysql"
"github.com/deepflowio/deepflow/server/controller/recorder/pubsub/message"
Expand Down Expand Up @@ -80,3 +82,11 @@ func (c *ChChost) onResourceUpdated(sourceID int, fieldsUpdate *message.VMFields
c.SubscriberComponent.dbOperator.update(chItem, updateInfo, IDKey{ID: sourceID})
}
}

// softDeletedTargetsUpdated implements SubscriberDataGenerator
func (c *ChChost) softDeletedTargetsUpdated(targets []mysql.ChChost) {
mysql.Db.Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "id"}},
DoUpdates: clause.AssignmentColumns([]string{"name"}),
}).Create(&targets)
}
5 changes: 5 additions & 0 deletions server/controller/tagrecorder/ch_chost_cloud_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,8 @@ func (c *ChChostCloudTag) sourceToTarget(source *mysql.VM) (keys []CloudTagKey,
func (c *ChChostCloudTag) newTargetKey(id int, key string) CloudTagKey {
return CloudTagKey{ID: id, Key: key}
}

// softDeletedTargetsUpdated implements SubscriberDataGenerator
func (c *ChChostCloudTag) softDeletedTargetsUpdated(targets []mysql.ChChostCloudTag) {

}
5 changes: 5 additions & 0 deletions server/controller/tagrecorder/ch_chost_cloud_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,8 @@ func (c *ChChostCloudTags) sourceToTarget(item *mysql.VM) (keys []CloudTagsKey,
}
return []CloudTagsKey{{ID: item.ID}}, []mysql.ChChostCloudTags{{ID: item.ID, CloudTags: string(bytes)}}
}

// softDeletedTargetsUpdated implements SubscriberDataGenerator
func (c *ChChostCloudTags) softDeletedTargetsUpdated(targets []mysql.ChChostCloudTags) {

}
Loading
Loading