mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): vendor update (#22490)
This commit is contained in:
@@ -87,14 +87,14 @@ 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.20250427071026-59840043b054
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250508100452-51742e9c8266
|
||||
yunion.io/x/executor v0.0.0-20241205080005-48f5b1212256
|
||||
yunion.io/x/jsonutils v1.0.1-0.20250406102002-98c9140a9edd
|
||||
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
|
||||
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
|
||||
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900
|
||||
yunion.io/x/pkg v1.10.4-0.20250403114914-586e94d39281
|
||||
yunion.io/x/s3cli v0.0.0-20241221171442-1c11599d28e1
|
||||
yunion.io/x/sqlchemy v1.1.3-0.20250420094945-40f40c75a31f
|
||||
yunion.io/x/sqlchemy v1.1.3-0.20250507115529-f74b83fda63b
|
||||
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c
|
||||
)
|
||||
|
||||
|
||||
@@ -1274,13 +1274,13 @@ 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.20250427071026-59840043b054 h1:Inkg77kZHyRTxfH/jhVUejpgrgtI64KYerIw+mM3UOs=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250427071026-59840043b054/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250508100452-51742e9c8266 h1:ci2s8wllLSZR4Zdh5FpcOfVpyBydOqEi/X8X1ePgmuw=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250508100452-51742e9c8266/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
|
||||
yunion.io/x/executor v0.0.0-20241205080005-48f5b1212256 h1:kLKQ6zbgPDQflRwoHFAjxNChcbhXIFgsUVLkJwiXu/8=
|
||||
yunion.io/x/executor v0.0.0-20241205080005-48f5b1212256/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
yunion.io/x/jsonutils v1.0.1-0.20250406102002-98c9140a9edd h1:FWwB4CXiyIrh2YvxPliC9ZmrzXcFv+nuG3lhpipR4Sk=
|
||||
yunion.io/x/jsonutils v1.0.1-0.20250406102002-98c9140a9edd/go.mod h1:VK4Z93dgiKgAijcSqbMKmGaBMJuHulR16Hz4K015ZPo=
|
||||
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1 h1:/+THlvf/MvgCW+7KeCDCr33e81KSRa5JmdZ1IIyLOXQ=
|
||||
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1/go.mod h1:VK4Z93dgiKgAijcSqbMKmGaBMJuHulR16Hz4K015ZPo=
|
||||
yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b/go.mod h1:+gauLs73omeJAPlsXcevLsJLKixV+sR/E7WSYTSx1fE=
|
||||
yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d/go.mod h1:LC6f/4FozL0iaAbnFt2eDX9jlsyo3WiOUPm03d7+U4U=
|
||||
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91 h1:inY5o3LDa/zgsIZuPN0HmpzKIsu/lLgsBmMttuDPGj4=
|
||||
@@ -1293,7 +1293,7 @@ yunion.io/x/pkg v1.10.4-0.20250403114914-586e94d39281 h1:P22/MaBc9bqE9DyHvS3oQjc
|
||||
yunion.io/x/pkg v1.10.4-0.20250403114914-586e94d39281/go.mod h1:0Bwxqd9MA3ACi119/l02FprY/o9gHahmYC2bsSbnVpM=
|
||||
yunion.io/x/s3cli v0.0.0-20241221171442-1c11599d28e1 h1:1KJ3YYinydPHpDEQRXdr/T8SYcKZ5Er+m489H+PnaQ4=
|
||||
yunion.io/x/s3cli v0.0.0-20241221171442-1c11599d28e1/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo=
|
||||
yunion.io/x/sqlchemy v1.1.3-0.20250420094945-40f40c75a31f h1:xuy9a8Hg0d8dfD8j13f687eKPCxEvttgpLQWb4NvKpI=
|
||||
yunion.io/x/sqlchemy v1.1.3-0.20250420094945-40f40c75a31f/go.mod h1:vCIZpqhZ5Jzaq3tFyrti/vv8BijQKtkzSgNT/uH4H5A=
|
||||
yunion.io/x/sqlchemy v1.1.3-0.20250507115529-f74b83fda63b h1:VDSvBxXEcrac4pw9+fHP17XXPZNgHzkUPxtGDNx518M=
|
||||
yunion.io/x/sqlchemy v1.1.3-0.20250507115529-f74b83fda63b/go.mod h1:vCIZpqhZ5Jzaq3tFyrti/vv8BijQKtkzSgNT/uH4H5A=
|
||||
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c h1:QuLab2kSRECZRxo4Lo2KcYn6XjQFDGaZ1+x0pYDVVwQ=
|
||||
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng=
|
||||
|
||||
Vendored
+3
-3
@@ -1576,7 +1576,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.20250427071026-59840043b054
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250508100452-51742e9c8266
|
||||
## explicit; go 1.21
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
@@ -1659,7 +1659,7 @@ yunion.io/x/cloudmux/pkg/multicloud/zstack/provider
|
||||
yunion.io/x/executor/apis
|
||||
yunion.io/x/executor/client
|
||||
yunion.io/x/executor/server
|
||||
# yunion.io/x/jsonutils v1.0.1-0.20250406102002-98c9140a9edd
|
||||
# yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
|
||||
## explicit; go 1.18
|
||||
yunion.io/x/jsonutils
|
||||
# yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
|
||||
@@ -1725,7 +1725,7 @@ yunion.io/x/pkg/utils
|
||||
# yunion.io/x/s3cli v0.0.0-20241221171442-1c11599d28e1
|
||||
## explicit; go 1.12
|
||||
yunion.io/x/s3cli
|
||||
# yunion.io/x/sqlchemy v1.1.3-0.20250420094945-40f40c75a31f
|
||||
# yunion.io/x/sqlchemy v1.1.3-0.20250507115529-f74b83fda63b
|
||||
## explicit; go 1.17
|
||||
yunion.io/x/sqlchemy
|
||||
yunion.io/x/sqlchemy/backends
|
||||
|
||||
+2
-2
@@ -312,12 +312,12 @@ func (self *SRegion) resizeDisk(diskId string, sizeMb int64) error {
|
||||
sizeGb := sizeMb / 1024
|
||||
params := make(map[string]string)
|
||||
params["DiskId"] = diskId
|
||||
params["Type"] = "online"
|
||||
params["NewSize"] = fmt.Sprintf("%d", sizeGb)
|
||||
|
||||
_, err := self.ecsRequest("ResizeDisk", params)
|
||||
if err != nil {
|
||||
log.Errorf("resizing disk (%s) to %d GiB failed: %s", diskId, sizeGb, err)
|
||||
return err
|
||||
return errors.Wrapf(err, "ResizeDisk %d GB", sizeGb)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
+2
-16
@@ -120,7 +120,6 @@ type SInstance struct {
|
||||
Onboot bool `json:"onboot"`
|
||||
Startup string `json:"startup,omitempty"`
|
||||
Tablet bool `json:"tablet"`
|
||||
Agent int `json:"agent"`
|
||||
Memory int `json:"memory"`
|
||||
Balloon int `json:"balloon"`
|
||||
QemuOs string `json:"ostype"`
|
||||
@@ -496,7 +495,7 @@ func (self *SRegion) GetVmAgentNetworkInterfaces(node string, VmId int) (map[str
|
||||
res := fmt.Sprintf("/nodes/%s/qemu/%d/agent/network-get-interfaces", node, VmId)
|
||||
err := self.getAgent(res, url.Values{}, &intermediates)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "GetVmAgentNetworkInterfaces")
|
||||
return ipMap, errors.Wrap(err, "GetVmAgentNetworkInterfaces")
|
||||
}
|
||||
|
||||
for _, intermediate := range intermediates {
|
||||
@@ -615,19 +614,6 @@ func (self *SRegion) GetQemuConfig(node string, VmId int) (*SInstance, error) {
|
||||
config.Sshkeys, _ = url.PathUnescape(vmConfig["sshkeys"].(string))
|
||||
}
|
||||
|
||||
agent := 0
|
||||
if _, ok := vmConfig["agent"]; ok {
|
||||
switch vmConfig["agent"].(type) {
|
||||
case int64:
|
||||
agent = int(vmConfig["agent"].(int64))
|
||||
case string:
|
||||
agentConfList := strings.Split(vmConfig["agent"].(string), ",")
|
||||
agent, _ = strconv.Atoi(agentConfList[0])
|
||||
}
|
||||
|
||||
}
|
||||
config.Agent = agent
|
||||
|
||||
config.PowerState = self.GetVmPowerStatus(node, VmId)
|
||||
|
||||
// Add disks.
|
||||
@@ -717,7 +703,7 @@ func (self *SRegion) GetQemuConfig(node string, VmId int) (*SInstance, error) {
|
||||
// Add networks.
|
||||
nicNames := []string{}
|
||||
ipMap := make(map[string]string)
|
||||
if config.PowerState == "running" && config.Agent == 1 {
|
||||
if config.PowerState == "running" {
|
||||
ipMap, _ = self.GetVmAgentNetworkInterfaces(node, VmId)
|
||||
}
|
||||
|
||||
|
||||
+12
-2
@@ -49,6 +49,14 @@ func (e *JSONError) Error() string {
|
||||
}
|
||||
|
||||
func NewJSONError(str []byte, pos int, msg string) *JSONError {
|
||||
if len(str) == 0 {
|
||||
return &JSONError{pos: 0, substr: "", msg: msg}
|
||||
}
|
||||
if pos < 0 {
|
||||
pos = 0
|
||||
} else if pos > len(str)-1 {
|
||||
pos = len(str) - 1
|
||||
}
|
||||
sublen := 10
|
||||
start := pos - sublen
|
||||
end := pos + sublen
|
||||
@@ -58,7 +66,9 @@ func NewJSONError(str []byte, pos int, msg string) *JSONError {
|
||||
if end > len(str) {
|
||||
end = len(str)
|
||||
}
|
||||
substr := append(str[start:pos], '^')
|
||||
substr = append(substr, str[pos:end]...)
|
||||
substr := make([]byte, end-start+1)
|
||||
copy(substr, str[start:pos])
|
||||
substr[pos-start] = '^'
|
||||
copy(substr[pos-start+1:], str[pos:end])
|
||||
return &JSONError{pos: pos, substr: string(substr), msg: msg}
|
||||
}
|
||||
|
||||
+30
@@ -22,6 +22,7 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/gotypes"
|
||||
"yunion.io/x/pkg/sortedmap"
|
||||
@@ -678,3 +679,32 @@ func ParseStream(str []byte, offset int) (JSONObject, int, error) {
|
||||
return nil, i, NewJSONError(str, i, "Empty string")
|
||||
}
|
||||
}
|
||||
|
||||
func ParseJsonStreams(stream []byte) ([]JSONObject, error) {
|
||||
ret := make([]JSONObject, 0)
|
||||
errs := make([]error, 0)
|
||||
offset := 0
|
||||
for offset < len(stream) {
|
||||
for offset < len(stream) && stream[offset] != '[' && stream[offset] != '{' {
|
||||
offset++
|
||||
}
|
||||
if offset >= len(stream) {
|
||||
break
|
||||
}
|
||||
json, noffset, err := ParseStream(stream, offset)
|
||||
if err != nil {
|
||||
errs = append(errs, errors.Wrapf(err, "jsonutils.ParseStream fail at %d", offset))
|
||||
offset++
|
||||
} else {
|
||||
ret = append(ret, json)
|
||||
offset = noffset
|
||||
}
|
||||
}
|
||||
if len(errs) > 0 && len(ret) == 0 {
|
||||
return nil, errors.NewAggregate(errs)
|
||||
}
|
||||
if len(errs) > 0 {
|
||||
log.Warningf("jsonutils.ParseJsonStreams: %d errors, %s", len(errs), errors.NewAggregate(errs))
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
+7
-7
@@ -123,17 +123,17 @@ func (click *SClickhouseBackend) GetCreateSQLs(ts sqlchemy.ITableSpec) []string
|
||||
var ttlCol IClickhouseColumnSpec
|
||||
for _, c := range ts.Columns() {
|
||||
cols = append(cols, c.DefinitionString())
|
||||
if c.IsPrimary() {
|
||||
primaries = append(primaries, fmt.Sprintf("`%s`", c.Name()))
|
||||
}
|
||||
if cc, ok := c.(IClickhouseColumnSpec); ok {
|
||||
if cc.IsOrderBy() {
|
||||
orderbys = append(orderbys, fmt.Sprintf("`%s`", c.Name()))
|
||||
}
|
||||
partition := cc.PartitionBy()
|
||||
if len(partition) > 0 && !utils.IsInStringArray(partition, partitions) {
|
||||
partitions = append(partitions, partition)
|
||||
}
|
||||
if c.IsPrimary() && len(partition) == 0 {
|
||||
primaries = append(primaries, fmt.Sprintf("`%s`", c.Name()))
|
||||
}
|
||||
if cc.IsOrderBy() && len(partition) == 0 {
|
||||
orderbys = append(orderbys, fmt.Sprintf("`%s`", c.Name()))
|
||||
}
|
||||
ttlC, ttlU := cc.GetTTL()
|
||||
if ttlC > 0 && len(ttlU) > 0 {
|
||||
ttlCol = cc
|
||||
@@ -183,7 +183,7 @@ func (click *SClickhouseBackend) GetCreateSQLs(ts sqlchemy.ITableSpec) []string
|
||||
createSql += fmt.Sprintf("\nTTL `%s` + INTERVAL %d %s", ttlCol.Name(), ttlCount, ttlUnit)
|
||||
}
|
||||
// set default time zone of table to UTC
|
||||
createSql += "\nSETTINGS index_granularity=8192, allow_nullable_key=1"
|
||||
createSql += "\nSETTINGS index_granularity=8192"
|
||||
}
|
||||
return []string{
|
||||
createSql,
|
||||
|
||||
+9
-4
@@ -22,10 +22,15 @@ import (
|
||||
"yunion.io/x/log"
|
||||
)
|
||||
|
||||
func getSQLFilters(filter map[string]interface{}, qChar string) ([]string, []interface{}) {
|
||||
func (ts *STableSpec) getSQLFilters(filter map[string]interface{}, qChar string) ([]string, []interface{}) {
|
||||
conds := make([]string, 0, len(filter))
|
||||
params := make([]interface{}, 0, len(filter))
|
||||
for k, v := range filter {
|
||||
col := ts.ColumnSpec(k)
|
||||
if col == nil {
|
||||
log.Warningf("getSQLFilters: column %s not found", k)
|
||||
continue
|
||||
}
|
||||
if reflect.TypeOf(v).Kind() == reflect.Slice || reflect.TypeOf(v).Kind() == reflect.Array {
|
||||
value := reflect.ValueOf(v)
|
||||
if value.Len() == 0 {
|
||||
@@ -34,12 +39,12 @@ func getSQLFilters(filter map[string]interface{}, qChar string) ([]string, []int
|
||||
arr := make([]string, value.Len())
|
||||
for i := 0; i < value.Len(); i++ {
|
||||
arr[i] = "?"
|
||||
params = append(params, value.Index(i).Interface())
|
||||
params = append(params, col.ConvertFromValue(value.Index(i).Interface()))
|
||||
}
|
||||
conds = append(conds, fmt.Sprintf("%s%s%s in (%s)", qChar, k, qChar, strings.Join(arr, ", ")))
|
||||
} else {
|
||||
conds = append(conds, fmt.Sprintf("%s%s%s = ?", qChar, k, qChar))
|
||||
params = append(params, v)
|
||||
params = append(params, col.ConvertFromValue(v))
|
||||
}
|
||||
}
|
||||
return conds, params
|
||||
@@ -55,7 +60,7 @@ func (ts *STableSpec) DeleteFrom(filters map[string]interface{}) error {
|
||||
buf.WriteString(ts.Name())
|
||||
buf.WriteString(qChar)
|
||||
|
||||
conds, params := getSQLFilters(filters, qChar)
|
||||
conds, params := ts.getSQLFilters(filters, qChar)
|
||||
|
||||
if len(conds) > 0 {
|
||||
buf.WriteString(" WHERE ")
|
||||
|
||||
+6
@@ -61,6 +61,12 @@ func (tq *SQuery) Contains(f string, v string) *SQuery {
|
||||
return tq.Filter(cond)
|
||||
}
|
||||
|
||||
// Contains filters query with a contains condition
|
||||
func (tq *SQuery) ContainsAny(f string, v []string) *SQuery {
|
||||
cond := ContainsAny(tq.Field(f), v)
|
||||
return tq.Filter(cond)
|
||||
}
|
||||
|
||||
// Startswith filters query with a startswith condition
|
||||
func (tq *SQuery) Startswith(f string, v string) *SQuery {
|
||||
cond := Startswith(tq.Field(f), v)
|
||||
|
||||
+8
-3
@@ -31,10 +31,15 @@ func (ts *STableSpec) UpdateBatch(data map[string]interface{}, filter map[string
|
||||
params := make([]interface{}, 0, len(data))
|
||||
setter := make([]string, 0, len(data))
|
||||
for k, v := range data {
|
||||
col := ts.ColumnSpec(k)
|
||||
if col == nil {
|
||||
log.Warningf("UpdateBatch: column %s not found", k)
|
||||
continue
|
||||
}
|
||||
setter = append(setter, fmt.Sprintf("%s%s%s = ?", qChar, k, qChar))
|
||||
params = append(params, v)
|
||||
params = append(params, col.ConvertFromValue(v))
|
||||
}
|
||||
conds, condparams := getSQLFilters(filter, qChar)
|
||||
conds, condparams := ts.getSQLFilters(filter, qChar)
|
||||
params = append(params, condparams...)
|
||||
|
||||
buf := strings.Builder{}
|
||||
@@ -52,7 +57,7 @@ func (ts *STableSpec) UpdateBatch(data map[string]interface{}, filter map[string
|
||||
}
|
||||
|
||||
if DEBUG_SQLCHEMY {
|
||||
log.Infof("Update: %s %s", buf.String(), params)
|
||||
log.Infof("UpdateBATCH: %s %s", buf.String(), params)
|
||||
}
|
||||
|
||||
_, err := ts.Database().Exec(buf.String(), params...)
|
||||
|
||||
Reference in New Issue
Block a user