Automatic merge from release/2.2.0 -> release/2.3.0

* commit '1ec41ffcc90e71b5561ffaefaab12ac049446296':
  fix: server list and details no is_gpu field
This commit is contained in:
李泽玺
2018-10-22 19:59:48 +08:00
+17
View File
@@ -1034,6 +1034,12 @@ func (self *SGuest) GetCustomizeColumns(ctx context.Context, userCred mcclient.T
extra.Add(jsonutils.NewString(timeutils.FullIsoTime(pendingDeletedAt)), "auto_delete_at")
}
isGpu := jsonutils.JSONFalse
if self.isGpu() {
isGpu = jsonutils.JSONTrue
}
extra.Add(isGpu, "is_gpu")
return self.moreExtraInfo(extra)
}
@@ -1103,6 +1109,13 @@ func (self *SGuest) GetExtraDetails(ctx context.Context, userCred mcclient.Token
extra.Add(jsonutils.NewString(eip.IpAddr), "eip")
extra.Add(jsonutils.NewString(eip.Mode), "eip_mode")
}
isGpu := jsonutils.JSONFalse
if self.isGpu() {
isGpu = jsonutils.JSONTrue
}
extra.Add(isGpu, "is_gpu")
return self.moreExtraInfo(extra)
}
@@ -1340,6 +1353,10 @@ func (self *SGuest) getAdminSecurityRules() string {
}
}
func (self *SGuest) isGpu() bool {
return len(self.GetIsolatedDevices()) != 0
}
func (self *SGuest) GetIsolatedDevices() []SIsolatedDevice {
return IsolatedDeviceManager.findAttachedDevicesOfGuest(self)
}