Merge pull request #5239 from wanyaoqi/automated-cherry-pick-of-#5238-upstream-release-3.1

Automated cherry pick of #5238: fix host init set reserve memory
This commit is contained in:
yunion-ci-robot
2020-02-26 23:13:13 +08:00
committed by GitHub
3 changed files with 12 additions and 3 deletions
+5 -3
View File
@@ -372,9 +372,11 @@ func (self *SGuestnetwork) getJsonDescAtHost(host *SHost) jsonutils.JSONObject {
func (self *SGuestnetwork) getJsonDescHostwire(network *SNetwork, hostwire *SHostwire) *jsonutils.JSONDict {
desc := self.getJsonDesc(network)
desc.Add(jsonutils.NewString(hostwire.Bridge), "bridge")
desc.Add(jsonutils.NewString(hostwire.WireId), "wire_id")
desc.Add(jsonutils.NewString(hostwire.Interface), "interface")
if hostwire != nil {
desc.Add(jsonutils.NewString(hostwire.Bridge), "bridge")
desc.Add(jsonutils.NewString(hostwire.WireId), "wire_id")
desc.Add(jsonutils.NewString(hostwire.Interface), "interface")
}
return desc
}
+3
View File
@@ -856,6 +856,9 @@ func (h *SHostInfo) updateHostRecord(hostId string) {
h.onFail(err)
}
content.Set("mem_size", jsonutils.NewInt(int64(memTotal)))
if len(hostId) == 0 {
content.Set("mem_reserved", jsonutils.NewInt(int64(h.getReservedMem())))
}
content.Set("storage_driver", jsonutils.NewString(api.DISK_DRIVER_LINUX))
content.Set("storage_type", jsonutils.NewString(h.sysinfo.StorageType))
content.Set("storage_size", jsonutils.NewInt(int64(storageman.GetManager().GetTotalCapacity())))
+4
View File
@@ -59,6 +59,10 @@ type SRbdStorage struct {
func NewRBDStorage(manager *SStorageManager, path string) *SRbdStorage {
var ret = new(SRbdStorage)
ret.SBaseStorage = *NewBaseStorage(manager, path)
err := procutils.NewRemoteCommandAsFarAsPossible("mkdir", "-p", "/etc/ceph").Run()
if err != nil {
log.Errorf("Failed to mkdir /etc/ceph: %s", err)
}
return ret
}