Automatic merge from release/2.1.0 -> release/2.2.0

* commit 'b59926c46cc37ba664e059f9d08235d2cc594aa8':
  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
@@ -1018,6 +1018,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)
}
@@ -1087,6 +1093,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)
}
@@ -1324,6 +1337,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)
}