mirror of
https://github.com/containers/podman.git
synced 2025-11-01 10:45:52 +08:00
machine: make more use of strongunits
To make it very clear in the code what unit the uint represents. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -10,6 +10,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/containers/common/pkg/strongunits"
|
||||
"github.com/containers/podman/v5/pkg/machine/define"
|
||||
)
|
||||
|
||||
@ -32,8 +33,9 @@ func NewQemuBuilder(binary string, options []string) QemuCmd {
|
||||
}
|
||||
|
||||
// SetMemory adds the specified amount of memory for the machine
|
||||
func (q *QemuCmd) SetMemory(m uint64) {
|
||||
*q = append(*q, "-m", strconv.FormatUint(m, 10))
|
||||
func (q *QemuCmd) SetMemory(m strongunits.MiB) {
|
||||
// qemu accepts the memory in MiB
|
||||
*q = append(*q, "-m", strconv.FormatUint(uint64(m), 10))
|
||||
}
|
||||
|
||||
// SetCPUs adds the number of CPUs the machine will have
|
||||
|
||||
@ -116,7 +116,7 @@ func (q *QEMUStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.MachineCo
|
||||
|
||||
mc.QEMUHypervisor = &qemuConfig
|
||||
mc.QEMUHypervisor.QEMUPidPath = qemuPidPath
|
||||
return q.resizeDisk(strongunits.GiB(mc.Resources.DiskSize), mc.ImagePath)
|
||||
return q.resizeDisk(mc.Resources.DiskSize, mc.ImagePath)
|
||||
}
|
||||
|
||||
func runStartVMCommand(cmd *exec.Cmd) error {
|
||||
|
||||
Reference in New Issue
Block a user