mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix: host 内存规格信息直接为 MB (#281)
This commit is contained in:
@@ -71,7 +71,7 @@ func init() {
|
||||
options.BaseListOptions
|
||||
HostType string `help:"Host type filter" choices:"baremetal|hypervisor|esxi|kubelet|hyperv"`
|
||||
Ncpu int64 `help:"#CPU count of host" metavar:"<CPU_COUNT>"`
|
||||
MemSize string `help:"Memory GB size"`
|
||||
MemSize int64 `help:"Memory MB size"`
|
||||
DiskSpec []string `help:"Disk spec string, like 'Linux_adapter0_HDD_111Gx4'"`
|
||||
Nic int64 `help:"#Nics count of host" metavar:"<NIC_COUNT>"`
|
||||
GpuModel []string `help:"GPU model, like 'GeForce GTX 1050 Ti'"`
|
||||
@@ -83,8 +83,8 @@ func init() {
|
||||
if args.Ncpu > 0 {
|
||||
keys = append(keys, fmt.Sprintf("cpu:%d", args.Ncpu))
|
||||
}
|
||||
if len(args.MemSize) != 0 {
|
||||
keys = append(keys, fmt.Sprintf("mem:%s", args.MemSize))
|
||||
if args.MemSize > 0 {
|
||||
keys = append(keys, fmt.Sprintf("mem:%dM", args.MemSize))
|
||||
}
|
||||
if args.Nic > 0 {
|
||||
keys = append(keys, fmt.Sprintf("nic:%d", args.Nic))
|
||||
|
||||
@@ -921,15 +921,7 @@ func (manager *SHostManager) GetSpecIdent(spec *jsonutils.JSONDict) []string {
|
||||
nCpu, _ := spec.Int("cpu")
|
||||
memSize, _ := spec.Int("mem")
|
||||
var memSizeStr string
|
||||
if memSize < 1024 {
|
||||
memSizeStr = fmt.Sprintf("mem:%dM", memSize)
|
||||
} else {
|
||||
memGB, err := utils.GetSizeGB(fmt.Sprintf("%d", memSize), "M")
|
||||
if err != nil {
|
||||
log.Errorf("Get mem size %d GB error: %v", memSize, err)
|
||||
}
|
||||
memSizeStr = fmt.Sprintf("mem:%dG", memGB)
|
||||
}
|
||||
memSizeStr = fmt.Sprintf("mem:%dM", memSize)
|
||||
nicCount, _ := spec.Int("nic_count")
|
||||
manufacture, _ := spec.GetString("manufacture")
|
||||
model, _ := spec.GetString("model")
|
||||
|
||||
Reference in New Issue
Block a user