MCPcopy
hub / github.com/lxc/incus / MachineDefinition

Method MachineDefinition

internal/server/instance/drivers/qmp/commands.go:241–263  ·  view source on GitHub ↗

MachineDefinition returns the current QEMU machine definition name.

()

Source from the content-addressed store, hash-verified

239
240// MachineDefinition returns the current QEMU machine definition name.
241func (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).
266func (m *Monitor) MemoryConfiguration() (int64, int64, int64, error) {

Callers 1

startMethod · 0.80

Calls 1

RunMethod · 0.95

Tested by

no test coverage detected