MachineDefinition returns the current QEMU machine definition name.
()
| 239 | |
| 240 | // MachineDefinition returns the current QEMU machine definition name. |
| 241 | func (m *Monitor) MachineDefinition() (string, error) { |
| 242 | // Prepare the request. |
| 243 | var req struct { |
| 244 | Path string `json:"path"` |
| 245 | Property string `json:"property"` |
| 246 | } |
| 247 | |
| 248 | req.Path = "/machine" |
| 249 | req.Property = "type" |
| 250 | |
| 251 | // Prepare the response. |
| 252 | var resp struct { |
| 253 | Return string `json:"return"` |
| 254 | } |
| 255 | |
| 256 | // Query the machine. |
| 257 | err := m.Run("qom-get", req, &resp) |
| 258 | if err != nil { |
| 259 | return "", err |
| 260 | } |
| 261 | |
| 262 | return strings.TrimSuffix(resp.Return, "-machine"), nil |
| 263 | } |
| 264 | |
| 265 | // MemoryConfiguration returns the current QEMU machine memory configuration (current, max, slots). |
| 266 | func (m *Monitor) MemoryConfiguration() (int64, int64, int64, error) { |