summaryrefslogtreecommitdiff
path: root/pkg/machine/qemu/machine.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2021-03-22 13:29:25 -0500
committerbaude <bbaude@redhat.com>2021-03-25 11:02:33 -0500
commit4ab8a6f67eb9de0de40d478cb0cbec05b1b725c0 (patch)
tree00743bf608cc5700fe8a7fca1bb3b0f3a4457b7d /pkg/machine/qemu/machine.go
parente7661137373b5f87bf6ec45e32326821b172ce7b (diff)
downloadpodman-4ab8a6f67eb9de0de40d478cb0cbec05b1b725c0.tar.gz
podman-4ab8a6f67eb9de0de40d478cb0cbec05b1b725c0.tar.bz2
podman-4ab8a6f67eb9de0de40d478cb0cbec05b1b725c0.zip
Improvements for machine
clean up ci failures and add appropriate arch,os exclusion tags Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/machine/qemu/machine.go')
-rw-r--r--pkg/machine/qemu/machine.go20
1 files changed, 14 insertions, 6 deletions
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 30d96ce08..504b64bd5 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -10,8 +10,9 @@ import (
"strconv"
"time"
+ "github.com/containers/podman/v3/utils"
+
"github.com/containers/podman/v3/pkg/machine"
- "github.com/containers/podman/v3/pkg/specgen"
"github.com/containers/storage/pkg/homedir"
"github.com/digitalocean/go-qemu/qmp"
"github.com/pkg/errors"
@@ -56,7 +57,7 @@ func NewMachine(opts machine.CreateOptions) (machine.VM, error) {
}
// Add a random port for ssh
- port, err := specgen.GetRandomPort()
+ port, err := utils.GetRandomPort()
if err != nil {
return nil, err
}
@@ -170,7 +171,7 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
attr := new(os.ProcAttr)
files := []*os.File{os.Stdin, os.Stdout, os.Stderr}
attr.Files = files
- fmt.Print(v.CmdLine)
+ logrus.Debug(v.CmdLine)
_, err = os.StartProcess(v.CmdLine[0], v.CmdLine, attr)
return err
}
@@ -211,22 +212,29 @@ func (v *MachineVM) Stop(name string, _ machine.StopOptions) error {
// NewQMPMonitor creates the monitor subsection of our vm
func NewQMPMonitor(network, name string, timeout time.Duration) (Monitor, error) {
- rtDir, err := getDataDir()
+ rtDir, err := getSocketDir()
if err != nil {
return Monitor{}, err
}
+ rtDir = filepath.Join(rtDir, "podman")
+ if _, err := os.Stat(filepath.Join(rtDir)); os.IsNotExist(err) {
+ // TODO 0644 is fine on linux but macos is weird
+ if err := os.MkdirAll(rtDir, 0755); err != nil {
+ return Monitor{}, err
+ }
+ }
if timeout == 0 {
timeout = defaultQMPTimeout
}
monitor := Monitor{
Network: network,
- Address: filepath.Join(rtDir, "podman", "qmp_"+name+".sock"),
+ Address: filepath.Join(rtDir, "qmp_"+name+".sock"),
Timeout: timeout,
}
return monitor, nil
}
-func (v *MachineVM) Destroy(name string, opts machine.DestroyOptions) (string, func() error, error) {
+func (v *MachineVM) Remove(name string, opts machine.RemoveOptions) (string, func() error, error) {
var (
files []string
)