mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 06:09:39 +08:00
fix(region): vpc topology scope with system
This commit is contained in:
@@ -139,6 +139,7 @@ type HostnetworkTopologyOutput struct {
|
||||
|
||||
type HostTopologyOutput struct {
|
||||
Name string `json:"name"`
|
||||
Id string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
HostStatus string `json:"host_status"`
|
||||
HostType string `json:"host_type"`
|
||||
|
||||
@@ -1754,6 +1754,7 @@ func (self *SVpc) GetDetailsTopology(ctx context.Context, userCred mcclient.Toke
|
||||
hns := hosts[i].GetBaremetalnetworks()
|
||||
host := api.HostTopologyOutput{
|
||||
Name: hosts[i].Name,
|
||||
Id: hosts[i].Id,
|
||||
Status: hosts[i].Status,
|
||||
HostStatus: hosts[i].HostStatus,
|
||||
HostType: hosts[i].HostType,
|
||||
@@ -1785,7 +1786,7 @@ func (self *SVpc) GetDetailsTopology(ctx context.Context, userCred mcclient.Toke
|
||||
|
||||
netAddrs := make([]api.SNetworkUsedAddress, 0)
|
||||
|
||||
q := networks[j].getUsedAddressQuery(userCred, rbacutils.ScopeDomain, false)
|
||||
q := networks[j].getUsedAddressQuery(userCred, rbacutils.ScopeSystem, false)
|
||||
err = q.All(&netAddrs)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "q.All")
|
||||
|
||||
@@ -252,9 +252,7 @@ func (wire *SWire) GetHostwires() ([]SHostwire, error) {
|
||||
}
|
||||
|
||||
func (self *SWire) GetHosts() ([]SHost, error) {
|
||||
networks := NetworkManager.Query().Equals("wire_id", self.Id).SubQuery()
|
||||
hns := HostnetworkManager.Query("baremetal_id")
|
||||
sq := hns.Join(networks, sqlchemy.Equals(hns.Field("network_id"), networks.Field("id"))).SubQuery()
|
||||
sq := HostwireManager.Query("host_id").Equals("wire_id", self.Id)
|
||||
q := HostManager.Query().In("id", sq)
|
||||
hosts := []SHost{}
|
||||
err := db.FetchModelObjects(HostManager, q, &hosts)
|
||||
|
||||
Reference in New Issue
Block a user