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:
Jose Carlos Venegas Munoz
2018-09-10 13:27:20 -05:00
parent 8f5fec8064
commit f1829d078a
4 changed files with 103 additions and 3 deletions

View File

@@ -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{}{