Skip to content

Commit

Permalink
Update Podman patches
Browse files Browse the repository at this point in the history
  • Loading branch information
arixmkii committed Jul 9, 2024
1 parent da0c0c1 commit 357eec4
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 87 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,95 @@
From ea1b1a9872af003a377587bc4f9db4495016a957 Mon Sep 17 00:00:00 2001
From eb952241f1f6d6eae76d4cfb04f94e078456cb04 Mon Sep 17 00:00:00 2001
From: Arthur Sengileyev <[email protected]>
Date: Fri, 19 Apr 2024 16:38:38 +0300
Subject: [PATCH 1/3] Enable compilation for Windows on parts of QEMU machine
provider

Signed-off-by: Arthur Sengileyev <[email protected]>
---
pkg/machine/qemu/machine.go | 2 +-
pkg/machine/qemu/options_windows_amd64.go | 2 +-
pkg/machine/qemu/stubber.go | 2 +-
pkg/machine/qemu/virtiofsd.go | 2 +-
pkg/machine/vmconfigs/config_windows.go | 10 +++++++++-
5 files changed, 13 insertions(+), 5 deletions(-)
pkg/machine/qemu/command/command.go | 9 ---------
pkg/machine/qemu/command/command_unix.go | 18 ++++++++++++++++++
pkg/machine/qemu/command/command_windows.go | 15 +++++++++++++++
pkg/machine/qemu/machine.go | 2 +-
pkg/machine/qemu/options_windows_amd64.go | 2 +-
pkg/machine/qemu/stubber.go | 2 +-
pkg/machine/qemu/virtiofsd.go | 2 +-
pkg/machine/vmconfigs/config_windows.go | 10 +++++++++-
8 files changed, 46 insertions(+), 14 deletions(-)
create mode 100644 pkg/machine/qemu/command/command_unix.go
create mode 100644 pkg/machine/qemu/command/command_windows.go

diff --git a/pkg/machine/qemu/command/command.go b/pkg/machine/qemu/command/command.go
index 11994f85f..de94ab396 100644
--- a/pkg/machine/qemu/command/command.go
+++ b/pkg/machine/qemu/command/command.go
@@ -10,7 +10,6 @@ import (
"strconv"
"time"

- "github.com/containers/common/pkg/strongunits"
"github.com/containers/podman/v5/pkg/machine/define"
"github.com/containers/storage/pkg/fileutils"
)
@@ -33,14 +32,6 @@ func NewQemuBuilder(binary string, options []string) QemuCmd {
return append(q, options...)
}

