mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-10 01:44:21 +01:00
vendor: Update vendor/github.com/kata-containers/govmm
Update vendor/github.com/kata-containers/govmm for ExecuteBlockdevAddWithDriverCache. Fixes: #2548 Signed-off-by: Hui Zhu <teawater@antfin.com>
This commit is contained in:
19
src/runtime/vendor/github.com/kata-containers/govmm/qemu/qemu.go
generated
vendored
19
src/runtime/vendor/github.com/kata-containers/govmm/qemu/qemu.go
generated
vendored
@@ -1435,6 +1435,9 @@ func (vhostuserDev VhostUserDevice) QemuFSParams(config *Config) []string {
|
||||
deviceParams = append(deviceParams, "versiontable=/dev/shm/fuse_shared_versions")
|
||||
}
|
||||
if vhostuserDev.Transport.isVirtioCCW(config) {
|
||||
if config.Knobs.IOMMUPlatform {
|
||||
deviceParams = append(deviceParams, "iommu_platform=on")
|
||||
}
|
||||
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", vhostuserDev.DevNo))
|
||||
}
|
||||
if vhostuserDev.Transport.isVirtioPCI(config) && vhostuserDev.ROMFile != "" {
|
||||
@@ -2439,6 +2442,13 @@ type Config struct {
|
||||
// Ctx is the context used when launching qemu.
|
||||
Ctx context.Context
|
||||
|
||||
// User ID.
|
||||
Uid uint32
|
||||
// Group ID.
|
||||
Gid uint32
|
||||
// Supplementary group IDs.
|
||||
Groups []uint32
|
||||
|
||||
// Name is the qemu guest name
|
||||
Name string
|
||||
|
||||
@@ -2898,8 +2908,15 @@ func LaunchQemu(config Config, logger QMPLog) (string, error) {
|
||||
ctx = context.Background()
|
||||
}
|
||||
|
||||
attr := syscall.SysProcAttr{}
|
||||
attr.Credential = &syscall.Credential{
|
||||
Uid: config.Uid,
|
||||
Gid: config.Gid,
|
||||
Groups: config.Groups,
|
||||
}
|
||||
|
||||
return LaunchCustomQemu(ctx, config.Path, config.qemuParams,
|
||||
config.fds, nil, logger)
|
||||
config.fds, &attr, logger)
|
||||
}
|
||||
|
||||
// LaunchCustomQemu can be used to launch a new qemu instance.
|
||||
|
||||
22
src/runtime/vendor/github.com/kata-containers/govmm/qemu/qmp.go
generated
vendored
22
src/runtime/vendor/github.com/kata-containers/govmm/qemu/qmp.go
generated
vendored
@@ -772,14 +772,14 @@ func (q *QMP) ExecuteQuit(ctx context.Context) error {
|
||||
return q.executeCommand(ctx, "quit", nil, nil)
|
||||
}
|
||||
|
||||
func (q *QMP) blockdevAddBaseArgs(device, blockdevID string, ro bool) (map[string]interface{}, map[string]interface{}) {
|
||||
func (q *QMP) blockdevAddBaseArgs(driver, device, blockdevID string, ro bool) (map[string]interface{}, map[string]interface{}) {
|
||||
var args map[string]interface{}
|
||||
|
||||
blockdevArgs := map[string]interface{}{
|
||||
"driver": "raw",
|
||||
"read-only": ro,
|
||||
"file": map[string]interface{}{
|
||||
"driver": "host_device",
|
||||
"driver": driver,
|
||||
"filename": device,
|
||||
},
|
||||
}
|
||||
@@ -795,7 +795,7 @@ func (q *QMP) blockdevAddBaseArgs(device, blockdevID string, ro bool) (map[strin
|
||||
// used to name the device. As this identifier will be passed directly to QMP,
|
||||
// it must obey QMP's naming rules, e,g., it must start with a letter.
|
||||
func (q *QMP) ExecuteBlockdevAdd(ctx context.Context, device, blockdevID string, ro bool) error {
|
||||
args, _ := q.blockdevAddBaseArgs(device, blockdevID, ro)
|
||||
args, _ := q.blockdevAddBaseArgs("host_device", device, blockdevID, ro)
|
||||
|
||||
return q.executeCommand(ctx, "blockdev-add", args, nil)
|
||||
}
|
||||
@@ -808,7 +808,21 @@ func (q *QMP) ExecuteBlockdevAdd(ctx context.Context, device, blockdevID string,
|
||||
// is enabled. noFlush denotes whether flush requests for the device are
|
||||
// ignored.
|
||||
func (q *QMP) ExecuteBlockdevAddWithCache(ctx context.Context, device, blockdevID string, direct, noFlush, ro bool) error {
|
||||
args, blockdevArgs := q.blockdevAddBaseArgs(device, blockdevID, ro)
|
||||
args, blockdevArgs := q.blockdevAddBaseArgs("host_device", device, blockdevID, ro)
|
||||
|
||||
blockdevArgs["cache"] = map[string]interface{}{
|
||||
"direct": direct,
|
||||
"no-flush": noFlush,
|
||||
}
|
||||
|
||||
return q.executeCommand(ctx, "blockdev-add", args, nil)
|
||||
}
|
||||
|
||||
// ExecuteBlockdevAddWithDriverCache has three one parameter driver
|
||||
// than ExecuteBlockdevAddWithCache.
|
||||
// Parameter driver can set the driver of block device.
|
||||
func (q *QMP) ExecuteBlockdevAddWithDriverCache(ctx context.Context, driver, device, blockdevID string, direct, noFlush, ro bool) error {
|
||||
args, blockdevArgs := q.blockdevAddBaseArgs(driver, device, blockdevID, ro)
|
||||
|
||||
blockdevArgs["cache"] = map[string]interface{}{
|
||||
"direct": direct,
|
||||
|
||||
Reference in New Issue
Block a user