New Upstream Release - golang-github-kata-containers-govmm

Ready changes

Summary

Merged new upstream version: 0.0~git20220119.88960a1 (was: 0.0~git20211108.e438cc5).

Resulting package

Built on 2022-05-15T10:40 (took 2m48s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-releases golang-github-kata-containers-govmm-dev

Lintian Result

Diff

diff --git a/README.md b/README.md
index d96c4d9..7fcface 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,9 @@
 # Virtual Machine Manager for Go
 
-[![Go Report Card](https://goreportcard.com/badge/github.com/kata-containers/govmm)](https://goreportcard.com/report/github.com/kata-containers/govmm)
-[![Build Status](https://travis-ci.org/kata-containers/govmm.svg?branch=master)](https://travis-ci.org/kata-containers/govmm)
-[![GoDoc](https://godoc.org/github.com/kata-containers/govmm/qemu?status.svg)](https://godoc.org/github.com/kata-containers/govmm/qemu)
-[![Coverage Status](https://coveralls.io/repos/github/kata-containers/govmm/badge.svg?branch=master)](https://coveralls.io/github/kata-containers/govmm?branch=master)
+This project has been archived, as it's now [part of Kata
+Containers](https://github.com/kata-containers/kata-containers/tree/main/src/runtime/pkg/govmm).
 
-Virtual Machine Manager for Go (govmm) is a suite of packages that
-provide Go APIs for creating and managing virtual machines.  There's
-currently support for only one hypervisor, qemu/kvm (version 5.0 and
-later), support for which is provided by the
-github.com/kata-containers/govmm/qemu package.
-
-The qemu package provides APIs for launching qemu instances and for
-managing those instances via QMP, once launched.  VM instances can
-be stopped, have devices attached to them and monitored for events
-via the qemu APIs.
-
-The qemu package has no external dependencies apart from the Go
-standard library and so is nice and easy to vendor inside other
-projects.
+For issues, or pull-request, please, submit them directly to [Kata
+Containers](https://github.com/kata-containers/kata-containers), following [the
+Kata Containers' project
+guidelines](https://github.com/kata-containers/community/blob/main/CONTRIBUTING.md)
diff --git a/debian/changelog b/debian/changelog
index d06c027..2833e2e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+golang-github-kata-containers-govmm (0.0~git20220119.88960a1-1) UNRELEASED; urgency=low
+
+  * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Sun, 15 May 2022 10:38:22 -0000
+
 golang-github-kata-containers-govmm (0.0~git20211108.e438cc5-1) unstable; urgency=medium
 
   * New upstream snapshot.
diff --git a/qemu/qemu.go b/qemu/qemu.go
index 831998c..c43ff57 100644
--- a/qemu/qemu.go
+++ b/qemu/qemu.go
@@ -234,6 +234,9 @@ const (
 	// MemoryBackendFile represents a guest memory mapped file.
 	MemoryBackendFile ObjectType = "memory-backend-file"
 
+	// MemoryBackendEPC represents a guest memory backend EPC for SGX.
+	MemoryBackendEPC ObjectType = "memory-backend-epc"
+
 	// TDXGuest represents a TDX object
 	TDXGuest ObjectType = "tdx-guest"
 
@@ -283,6 +286,9 @@ type Object struct {
 
 	// ReadOnly specifies whether `MemPath` is opened read-only or read/write (default)
 	ReadOnly bool
+
+	// Prealloc enables memory preallocation
+	Prealloc bool
 }
 
 // Valid returns true if the Object structure is valid and complete.
@@ -290,6 +296,8 @@ func (object Object) Valid() bool {
 	switch object.Type {
 	case MemoryBackendFile:
 		return object.ID != "" && object.MemPath != "" && object.Size != 0
+	case MemoryBackendEPC:
+		return object.ID != "" && object.Size != 0
 	case TDXGuest:
 		return object.ID != "" && object.File != "" && object.DeviceID != ""
 	case SEVGuest:
@@ -326,6 +334,14 @@ func (object Object) QemuParams(config *Config) []string {
 			objectParams = append(objectParams, "readonly=on")
 			deviceParams = append(deviceParams, "unarmed=on")
 		}
+	case MemoryBackendEPC:
+		objectParams = append(objectParams, string(object.Type))
+		objectParams = append(objectParams, fmt.Sprintf("id=%s", object.ID))
+		objectParams = append(objectParams, fmt.Sprintf("size=%d", object.Size))
+		if object.Prealloc {
+			objectParams = append(objectParams, "prealloc=on")
+		}
+
 	case TDXGuest:
 		objectParams = append(objectParams, string(object.Type))
 		objectParams = append(objectParams, fmt.Sprintf("id=%s", object.ID))
@@ -1219,7 +1235,7 @@ func (blkdev BlockDevice) QemuParams(config *Config) []string {
 	blkParams = append(blkParams, fmt.Sprintf("if=%s", blkdev.Interface))
 
 	if blkdev.ReadOnly {
-		blkParams = append(blkParams, "readonly")
+		blkParams = append(blkParams, "readonly=on")
 	}
 
 	qemuParams = append(qemuParams, "-device")
diff --git a/qemu/qemu_arch_base_test.go b/qemu/qemu_arch_base_test.go
index 27219f4..6676097 100644
--- a/qemu/qemu_arch_base_test.go
+++ b/qemu/qemu_arch_base_test.go
@@ -37,7 +37,7 @@ var (
 	deviceSCSIControllerBusAddrStr = "-device virtio-scsi-pci,id=foo,bus=pci.0,addr=00:04.0,disable-modern=true,iothread=iothread1,romfile=efi-virtio.rom"
 	deviceVhostUserSCSIString      = "-chardev socket,id=char1,path=/tmp/nonexistentsocket.socket -device vhost-user-scsi-pci,id=scsi1,chardev=char1,romfile=efi-virtio.rom"
 	deviceVhostUserBlkString       = "-chardev socket,id=char2,path=/tmp/nonexistentsocket.socket -device vhost-user-blk-pci,logical_block_size=4096,size=512M,chardev=char2,romfile=efi-virtio.rom"
-	deviceBlockString              = "-device virtio-blk-pci,disable-modern=true,drive=hd0,scsi=off,config-wce=off,romfile=efi-virtio.rom,share-rw=on,serial=hd0 -drive id=hd0,file=/var/lib/vm.img,aio=threads,format=qcow2,if=none,readonly"
+	deviceBlockString              = "-device virtio-blk-pci,disable-modern=true,drive=hd0,scsi=off,config-wce=off,romfile=efi-virtio.rom,share-rw=on,serial=hd0 -drive id=hd0,file=/var/lib/vm.img,aio=threads,format=qcow2,if=none,readonly=on"
 	devicePCIBridgeString          = "-device pci-bridge,bus=/pci-bus/pcie.0,id=mybridge,chassis_nr=5,shpc=on,addr=ff,romfile=efi-virtio.rom"
 	devicePCIBridgeStringReserved  = "-device pci-bridge,bus=/pci-bus/pcie.0,id=mybridge,chassis_nr=5,shpc=off,addr=ff,romfile=efi-virtio.rom,io-reserve=4k,mem-reserve=1m,pref64-reserve=1m"
 	devicePCIEBridgeString         = "-device pcie-pci-bridge,bus=/pci-bus/pcie.0,id=mybridge,addr=ff,romfile=efi-virtio.rom"
diff --git a/qemu/qemu_test.go b/qemu/qemu_test.go
index e423661..2e37b0e 100644
--- a/qemu/qemu_test.go
+++ b/qemu/qemu_test.go
@@ -144,6 +144,19 @@ func TestAppendDeviceNVDIMM(t *testing.T) {
 	testAppend(object, deviceNVDIMMString, t)
 }
 
+var objectEPCString = "-object memory-backend-epc,id=epc0,size=65536,prealloc=on"
+
+func TestAppendEPCObject(t *testing.T) {
+	object := Object{
+		Type:     MemoryBackendEPC,
+		ID:       "epc0",
+		Size:     1 << 16,
+		Prealloc: true,
+	}
+
+	testAppend(object, objectEPCString, t)
+}
+
 func TestAppendDeviceFS(t *testing.T) {
 	fsdev := FSDevice{
 		Driver:        Virtio9P,
diff --git a/qemu/qmp.go b/qemu/qmp.go
index a7afc6d..2e30c2b 100644
--- a/qemu/qmp.go
+++ b/qemu/qmp.go
@@ -1518,20 +1518,26 @@ func (q *QMP) ExecuteGetFD(ctx context.Context, fdname string, fd *os.File) erro
 // id is an identifier for the device, path specifies the local path of the unix socket,
 // wait is to block waiting for a client to connect, server specifies that the socket is a listening socket.
 func (q *QMP) ExecuteCharDevUnixSocketAdd(ctx context.Context, id, path string, wait, server bool) error {
+	data := map[string]interface{}{
+		"server": server,
+		"addr": map[string]interface{}{
+			"type": "unix",
+			"data": map[string]interface{}{
+				"path": path,
+			},
+		},
+	}
+
+	// wait is only valid for server mode
+	if server {
+		data["wait"] = wait
+	}
+
 	args := map[string]interface{}{
 		"id": id,
 		"backend": map[string]interface{}{
 			"type": "socket",
-			"data": map[string]interface{}{
-				"wait":   wait,
-				"server": server,
-				"addr": map[string]interface{}{
-					"type": "unix",
-					"data": map[string]interface{}{
-						"path": path,
-					},
-				},
-			},
+			"data": data,
 		},
 	}
 	return q.executeCommand(ctx, "chardev-add", args, nil)

Debdiff

File lists identical (after any substitutions)

No differences were encountered in the control files

More details

Full run details