fix(region): return sql error

This commit is contained in:
Qu Xuan
2021-08-11 19:13:25 +08:00
parent 1306de980a
commit f664cc25a9
123 changed files with 692 additions and 621 deletions
@@ -83,7 +83,7 @@ func (p *CloudregionSchedtagPredicate) GetCandidateResource(c core.Candidater) I
if zone == nil {
return nil
}
region := zone.GetRegion()
region, _ := zone.GetRegion()
if region == nil {
return nil
}
@@ -185,10 +185,13 @@ func IsNetworkAvailable(
}
}
if wire != "" && !utils.HasPrefix(wire, n.WireId) && !utils.HasPrefix(wire, n.GetWire().GetName()) {
return FailReason{
Reason: fmt.Sprintf("Wire %s != %s", wire, n.WireId),
Type: NetworkWire,
if wire != "" && !utils.HasPrefix(wire, n.WireId) {
_wire, _ := n.GetWire()
if !utils.HasPrefix(wire, _wire.GetName()) {
return FailReason{
Reason: fmt.Sprintf("Wire %s != %s", wire, n.WireId),
Type: NetworkWire,
}
}
}
+2 -2
View File
@@ -476,12 +476,12 @@ func (b *BaseHostDesc) fillCloudProvider(host *computemodels.SHost) error {
}
func (b *BaseHostDesc) fillRegion(host *computemodels.SHost) error {
b.Region = host.GetRegion()
b.Region, _ = host.GetRegion()
return nil
}
func (b *BaseHostDesc) fillZone(host *computemodels.SHost) error {
zone := host.GetZone()
zone, _ := host.GetZone()
b.Zone = zone
b.ZoneId = host.ZoneId
return nil