MemoryConfiguration returns the current QEMU machine memory configuration (current, max, slots).
()
| 264 | |
| 265 | // MemoryConfiguration returns the current QEMU machine memory configuration (current, max, slots). |
| 266 | func (m *Monitor) MemoryConfiguration() (int64, int64, int64, error) { |
| 267 | // Prepare the request. |
| 268 | var req struct { |
| 269 | Path string `json:"path"` |
| 270 | Property string `json:"property"` |
| 271 | } |
| 272 | |
| 273 | req.Path = "/machine" |
| 274 | req.Property = "memory" |
| 275 | |
| 276 | // Prepare the response. |
| 277 | var resp struct { |
| 278 | Return struct { |
| 279 | Size int64 `json:"size"` |
| 280 | Slots int64 `json:"slots"` |
| 281 | MaxSize int64 `json:"max-size"` |
| 282 | } `json:"return"` |
| 283 | } |
| 284 | |
| 285 | // Query the machine. |
| 286 | err := m.Run("qom-get", req, &resp) |
| 287 | if err != nil { |
| 288 | return -1, -1, -1, err |
| 289 | } |
| 290 | |
| 291 | return resp.Return.Size, resp.Return.MaxSize, resp.Return.Slots, nil |
| 292 | } |
| 293 | |
| 294 | // SendFile adds a new file descriptor to the QMP fd table associated to name. |
| 295 | func (m *Monitor) SendFile(name string, file *os.File) error { |