Skip to content

Golang interface to the QEMU Machine Protocol (QMP)

License

Notifications You must be signed in to change notification settings

quadrifoglio/go-qmp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-QMP - Golang interface to QMP

The QEMU Machine Protocol (QMP) is a JSON-based protocol which allows applications to control a QEMU instance.

This library offers a simple interface to QMP for the Go programming language.

Basic Usage

import "github.com/quadrifoglio/go-qmp"

// Connection to QMP
c, err := qmp.Open("unix", "/tmp/qmp.sock")
if err != nil {
	log.Fatal(err)
}

defer c.Close()

// Execute simple QMP command
result, err = c.Command("query-status", nil)
if err != nil {
	log.Fatal(err)
}

fmt.Println(result)

// Execute QMP command with arguments

args := map[string]string {
	"device": "ide1-cd0"
}

result, err = c.Command("eject", args)
if err != nil {
	log.Fatal(err)
}

// Execute HMP command
result, err = c.HumanMonitorCommand("savevm checkpoint")
if err != nil {
	log.Fatal(err)
}

About

Golang interface to the QEMU Machine Protocol (QMP)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages