mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-22 20:39:41 +00:00
vendor: Update govmm
Changes: - qemu/qmp: support query-memory-devices qmp command. - qemu: Add virtio RNG device. Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
40
vendor/github.com/intel/govmm/qemu/qmp.go
generated
vendored
40
vendor/github.com/intel/govmm/qemu/qmp.go
generated
vendored
@@ -160,6 +160,24 @@ type HotpluggableCPU struct {
|
||||
QOMPath string `json:"qom-path"`
|
||||
}
|
||||
|
||||
// MemoryDevicesData cotains the data describes a memory device
|
||||
type MemoryDevicesData struct {
|
||||
Slot int `json:"slot"`
|
||||
Node int `json:"node"`
|
||||
Addr uint64 `json:"addr"`
|
||||
Memdev string `json:"memdev"`
|
||||
ID string `json:"id"`
|
||||
Hotpluggable bool `json:"hotpluggable"`
|
||||
Hotplugged bool `json:"hotplugged"`
|
||||
Size uint64 `json:"size"`
|
||||
}
|
||||
|
||||
// MemoryDevices represents memory devices of vm
|
||||
type MemoryDevices struct {
|
||||
Data MemoryDevicesData `json:"data"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
func (q *QMP) readLoop(fromVMCh chan<- []byte) {
|
||||
scanner := bufio.NewScanner(q.conn)
|
||||
for scanner.Scan() {
|
||||
@@ -989,6 +1007,28 @@ func (q *QMP) ExecSetMigrateArguments(ctx context.Context, url string) error {
|
||||
return q.executeCommand(ctx, "migrate", args, nil)
|
||||
}
|
||||
|
||||
// ExecQueryMemoryDevices returns a slice with the list of memory devices
|
||||
func (q *QMP) ExecQueryMemoryDevices(ctx context.Context) ([]MemoryDevices, error) {
|
||||
response, err := q.executeCommandWithResponse(ctx, "query-memory-devices", nil, nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// convert response to json
|
||||
data, err := json.Marshal(response)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to extract memory devices information: %v", err)
|
||||
}
|
||||
|
||||
var memoryDevices []MemoryDevices
|
||||
// convert json to []MemoryDevices
|
||||
if err = json.Unmarshal(data, &memoryDevices); err != nil {
|
||||
return nil, fmt.Errorf("unable to convert json to memory devices: %v", err)
|
||||
}
|
||||
|
||||
return memoryDevices, nil
|
||||
}
|
||||
|
||||
// ExecHotplugMemory adds size of MiB memory to the guest
|
||||
func (q *QMP) ExecHotplugMemory(ctx context.Context, qomtype, id, mempath string, size int) error {
|
||||
args := map[string]interface{}{
|
||||
|
Reference in New Issue
Block a user