summaryrefslogtreecommitdiff
path: root/pkg/machine/qemu/machine.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-07-27 12:02:25 -0400
committerGitHub <noreply@github.com>2022-07-27 12:02:25 -0400
commit87f892e5b56c2fab2f394f8cc79794ccce03f510 (patch)
tree1ba831a9dddfb6927698bcb9e0c2bee913ad0dcb /pkg/machine/qemu/machine.go
parentc57b5c9b831695f8c54d11b4f288d6037c096fea (diff)
parent983cfb90e68d7b292b0f6ee8800c3f23383493cc (diff)
downloadpodman-87f892e5b56c2fab2f394f8cc79794ccce03f510.tar.gz
podman-87f892e5b56c2fab2f394f8cc79794ccce03f510.tar.bz2
podman-87f892e5b56c2fab2f394f8cc79794ccce03f510.zip
Merge pull request #15076 from mheon/bump_420_rc2
Bump to v4.2.0-RC2
Diffstat (limited to 'pkg/machine/qemu/machine.go')
-rw-r--r--pkg/machine/qemu/machine.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 6134e69e1..7974c261e 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -240,20 +240,6 @@ func (p *Provider) LoadVMByName(name string) (machine.VM, error) {
return nil, err
}
- // It is here for providing the ability to propagate
- // proxy settings (e.g. HTTP_PROXY and others) on a start
- // and avoid a need of re-creating/re-initiating a VM
- if proxyOpts := machine.GetProxyVariables(); len(proxyOpts) > 0 {
- proxyStr := "name=opt/com.coreos/environment,string="
- var proxies string
- for k, v := range proxyOpts {
- proxies = fmt.Sprintf("%s%s=\"%s\"|", proxies, k, v)
- }
- proxyStr = fmt.Sprintf("%s%s", proxyStr, base64.StdEncoding.EncodeToString([]byte(proxies)))
- vm.CmdLine = append(vm.CmdLine, "-fw_cfg", proxyStr)
- }
-
- logrus.Debug(vm.CmdLine)
return vm, nil
}
@@ -573,15 +559,29 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
attr := new(os.ProcAttr)
files := []*os.File{dnr, dnw, dnw, fd}
attr.Files = files
- logrus.Debug(v.CmdLine)
cmdLine := v.CmdLine
+ // It is here for providing the ability to propagate
+ // proxy settings (e.g. HTTP_PROXY and others) on a start
+ // and avoid a need of re-creating/re-initiating a VM
+ if proxyOpts := machine.GetProxyVariables(); len(proxyOpts) > 0 {
+ proxyStr := "name=opt/com.coreos/environment,string="
+ var proxies string
+ for k, v := range proxyOpts {
+ proxies = fmt.Sprintf("%s%s=\"%s\"|", proxies, k, v)
+ }
+ proxyStr = fmt.Sprintf("%s%s", proxyStr, base64.StdEncoding.EncodeToString([]byte(proxies)))
+ cmdLine = append(cmdLine, "-fw_cfg", proxyStr)
+ }
+
// Disable graphic window when not in debug mode
// Done in start, so we're not suck with the debug level we used on init
if !logrus.IsLevelEnabled(logrus.DebugLevel) {
cmdLine = append(cmdLine, "-display", "none")
}
+ logrus.Debugf("qemu cmd: %v", cmdLine)
+
stderrBuf := &bytes.Buffer{}
cmd := &exec.Cmd{
@@ -670,11 +670,11 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
// because / is immutable, we have to monkey around with permissions
// if we dont mount in /home or /mnt
args := []string{"-q", "--"}
- if !strings.HasPrefix(mount.Target, "/home") || !strings.HasPrefix(mount.Target, "/mnt") {
+ if !strings.HasPrefix(mount.Target, "/home") && !strings.HasPrefix(mount.Target, "/mnt") {
args = append(args, "sudo", "chattr", "-i", "/", ";")
}
args = append(args, "sudo", "mkdir", "-p", mount.Target)
- if !strings.HasPrefix(mount.Target, "/home") || !strings.HasPrefix(mount.Target, "/mnt") {
+ if !strings.HasPrefix(mount.Target, "/home") && !strings.HasPrefix(mount.Target, "/mnt") {
args = append(args, ";", "sudo", "chattr", "+i", "/", ";")
}
err = v.SSH(name, machine.SSHOptions{Args: args})