-// SetMemory adds the specified amount of memory for the machine
-func (q *QemuCmd) SetMemory(m strongunits.MiB) {
- serializedMem := strconv.FormatUint(uint64(m), 10)
- // In order to use virtiofsd, we must enable shared memory
- *q = append(*q, "-object", fmt.Sprintf("memory-backend-memfd,id=mem,size=%sM,share=on", serializedMem))
- *q = append(*q, "-m", serializedMem)
-}
-
// SetCPUs adds the number of CPUs the machine will have
func (q *QemuCmd) SetCPUs(c uint64) {
*q = append(*q, "-smp", strconv.FormatUint(c, 10))
diff --git a/pkg/machine/qemu/command/command_unix.go b/pkg/machine/qemu/command/command_unix.go
new file mode 100644
index 000000000..a9ecd4a7d
--- /dev/null
+++ b/pkg/machine/qemu/command/command_unix.go
@@ -0,0 +1,18 @@
+//go:build dragonfly || freebsd || linux || netbsd || openbsd
+
+package command
+
+import (
+ "fmt"
+ "strconv"
+
+ "github.com/containers/common/pkg/strongunits"
+)
+
+// SetMemory adds the specified amount of memory for the machine
+func (q *QemuCmd) SetMemory(m strongunits.MiB) {
+ serializedMem := strconv.FormatUint(uint64(m), 10)
+ // In order to use virtiofsd, we must enable shared memory
+ *q = append(*q, "-object", fmt.Sprintf("memory-backend-memfd,id=mem,size=%sM,share=on", serializedMem))
+ *q = append(*q, "-m", serializedMem)
+}
diff --git a/pkg/machine/qemu/command/command_windows.go b/pkg/machine/qemu/command/command_windows.go
new file mode 100644
index 000000000..61a5ffa4a
--- /dev/null
+++ b/pkg/machine/qemu/command/command_windows.go
@@ -0,0 +1,15 @@
+//go:build windows
+
+package command
+
+import (
+ "strconv"
+
+ "github.com/containers/common/pkg/strongunits"
+)
+
+// SetMemory adds the specified amount of memory for the machine
+func (q *QemuCmd) SetMemory(m strongunits.MiB) {
+ serializedMem := strconv.FormatUint(uint64(m), 10)
+ *q = append(*q, "-m", serializedMem)
+}
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 64fb04a73..1a33ba3b0 100644
--- a/pkg/machine/qemu/machine.go
Expand Down
81 changes: 2 additions & 79 deletions patches/podman/0002-Implement-QEMU-Podman-machine-on-Windows.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From d371bf5ca210a86cd79dc90f1d482818605a6c0a Mon Sep 17 00:00:00 2001
From 206ad6d5890a7ccd9fc4e47b188f4539d7548b81 Mon Sep 17 00:00:00 2001
From: Arthur Sengileyev <[email protected]>
Date: Tue, 20 Feb 2024 21:52:34 +0200
Subject: [PATCH 2/3] Implement QEMU Podman machine on Windows
Expand All @@ -11,14 +11,9 @@ Signed-off-by: Arthur Sengileyev <[email protected]>
pkg/machine/provider/platform_windows.go | 2 ++
pkg/machine/provider/platform_windows_amd64.go | 10 ++++++++++
pkg/machine/provider/platform_windows_arm64.go | 12 ++++++++++++
pkg/machine/qemu/command/command.go | 9 ---------
pkg/machine/qemu/command/command_unix.go | 18 ++++++++++++++++++
pkg/machine/qemu/command/command_windows.go | 15 +++++++++++++++
9 files changed, 81 insertions(+), 9 deletions(-)
6 files changed, 48 insertions(+)
create mode 100644 pkg/machine/provider/platform_windows_amd64.go
create mode 100644 pkg/machine/provider/platform_windows_arm64.go
create mode 100644 pkg/machine/qemu/command/command_unix.go
create mode 100644 pkg/machine/qemu/command/command_windows.go

diff --git a/pkg/machine/e2e/README.md b/pkg/machine/e2e/README.md
index 48e12612f..36728a861 100644
Expand Down Expand Up @@ -145,78 +140,6 @@ index 000000000..ded7ad7b1
+func getQemuProvider() (vmconfigs.VMProvider, error) {
+ return nil, fmt.Errorf("unsupported virtualization provider: `%s`", define.QemuVirt.String())
+}
diff --git a/pkg/machine/qemu/command/command.go b/pkg/machine/qemu/command/command.go
index 11994f85f..de94ab396 100644
--- a/pkg/machine/qemu/command/command.go
+++ b/pkg/machine/qemu/command/command.go
@@ -10,7 +10,6 @@ import (
"strconv"
"time"

- "github.com/containers/common/pkg/strongunits"
"github.com/containers/podman/v5/pkg/machine/define"
"github.com/containers/storage/pkg/fileutils"
)
@@ -33,14 +32,6 @@ func NewQemuBuilder(binary string, options []string) QemuCmd {
return append(q, options...)
}

-// SetMemory adds the specified amount of memory for the machine
-func (q *QemuCmd) SetMemory(m strongunits.MiB) {
- serializedMem := strconv.FormatUint(uint64(m), 10)
- // In order to use virtiofsd, we must enable shared memory
- *q = append(*q, "-object", fmt.Sprintf("memory-backend-memfd,id=mem,size=%sM,share=on", serializedMem))
- *q = append(*q, "-m", serializedMem)
-}
-
// SetCPUs adds the number of CPUs the machine will have
func (q *QemuCmd) SetCPUs(c uint64) {
*q = append(*q, "-smp", strconv.FormatUint(c, 10))
diff --git a/pkg/machine/qemu/command/command_unix.go b/pkg/machine/qemu/command/command_unix.go
new file mode 100644
index 000000000..a9ecd4a7d
--- /dev/null
+++ b/pkg/machine/qemu/command/command_unix.go
@@ -0,0 +1,18 @@
+//go:build dragonfly || freebsd || linux || netbsd || openbsd
+
+package command
+
+import (
+ "fmt"
+ "strconv"
+
+ "github.com/containers/common/pkg/strongunits"
+)
+
+// SetMemory adds the specified amount of memory for the machine
+func (q *QemuCmd) SetMemory(m strongunits.MiB) {
+ serializedMem := strconv.FormatUint(uint64(m), 10)
+ // In order to use virtiofsd, we must enable shared memory
+ *q = append(*q, "-object", fmt.Sprintf("memory-backend-memfd,id=mem,size=%sM,share=on", serializedMem))
+ *q = append(*q, "-m", serializedMem)
+}
diff --git a/pkg/machine/qemu/command/command_windows.go b/pkg/machine/qemu/command/command_windows.go
new file mode 100644
index 000000000..61a5ffa4a
--- /dev/null
+++ b/pkg/machine/qemu/command/command_windows.go
@@ -0,0 +1,15 @@
+//go:build windows
+
+package command
+
+import (
+ "strconv"
+
+ "github.com/containers/common/pkg/strongunits"
+)
+
+// SetMemory adds the specified amount of memory for the machine
+func (q *QemuCmd) SetMemory(m strongunits.MiB) {
+ serializedMem := strconv.FormatUint(uint64(m), 10)
+ *q = append(*q, "-m", serializedMem)
+}
--
2.45.2

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 4fdc9c5846188d3b7edd64c93571fa5e0e64aabf Mon Sep 17 00:00:00 2001
From 1239530cd6e96fe0904f2cc4f67643afd3aadd2a Mon Sep 17 00:00:00 2001
From: Arthur Sengileyev <[email protected]>
Date: Mon, 8 Jul 2024 18:52:50 +0300
Subject: [PATCH 3/3] Implement disable default mounts via command line
Expand Down

0 comments on commit 357eec4

Please sign in to comment.