更改命名方式

This commit is contained in:
屈轩
2019-03-01 17:45:22 +08:00
parent 6063545a07
commit dc799abbc9
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -168,7 +168,7 @@ func (region *SRegion) GetIZoneById(id string) (cloudprovider.ICloudZone, error)
}
func (region *SRegion) fetchZones() error {
zone := &SZone{region: region, ZoneName: region.Name, hosts: map[string][]string{}}
zone := &SZone{region: region, ZoneName: region.Name, cachedHosts: map[string][]string{}}
_, resp, err := region.Get("compute", "/os-availability-zone/detail", "", jsonutils.NewDict())
if err != nil {
return err
@@ -181,11 +181,11 @@ func (region *SRegion) fetchZones() error {
if zones[i].ZoneName == "internal" {
continue
}
zone.hosts[zones[i].ZoneName] = []string{}
zone.cachedHosts[zones[i].ZoneName] = []string{}
for hostname, hostInfo := range zones[i].Hosts {
for k := range hostInfo {
if k == "nova-compute" {
zone.hosts[zones[i].ZoneName] = append(zone.hosts[zones[i].ZoneName], hostname)
zone.cachedHosts[zones[i].ZoneName] = append(zone.cachedHosts[zones[i].ZoneName], hostname)
}
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ type SZone struct {
ZoneName string
hosts map[string][]string
cachedHosts map[string][]string
Hosts map[string]map[string]HostState
}