Skip to content
Permalink
Browse files

Humanize total host memory

  • Loading branch information
subuk committed Nov 25, 2019
1 parent f363f26 commit ef8e3ca358f93d4e5ce9a7516b6f021c33431aba
Showing with 4 additions and 4 deletions.
  1. +1 −1 compute/hostinfo.go
  2. +2 −2 libvirt/hostinfo_repository.go
  3. +1 −1 templates/hostinfo.html
@@ -10,7 +10,7 @@ type HostInfoNumaCore struct {
}

type HostInfoNuma struct {
Memory uint64 // KiB
Memory uint64 // Bytes
Pages4k uint64
Pages2m uint64
Pages1g uint64
@@ -4,7 +4,7 @@ import (
"subuk/vmango/compute"
"subuk/vmango/util"

"github.com/libvirt/libvirt-go-xml"
libvirtxml "github.com/libvirt/libvirt-go-xml"
)

type HostInfoRepository struct {
@@ -60,7 +60,7 @@ func (repo *HostInfoRepository) Get() (*compute.HostInfo, error) {
numa = compute.HostInfoNuma{Cores: map[int]compute.HostInfoNumaCore{}}
}
if numaInfo.Memory != nil {
numa.Memory = numaInfo.Memory.Size
numa.Memory = ParseLibvirtSizeToBytes(numaInfo.Memory.Unit, numaInfo.Memory.Size)
}
for _, pageInfo := range numaInfo.PageInfo {
switch pageInfo.Size {
@@ -35,7 +35,7 @@ <h6>CPU Info</h6>
<tr>
<td>{{ $numaId }}</td>
<td>{{ len $numa.Cores }}</td>
<td>{{ $numa.Memory }}</td>
<td>{{ $numa.Memory | HumanizeBytes }}</td>
<td>{{ $numa.Pages4k }}</td>
<td>{{ $numa.Pages2m }}</td>
<td>{{ $numa.Pages1g }}</td>

2 comments on commit ef8e3ca

@lord-kyron

This comment has been minimized.

Copy link

lord-kyron replied Nov 25, 2019

Is this availavle now in the repository, or only in the source code? I am installing it from the ubuntu repo so wanted to know.

@subuk

This comment has been minimized.

Copy link
Owner Author

subuk replied Nov 25, 2019

There is vmango-devel PPA repository which always contains packages from the latest master. You can enable it and get this change. There is some lag between commit and package publishing because launchpad is not the fastest thing in the world.

For this commit you need to wait for this build to be completed https://code.launchpad.net/~subuk/+archive/ubuntu/vmango-devel/+recipebuild/2449040

Also if you have docker installed on your machine, you can build package locally and install it with dpkg -i xxx.deb, its quite easy I hope https://github.com/subuk/vmango#build-deb

Please sign in to comment.
You can’t perform that action at this time.