mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-04 02:56:18 +00:00
vendor: vendor latest govmm
Includes --share-rw option for hotplugging disks. govmm Shortlog:2706a07
qemu: Use the supplied context.Context for launchinge46092e
qemu: Do not try and generate invalid RTC parametersfcaf61d
qemu/qmp: add vfio mediated device support4461c45
disk: Add --share-rw option for hotplugging disks6851999
qemu/qmp: add addr and bus to hotplug vsock devices Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
This commit is contained in:
parent
f70d6d2acb
commit
b9e0ca340d
8
Gopkg.lock
generated
8
Gopkg.lock
generated
@ -35,7 +35,7 @@
|
||||
revision = "3d382e2f5dabe3bae62ceb9ded56bdee847008ee"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:3e0383c8e6689f78621ca3592fe1adfc98c23a8bf354704c514d1e7c36d550d7"
|
||||
digest = "1:827ed8a74e55981880c4d77f8472d638bceb899188104ba7bf24a9548fd97292"
|
||||
name = "github.com/containernetworking/cni"
|
||||
packages = ["pkg/types"]
|
||||
pruneopts = "NUT"
|
||||
@ -115,11 +115,11 @@
|
||||
revision = "3520598351bb3500a49ae9563f5539666ae0a27c"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a801632523299b53fbd954449f36020cf751e4bd6fe2d923e3416e8f0603b4af"
|
||||
digest = "1:e35245b8aac4b53c6dd7b161c8c19f038e2ad29a54a03d276a88f3fc2a656c29"
|
||||
name = "github.com/intel/govmm"
|
||||
packages = ["qemu"]
|
||||
pruneopts = "NUT"
|
||||
revision = "eda239928bfa12b214e9c93192d548cccf4e7f1e"
|
||||
revision = "d8f80cafe3ee3bba440a9ff8d234817b64a30b07"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:f2f0d25f32da7843fa4cdc2becb88eea9d1aa9f9c4167431b4c1cd1c3b7fb17c"
|
||||
@ -389,7 +389,6 @@
|
||||
"github.com/clearcontainers/proxy/api",
|
||||
"github.com/clearcontainers/proxy/client",
|
||||
"github.com/containerd/cri-containerd/pkg/annotations",
|
||||
"github.com/containernetworking/cni/pkg/types",
|
||||
"github.com/containernetworking/plugins/pkg/ns",
|
||||
"github.com/dlespiau/covertool/pkg/cover",
|
||||
"github.com/docker/go-units",
|
||||
@ -410,6 +409,7 @@
|
||||
"github.com/sirupsen/logrus",
|
||||
"github.com/sirupsen/logrus/hooks/syslog",
|
||||
"github.com/stretchr/testify/assert",
|
||||
"github.com/uber/jaeger-client-go",
|
||||
"github.com/uber/jaeger-client-go/config",
|
||||
"github.com/urfave/cli",
|
||||
"github.com/vishvananda/netlink",
|
||||
|
@ -52,7 +52,7 @@
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/intel/govmm"
|
||||
revision = "eda239928bfa12b214e9c93192d548cccf4e7f1e"
|
||||
revision = "d8f80cafe3ee3bba440a9ff8d234817b64a30b07"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/kata-containers/agent"
|
||||
|
27
vendor/github.com/intel/govmm/qemu/qemu.go
generated
vendored
27
vendor/github.com/intel/govmm/qemu/qemu.go
generated
vendored
@ -1064,16 +1064,12 @@ type RTC struct {
|
||||
|
||||
// Valid returns true if the RTC structure is valid and complete.
|
||||
func (rtc RTC) Valid() bool {
|
||||
if rtc.Clock != "" {
|
||||
if rtc.Clock != Host && rtc.Clock != VM {
|
||||
return false
|
||||
}
|
||||
if rtc.Clock != Host && rtc.Clock != VM {
|
||||
return false
|
||||
}
|
||||
|
||||
if rtc.DriftFix != "" {
|
||||
if rtc.DriftFix != Slew && rtc.DriftFix != NoDriftFix {
|
||||
return false
|
||||
}
|
||||
if rtc.DriftFix != Slew && rtc.DriftFix != NoDriftFix {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
@ -1239,7 +1235,7 @@ type Config struct {
|
||||
// Path is the qemu binary path.
|
||||
Path string
|
||||
|
||||
// Ctx is not used at the moment.
|
||||
// Ctx is the context used when launching qemu.
|
||||
Ctx context.Context
|
||||
|
||||
// Name is the qemu guest name
|
||||
@ -1636,7 +1632,12 @@ func LaunchQemu(config Config, logger QMPLog) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return LaunchCustomQemu(config.Ctx, config.Path, config.qemuParams,
|
||||
ctx := config.Ctx
|
||||
if ctx == nil {
|
||||
ctx = context.Background()
|
||||
}
|
||||
|
||||
return LaunchCustomQemu(ctx, config.Path, config.qemuParams,
|
||||
config.fds, nil, logger)
|
||||
}
|
||||
|
||||
@ -1644,10 +1645,6 @@ func LaunchQemu(config Config, logger QMPLog) (string, error) {
|
||||
//
|
||||
// The path parameter is used to pass the qemu executable path.
|
||||
//
|
||||
// The ctx parameter is not currently used but has been added so that the
|
||||
// signature of this function will not need to change when launch cancellation
|
||||
// is implemented.
|
||||
//
|
||||
// params is a slice of options to pass to qemu-system-x86_64 and fds is a
|
||||
// list of open file descriptors that are to be passed to the spawned qemu
|
||||
// process. The attrs parameter can be used to control aspects of the
|
||||
@ -1672,7 +1669,7 @@ func LaunchCustomQemu(ctx context.Context, path string, params []string, fds []*
|
||||
}
|
||||
|
||||
/* #nosec */
|
||||
cmd := exec.Command(path, params...)
|
||||
cmd := exec.CommandContext(ctx, path, params...)
|
||||
if len(fds) > 0 {
|
||||
logger.Infof("Adding extra file %v", fds)
|
||||
cmd.ExtraFiles = fds
|
||||
|
48
vendor/github.com/intel/govmm/qemu/qmp.go
generated
vendored
48
vendor/github.com/intel/govmm/qemu/qmp.go
generated
vendored
@ -671,7 +671,8 @@ func (q *QMP) ExecuteBlockdevAdd(ctx context.Context, device, blockdevID string)
|
||||
// to a previous call to ExecuteBlockdevAdd. devID is the id of the device to
|
||||
// add. Both strings must be valid QMP identifiers. driver is the name of the
|
||||
// driver,e.g., virtio-blk-pci, and bus is the name of the bus. bus is optional.
|
||||
func (q *QMP) ExecuteDeviceAdd(ctx context.Context, blockdevID, devID, driver, bus string) error {
|
||||
// shared denotes if the drive can be shared allowing it to be passed more than once.
|
||||
func (q *QMP) ExecuteDeviceAdd(ctx context.Context, blockdevID, devID, driver, bus string, shared bool) error {
|
||||
args := map[string]interface{}{
|
||||
"id": devID,
|
||||
"driver": driver,
|
||||
@ -680,6 +681,9 @@ func (q *QMP) ExecuteDeviceAdd(ctx context.Context, blockdevID, devID, driver, b
|
||||
if bus != "" {
|
||||
args["bus"] = bus
|
||||
}
|
||||
if shared && (q.version.Major > 2 || (q.version.Major == 2 && q.version.Minor >= 10)) {
|
||||
args["share-rw"] = "on"
|
||||
}
|
||||
return q.executeCommand(ctx, "device_add", args, nil)
|
||||
}
|
||||
|
||||
@ -689,8 +693,9 @@ func (q *QMP) ExecuteDeviceAdd(ctx context.Context, blockdevID, devID, driver, b
|
||||
// the device to add. Both strings must be valid QMP identifiers. driver is the name of the
|
||||
// scsi driver,e.g., scsi-hd, and bus is the name of a SCSI controller bus.
|
||||
// scsiID is the SCSI id, lun is logical unit number. scsiID and lun are optional, a negative value
|
||||
// for scsiID and lun is ignored.
|
||||
func (q *QMP) ExecuteSCSIDeviceAdd(ctx context.Context, blockdevID, devID, driver, bus string, scsiID, lun int) error {
|
||||
// for scsiID and lun is ignored. shared denotes if the drive can be shared allowing it
|
||||
// to be passed more than once.
|
||||
func (q *QMP) ExecuteSCSIDeviceAdd(ctx context.Context, blockdevID, devID, driver, bus string, scsiID, lun int, shared bool) error {
|
||||
// TBD: Add drivers for scsi passthrough like scsi-generic and scsi-block
|
||||
drivers := []string{"scsi-hd", "scsi-cd", "scsi-disk"}
|
||||
|
||||
@ -718,6 +723,9 @@ func (q *QMP) ExecuteSCSIDeviceAdd(ctx context.Context, blockdevID, devID, drive
|
||||
if lun >= 0 {
|
||||
args["lun"] = lun
|
||||
}
|
||||
if shared && (q.version.Major > 2 || (q.version.Major == 2 && q.version.Minor >= 10)) {
|
||||
args["share-rw"] = "on"
|
||||
}
|
||||
|
||||
return q.executeCommand(ctx, "device_add", args, nil)
|
||||
}
|
||||
@ -820,8 +828,9 @@ func (q *QMP) ExecuteDeviceDel(ctx context.Context, devID string) error {
|
||||
|
||||
// ExecutePCIDeviceAdd is the PCI version of ExecuteDeviceAdd. This function can be used
|
||||
// to hot plug PCI devices on PCI(E) bridges, unlike ExecuteDeviceAdd this function receive the
|
||||
// device address on its parent bus. bus is optional.
|
||||
func (q *QMP) ExecutePCIDeviceAdd(ctx context.Context, blockdevID, devID, driver, addr, bus string) error {
|
||||
// device address on its parent bus. bus is optional. shared denotes if the drive can be shared
|
||||
// allowing it to be passed more than once.
|
||||
func (q *QMP) ExecutePCIDeviceAdd(ctx context.Context, blockdevID, devID, driver, addr, bus string, shared bool) error {
|
||||
args := map[string]interface{}{
|
||||
"id": devID,
|
||||
"driver": driver,
|
||||
@ -831,6 +840,10 @@ func (q *QMP) ExecutePCIDeviceAdd(ctx context.Context, blockdevID, devID, driver
|
||||
if bus != "" {
|
||||
args["bus"] = bus
|
||||
}
|
||||
if shared && (q.version.Major > 2 || (q.version.Major == 2 && q.version.Minor >= 10)) {
|
||||
args["share-rw"] = "on"
|
||||
}
|
||||
|
||||
return q.executeCommand(ctx, "device_add", args, nil)
|
||||
}
|
||||
|
||||
@ -865,6 +878,24 @@ func (q *QMP) ExecutePCIVFIODeviceAdd(ctx context.Context, devID, bdf, addr, bus
|
||||
return q.executeCommand(ctx, "device_add", args, nil)
|
||||
}
|
||||
|
||||
// ExecutePCIVFIOMediatedDeviceAdd adds a VFIO mediated device to a QEMU instance using the device_add command.
|
||||
// This function can be used to hot plug VFIO mediated devices on PCI(E) bridges, unlike
|
||||
// ExecuteVFIODeviceAdd this function receives the bus and the device address on its parent bus.
|
||||
// bus is optional. devID is the id of the device to add. Must be valid QMP identifier. sysfsdev is the VFIO
|
||||
// mediated device.
|
||||
func (q *QMP) ExecutePCIVFIOMediatedDeviceAdd(ctx context.Context, devID, sysfsdev, addr, bus string) error {
|
||||
args := map[string]interface{}{
|
||||
"id": devID,
|
||||
"driver": "vfio-pci",
|
||||
"sysfsdev": sysfsdev,
|
||||
"addr": addr,
|
||||
}
|
||||
if bus != "" {
|
||||
args["bus"] = bus
|
||||
}
|
||||
return q.executeCommand(ctx, "device_add", args, nil)
|
||||
}
|
||||
|
||||
// ExecuteCPUDeviceAdd adds a CPU to a QEMU instance using the device_add command.
|
||||
// driver is the CPU model, cpuID must be a unique ID to identify the CPU, socketID is the socket number within
|
||||
// node/board the CPU belongs to, coreID is the core number within socket the CPU belongs to, threadID is the
|
||||
@ -956,12 +987,17 @@ func (q *QMP) ExecHotplugMemory(ctx context.Context, qomtype, id, mempath string
|
||||
}
|
||||
|
||||
// ExecutePCIVSockAdd adds a vhost-vsock-pci bus
|
||||
func (q *QMP) ExecutePCIVSockAdd(ctx context.Context, id, guestCID, vhostfd string, disableModern bool) error {
|
||||
func (q *QMP) ExecutePCIVSockAdd(ctx context.Context, id, guestCID, vhostfd, addr, bus string, disableModern bool) error {
|
||||
args := map[string]interface{}{
|
||||
"driver": VHostVSockPCI,
|
||||
"id": id,
|
||||
"guest-cid": guestCID,
|
||||
"vhostfd": vhostfd,
|
||||
"addr": addr,
|
||||
}
|
||||
|
||||
if bus != "" {
|
||||
args["bus"] = bus
|
||||
}
|
||||
|
||||
if disableModern {
|
||||
|
Loading…
Reference in New Issue
Block a user