mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2026-01-03 22:06:36 +08:00
实现节点自动切换到备用IP
This commit is contained in:
@@ -401,6 +401,22 @@ func (this *NodeIPAddressDAO) UpdateAddressIsUp(tx *dbs.Tx, addressId int64, isU
|
||||
return this.NotifyUpdate(tx, addressId)
|
||||
}
|
||||
|
||||
// UpdateAddressBackupIP 设置备用IP
|
||||
func (this *NodeIPAddressDAO) UpdateAddressBackupIP(tx *dbs.Tx, addressId int64, thresholdId int64, ip string) error {
|
||||
if addressId <= 0 {
|
||||
return errors.New("invalid addressId")
|
||||
}
|
||||
var op = NewNodeIPAddressOperator()
|
||||
op.Id = addressId
|
||||
op.BackupThresholdId = thresholdId
|
||||
op.BackupIP = ip
|
||||
err := this.Save(tx, op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return this.NotifyUpdate(tx, addressId)
|
||||
}
|
||||
|
||||
// NotifyUpdate 通知更新
|
||||
func (this *NodeIPAddressDAO) NotifyUpdate(tx *dbs.Tx, addressId int64) error {
|
||||
address, err := this.Query(tx).
|
||||
|
||||
Reference in New Issue
Block a user