fix(region): vendor update for optimized aliyun rds backup sync (#19371)

This commit is contained in:
屈轩
2024-01-29 18:07:45 +08:00
committed by GitHub
parent 9eec520567
commit de25515eb0
7 changed files with 34 additions and 52 deletions
+2 -2
View File
@@ -88,12 +88,12 @@ require (
k8s.io/client-go v0.19.3
k8s.io/cluster-bootstrap v0.19.3
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240124090018-b46efa81820a
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240129093013-4fd2018e35b0
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32
yunion.io/x/jsonutils v1.0.1-0.20230613121553-0f3b41e2ef19
yunion.io/x/log v1.0.1-0.20230411060016-feb3f46ab361
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900
yunion.io/x/pkg v1.0.1-0.20240124105902-168796cfcdec
yunion.io/x/pkg v1.10.1-0.20240127153242-cdf9dc071f4f
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
yunion.io/x/sqlchemy v1.1.3-0.20240103021517-2be4fb49bd3b
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c
+4 -4
View File
@@ -1201,8 +1201,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240124090018-b46efa81820a h1:iyCDderC0qGhjNx8bT7xxLr9+/uoddKvqCuJAONzYw0=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240124090018-b46efa81820a/go.mod h1:aj1gR9PPb6eqqKOwvANe26CoZFY8ydmXy0fuvgKYXH0=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240129093013-4fd2018e35b0 h1:JKpPIowUHSRt8QVKJjsdca/R59nWhsS150avIsT+ils=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240129093013-4fd2018e35b0/go.mod h1:aj1gR9PPb6eqqKOwvANe26CoZFY8ydmXy0fuvgKYXH0=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 h1:v7POYkQwo1XzOxBoIoRVr/k0V9Y5JyjpshlIFa9raug=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
@@ -1216,8 +1216,8 @@ yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900 h1:Hu/4ERvoWaN6aiFs4h4/yvVB
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900/go.mod h1:0vLkNEhlmA64HViPBAnSTUMrx5QP1CLsxXmxDKQ80tc=
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v1.0.1-0.20240124105902-168796cfcdec h1:phHKScNpiGsudQcZ/ZxhoJ/X25xfA72SiMS7rYZtPl8=
yunion.io/x/pkg v1.0.1-0.20240124105902-168796cfcdec/go.mod h1:ksCJVQ+DwKrJ5QBEoU8pzrDFfDaZVAFH/iJ6yQCYxJk=
yunion.io/x/pkg v1.10.1-0.20240127153242-cdf9dc071f4f h1:nLMBj8S3/ev2pB1wzGSi6hOM0aMK0DS2oyuQFzHbfkI=
yunion.io/x/pkg v1.10.1-0.20240127153242-cdf9dc071f4f/go.mod h1:ksCJVQ+DwKrJ5QBEoU8pzrDFfDaZVAFH/iJ6yQCYxJk=
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo=
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo=
yunion.io/x/sqlchemy v1.1.3-0.20240103021517-2be4fb49bd3b h1:W87Fe3H4wVm2CIrsVXNuypnO3yV7nhkiWozd2lDruKM=
+6 -4
View File
@@ -1389,7 +1389,7 @@ func syncDBInstanceResource(
if err != nil {
log.Errorf("syncDBInstanceParameters error: %v", err)
}
if syncRange.IsNotSkipSyncResource(DBInstanceBackupManager) {
if syncRange.IsNotSkipSyncResource(DBInstanceDatabaseManager) {
err = syncDBInstanceDatabases(ctx, userCred, syncResults, localInstance, remoteInstance)
if err != nil {
log.Errorf("syncDBInstanceParameters error: %v", err)
@@ -1399,9 +1399,11 @@ func syncDBInstanceResource(
if err != nil {
log.Errorf("syncDBInstanceAccounts: %v", err)
}
err = syncDBInstanceBackups(ctx, userCred, syncResults, localInstance, remoteInstance)
if err != nil {
log.Errorf("syncDBInstanceBackups: %v", err)
if syncRange.IsNotSkipSyncResource(DBInstanceBackupManager) {
err = syncDBInstanceBackups(ctx, userCred, syncResults, localInstance, remoteInstance)
if err != nil {
log.Errorf("syncDBInstanceBackups: %v", err)
}
}
}
+2 -2
View File
@@ -1465,7 +1465,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
# sigs.k8s.io/yaml v1.2.0
## explicit; go 1.12
sigs.k8s.io/yaml
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240124090018-b46efa81820a
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240129093013-4fd2018e35b0
## explicit; go 1.18
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing
@@ -1560,7 +1560,7 @@ yunion.io/x/log/hooks
yunion.io/x/ovsdb/cli_util
yunion.io/x/ovsdb/schema/ovn_nb
yunion.io/x/ovsdb/types
# yunion.io/x/pkg v1.0.1-0.20240124105902-168796cfcdec
# yunion.io/x/pkg v1.10.1-0.20240127153242-cdf9dc071f4f
## explicit; go 1.18
yunion.io/x/pkg/appctx
yunion.io/x/pkg/errors
-13
View File
@@ -577,19 +577,6 @@ func (self *SRegion) GetRdsSecgroupIds(rdsId string) ([]string, error) {
return ids, nil
}
func (region *SRegion) GetIDBInstanceBackupById(backupId string) (cloudprovider.ICloudDBInstanceBackup, error) {
backups, err := region.GetIDBInstanceBackups()
if err != nil {
return nil, errors.Wrap(err, "region.GetIDBInstanceBackups")
}
for _, backup := range backups {
if backup.GetGlobalId() == backupId {
return backup, nil
}
}
return nil, cloudprovider.ErrNotFound
}
func (rds *SDBInstance) Reboot() error {
return rds.region.RebootDBInstance(rds.DBInstanceId)
}
+6 -27
View File
@@ -33,6 +33,8 @@ type SDBInstanceBackup struct {
AliyunTags
region *SRegion
Engine string
EngineVersion string
BackupDBNames string
BackupIntranetDownloadURL string
BackupDownloadURL string
@@ -101,19 +103,11 @@ func (backup *SDBInstanceBackup) GetDBNames() string {
}
func (backup *SDBInstanceBackup) GetEngine() string {
instance, _ := backup.region.GetDBInstanceDetail(backup.DBInstanceId)
if instance != nil {
return instance.Engine
}
return ""
return backup.Engine
}
func (backup *SDBInstanceBackup) GetEngineVersion() string {
instance, _ := backup.region.GetDBInstanceDetail(backup.DBInstanceId)
if instance != nil {
return instance.EngineVersion
}
return ""
return backup.EngineVersion
}
func (backup *SDBInstanceBackup) GetDBInstanceId() string {
@@ -146,23 +140,6 @@ func (region *SRegion) GetDBInstanceBackups(instanceId, backupId string, offset
return backups, int(total), nil
}
func (region *SRegion) GetIDBInstanceBackups() ([]cloudprovider.ICloudDBInstanceBackup, error) {
dbinstnaces, err := region.GetIDBInstances()
if err != nil {
return nil, err
}
ibackups := []cloudprovider.ICloudDBInstanceBackup{}
for i := 0; i < len(dbinstnaces); i++ {
_dbinstance := dbinstnaces[i].(*SDBInstance)
_ibackup, err := _dbinstance.GetIDBInstanceBackups()
if err != nil {
return nil, errors.Wrapf(err, "_dbinstance(%v).GetIDBInstanceBackups", _dbinstance)
}
ibackups = append(ibackups, _ibackup...)
}
return ibackups, nil
}
func (rds *SDBInstance) GetIDBInstanceBackups() ([]cloudprovider.ICloudDBInstanceBackup, error) {
backups := []SDBInstanceBackup{}
for {
@@ -179,6 +156,8 @@ func (rds *SDBInstance) GetIDBInstanceBackups() ([]cloudprovider.ICloudDBInstanc
ibackups := []cloudprovider.ICloudDBInstanceBackup{}
for i := 0; i < len(backups); i++ {
backups[i].region = rds.region
backups[i].Engine = rds.Engine
backups[i].EngineVersion = rds.EngineVersion
ibackups = append(ibackups, &backups[i])
}
return ibackups, nil
+14
View File
@@ -777,3 +777,17 @@ func (rl IPV6AddrRangeList) Substract(addrRange IPV6AddrRange) []IPV6AddrRange {
}
return ret
}
func Mac2LinkLocal(mac string) (IPV6Addr, error) {
macBytes, err := ParseMac(mac)
if err != nil {
return IPV6Addr{}, errors.Wrap(err, "ParseMac")
}
return IPV6Addr{
0xfe80, 0, 0, 0,
binary.BigEndian.Uint16([]byte{macBytes[0] ^ 0x02, macBytes[1]}),
binary.BigEndian.Uint16([]byte{macBytes[2], 0xff}),
binary.BigEndian.Uint16([]byte{0xfe, macBytes[3]}),
binary.BigEndian.Uint16([]byte{macBytes[4], macBytes[5]}),
}, nil
}