mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: host sync wire class metadata
This commit is contained in:
@@ -4350,6 +4350,7 @@ func (self *SHost) addNetif(ctx context.Context, userCred mcclient.TokenCredenti
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
hw.syncClassMetadata(ctx)
|
||||
} else {
|
||||
db.Update(hw, func() error {
|
||||
hw.Bridge = bridge
|
||||
@@ -4359,6 +4360,7 @@ func (self *SHost) addNetif(ctx context.Context, userCred mcclient.TokenCredenti
|
||||
hw.IsMaster = isMaster
|
||||
return nil
|
||||
})
|
||||
hw.syncClassMetadata(ctx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,10 +299,16 @@ func (hw *SHostwire) PostCreate(
|
||||
data jsonutils.JSONObject,
|
||||
) {
|
||||
hw.SHostJointsBase.PostCreate(ctx, userCred, ownerId, query, data)
|
||||
hw.syncClassMetadata(ctx)
|
||||
}
|
||||
|
||||
func (hw *SHostwire) syncClassMetadata(ctx context.Context) error {
|
||||
host := hw.GetHost()
|
||||
wire := hw.GetWire()
|
||||
err := db.InheritFromTo(ctx, wire, host)
|
||||
if err != nil {
|
||||
log.Errorf("Inherit class metadata from host to wire fail: %s", err)
|
||||
return errors.Wrap(err, "InheritFromTo")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user