// Run executes the given QAPI command against a domain's QEMU instance.
// For a list of available QAPI commands, see:
//	http://git.qemu.org/?p=qemu.git;a=blob;f=qapi-schema.json;hb=HEAD
func (mon LibvirtShellMonitor) Run(cmd []byte) ([]byte, error) {
	raw, err := virsh.Virsh(
		mon.prep,
		mon.url.String(),
		"qemu-monitor-command",
		mon.domain,
		string(cmd),
	)
	if err != nil {
		return raw, err
	}

	// check for QEMU errors
	var r response
	if err = json.Unmarshal(raw, &r); err != nil {
		return raw, err
	}
	if err := r.Err(); err != nil {
		return raw, err
	}

	return raw, err
}
// Connect sets up a QEMU QMP connection via libvirt's QEMU monitor socket.
// An error is returned if the libvirt daemon is unreachable.
func (mon LibvirtShellMonitor) Connect() error {
	_, err := virsh.Virsh(mon.prep, mon.url.String(), "connect")
	return err
}